what-the-bank/sources/org/bouncycastle/jcajce/util/MessageDigestUtils.java

50 lines
2.7 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package org.bouncycastle.jcajce.util;
import java.util.HashMap;
import java.util.Map;
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers;
import org.bouncycastle.asn1.gnu.GNUObjectIdentifiers;
import org.bouncycastle.asn1.iso.ISOIECObjectIdentifiers;
import org.bouncycastle.asn1.nist.NISTObjectIdentifiers;
import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers;
import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
import org.bouncycastle.asn1.teletrust.TeleTrusTObjectIdentifiers;
import org.bouncycastle.pqc.jcajce.spec.McElieceCCA2KeyGenParameterSpec;
import org.bouncycastle.pqc.jcajce.spec.SPHINCS256KeyGenParameterSpec;
/* loaded from: classes6.dex */
public class MessageDigestUtils {
private static Map<ASN1ObjectIdentifier, String> digestOidMap;
public static String getDigestName(ASN1ObjectIdentifier aSN1ObjectIdentifier) {
String str = digestOidMap.get(aSN1ObjectIdentifier);
return str != null ? str : aSN1ObjectIdentifier.getId();
}
static {
HashMap hashMap = new HashMap();
digestOidMap = hashMap;
hashMap.put(PKCSObjectIdentifiers.md2, "MD2");
digestOidMap.put(PKCSObjectIdentifiers.md4, "MD4");
digestOidMap.put(PKCSObjectIdentifiers.md5, "MD5");
digestOidMap.put(OIWObjectIdentifiers.idSHA1, McElieceCCA2KeyGenParameterSpec.SHA1);
digestOidMap.put(NISTObjectIdentifiers.id_sha224, McElieceCCA2KeyGenParameterSpec.SHA224);
digestOidMap.put(NISTObjectIdentifiers.id_sha256, McElieceCCA2KeyGenParameterSpec.SHA256);
digestOidMap.put(NISTObjectIdentifiers.id_sha384, McElieceCCA2KeyGenParameterSpec.SHA384);
digestOidMap.put(NISTObjectIdentifiers.id_sha512, McElieceCCA2KeyGenParameterSpec.SHA512);
digestOidMap.put(TeleTrusTObjectIdentifiers.ripemd128, "RIPEMD-128");
digestOidMap.put(TeleTrusTObjectIdentifiers.ripemd160, "RIPEMD-160");
digestOidMap.put(TeleTrusTObjectIdentifiers.ripemd256, "RIPEMD-128");
digestOidMap.put(ISOIECObjectIdentifiers.ripemd128, "RIPEMD-128");
digestOidMap.put(ISOIECObjectIdentifiers.ripemd160, "RIPEMD-160");
digestOidMap.put(CryptoProObjectIdentifiers.gostR3411, "GOST3411");
digestOidMap.put(GNUObjectIdentifiers.Tiger_192, "Tiger");
digestOidMap.put(ISOIECObjectIdentifiers.whirlpool, "Whirlpool");
digestOidMap.put(NISTObjectIdentifiers.id_sha3_224, "SHA3-224");
digestOidMap.put(NISTObjectIdentifiers.id_sha3_256, SPHINCS256KeyGenParameterSpec.SHA3_256);
digestOidMap.put(NISTObjectIdentifiers.id_sha3_384, "SHA3-384");
digestOidMap.put(NISTObjectIdentifiers.id_sha3_512, "SHA3-512");
}
}