Here you can find the source of hashAlgToId(String hashAlg)
public static int hashAlgToId(String hashAlg)
//package com.java2s; /*/*from w w w . j ava 2 s . com*/ Blue Crystal: Document Digital Signature Tool Copyright (C) 2007-2015 Sergio Leal This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ public class Main { protected static final int ALG_SHA1 = 0; protected static final int ALG_SHA224 = 1; protected static final int ALG_SHA256 = 2; protected static final int ALG_SHA384 = 3; protected static final int ALG_SHA512 = 4; public static int hashAlgToId(String hashAlg) { int hashId = 0; if (hashAlg.compareToIgnoreCase("SHA1") == 0) { hashId = ALG_SHA1; } else if (hashAlg.compareToIgnoreCase("SHA224") == 0) { hashId = ALG_SHA224; } else if (hashAlg.compareToIgnoreCase("SHA256") == 0) { hashId = ALG_SHA256; } else if (hashAlg.compareToIgnoreCase("SHA384") == 0) { hashId = ALG_SHA384; } else if (hashAlg.compareToIgnoreCase("SHA512") == 0) { hashId = ALG_SHA512; } return hashId; } }