Supported Message Digest Algorithms
The following standard message digest algorithms are supported by the Provider through the java.security.MessageDigest interface:
Message Digest Name | Digest Length (bits) |
---|---|
MD2 | 128 |
MD5 | 128 |
SHA-1 | 160 |
SHA-224 | 224 |
SHA-256 | 256 |
SHA-384 | 384 |
SHA-512 | 512 |
RIPEMD128 | 128 |
RIPEMD160 | 160 |
MD2
This message digest algorithm produces a 128-bit digest. The algorithm is described in RFC-1319. This algorithm is provided for compatibility only and is not recommended for other purposes. Instances of this algorithm cannot be cloned.
To create a MD2 message digest for the message “hello world”:
MessageDigest md2 = MessageDigest.getInstance(“MD2”, “SAFENET”);
byte[] digest = md2.digest(“hello world”.getBytes());
MD5
This message digest algorithm produces a 128-bit digest. The algorithm is described in RFC-1321. This algorithm is provided for compatibility only and is not recommended for other purposes. Instances of this algorithm cannot be cloned.
To create a MD5 message digest for the message “hello world”:
MessageDigest md5 = MessageDigest.getInstance(“MD5”, “SAFENET”);
byte[] digest = md5.digest(“hello world”.getBytes());
SHA-1
The SHA-1 message digest algorithm produces a 160-bit digest. The algorithm is described in FIPS PUB 180-1. Instances of this algorithm cannot be cloned.
To create a SHA-1 message digest for the message “hello world”:
MessageDigest sha1 = MessageDigest.getInstance(“SHA-1”, “SAFENET”);
byte[] digest = sha1.digest(“hello world”.getBytes());
SHA-224
The SHA-224 message digest algorithm produces a 224-bit digest. The algorithm is described in FIPS PUB 180-1. Instances of this algorithm cannot be cloned.
To create a SHA-224 message digest for the message “hello world”:
MessageDigest sha256 = MessageDigest.getInstance(“SHA-224”, “SAFENET”);
byte[] digest = sha224.digest(“hello world”.getBytes());
SHA-256
The SHA-256 message digest algorithm produces a 256-bit digest. The algorithm is described in FIPS PUB 180-1. Instances of this algorithm cannot be cloned.
To create a SHA-256 message digest for the message “hello world”:
MessageDigest sha256 = MessageDigest.getInstance(“SHA-256”, “SAFENET”);
byte[] digest = sha256.digest(“hello world”.getBytes());
SHA-384
The SHA-384 message digest algorithm produces a 384-bit digest. The algorithm is described in FIPS PUB 180-1. Instances of this algorithm cannot be cloned.
To create a SHA-384 message digest for the message “hello world”:
MessageDigest sha384 = MessageDigest.getInstance(“SHA-384”, “SAFENET”);
byte[] digest = sha384.digest(“hello world”.getBytes());
SHA-512
The SHA-512 message digest algorithm produces a 512-bit digest. The algorithm is described in FIPS PUB 180-1. Instances of this algorithm cannot be cloned.
To create a SHA-512 message digest for the message “hello world”:
MessageDigest sha512 = MessageDigest.getInstance(“SHA-512”, “SAFENET”);
byte[] digest = sha512.digest(“hello world”.getBytes());
RIPEMD128
The RIPEMD128 message digest algorithm produces a 128-bit digest. Instances of this algorithm cannot be cloned.
To create a RIPEMD128 message digest for the message “hello world”:
MessageDigest rmd128 = MessageDigest.getInstance(“RIPEMD128”,
“SAFENET”);
byte[] digest = rmd128.digest(“hello world”.getBytes());
RIPEMD160
The RIPEMD160 message digest algorithm produces a 160-bit digest. Instances of this algorithm cannot be cloned.
To create a RIPEMD160 message digest for the message “hello world”:
MessageDigest rmd160 = MessageDigest.getInstance(“RIPEMD160”,
“SAFENET”);
byte[] digest = rmd160.digest(“hello world”.getBytes());