Package org.xipki.security
Enum HashAlgo
- java.lang.Object
-
- java.lang.Enum<HashAlgo>
-
- org.xipki.security.HashAlgo
-
- All Implemented Interfaces:
Serializable,Comparable<HashAlgo>
public enum HashAlgo extends Enum<HashAlgo>
Hash algorithm enum.- Since:
- 2.0.0
- Author:
- Lijun Liao (xipki)
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringbase64Hash(byte[]... datas)Stringbase64Hash(byte[] data, int offset, int len)org.bouncycastle.crypto.ExtendedDigestcreateDigest()org.bouncycastle.asn1.x509.AlgorithmIdentifiergetAlgIdWithNullParams()org.bouncycastle.asn1.x509.AlgorithmIdentifiergetAlgorithmIdentifier()intgetEncodedLength()static HashAlgogetInstance(String nameOrOid)static HashAlgogetInstance(org.bouncycastle.asn1.ASN1ObjectIdentifier oid)static HashAlgogetInstance(org.bouncycastle.asn1.x509.AlgorithmIdentifier id)static HashAlgogetInstanceForEncoded(byte[] encoded)static HashAlgogetInstanceForEncoded(byte[] encoded, int offset, int len)StringgetJceName()intgetLength()org.bouncycastle.asn1.ASN1ObjectIdentifiergetOid()byte[]hash(byte[]... datas)byte[]hash(byte[] data, int offset, int len)StringhexHash(byte[]... datas)StringhexHash(byte[] data, int offset, int len)booleanisShake()static HashAlgovalueOf(String name)Returns the enum constant of this type with the specified name.static HashAlgo[]values()Returns an array containing the constants of this enum type, in the order they are declared.intwrite(byte[] out, int offset)
-
-
-
Enum Constant Detail
-
SHA1
public static final HashAlgo SHA1
-
SHA224
public static final HashAlgo SHA224
-
SHA256
public static final HashAlgo SHA256
-
SHA384
public static final HashAlgo SHA384
-
SHA512
public static final HashAlgo SHA512
-
SHA3_224
public static final HashAlgo SHA3_224
-
SHA3_256
public static final HashAlgo SHA3_256
-
SHA3_384
public static final HashAlgo SHA3_384
-
SHA3_512
public static final HashAlgo SHA3_512
-
SM3
public static final HashAlgo SM3
-
SHAKE128
public static final HashAlgo SHAKE128
-
SHAKE256
public static final HashAlgo SHAKE256
-
-
Method Detail
-
values
public static HashAlgo[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (HashAlgo c : HashAlgo.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static HashAlgo valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
getLength
public int getLength()
-
getOid
public org.bouncycastle.asn1.ASN1ObjectIdentifier getOid()
-
getJceName
public String getJceName()
-
isShake
public boolean isShake()
-
getInstance
public static HashAlgo getInstance(org.bouncycastle.asn1.x509.AlgorithmIdentifier id) throws NoSuchAlgorithmException
- Throws:
NoSuchAlgorithmException
-
getInstance
public static HashAlgo getInstance(org.bouncycastle.asn1.ASN1ObjectIdentifier oid) throws NoSuchAlgorithmException
- Throws:
NoSuchAlgorithmException
-
getInstance
public static HashAlgo getInstance(String nameOrOid) throws NoSuchAlgorithmException
- Throws:
NoSuchAlgorithmException
-
getInstanceForEncoded
public static HashAlgo getInstanceForEncoded(byte[] encoded) throws NoSuchAlgorithmException
- Throws:
NoSuchAlgorithmException
-
getInstanceForEncoded
public static HashAlgo getInstanceForEncoded(byte[] encoded, int offset, int len) throws NoSuchAlgorithmException
- Throws:
NoSuchAlgorithmException
-
getAlgorithmIdentifier
public org.bouncycastle.asn1.x509.AlgorithmIdentifier getAlgorithmIdentifier()
-
getAlgIdWithNullParams
public org.bouncycastle.asn1.x509.AlgorithmIdentifier getAlgIdWithNullParams()
-
createDigest
public org.bouncycastle.crypto.ExtendedDigest createDigest()
-
hexHash
public String hexHash(byte[]... datas)
-
hexHash
public String hexHash(byte[] data, int offset, int len)
-
base64Hash
public String base64Hash(byte[]... datas)
-
base64Hash
public String base64Hash(byte[] data, int offset, int len)
-
hash
public byte[] hash(byte[]... datas)
-
hash
public byte[] hash(byte[] data, int offset, int len)
-
getEncodedLength
public int getEncodedLength()
-
write
public int write(byte[] out, int offset)
-
-