public class SHA256 extends Object
Modifier and Type | Method and Description |
---|---|
static byte[] |
getHash(byte[] data,
boolean nullData)
Calculate the hash code for the given data.
|
static byte[] |
getHashWithSalt(byte[] data,
byte[] salt)
Calculate the hash code by using the given salt.
|
static byte[] |
getHMAC(byte[] key,
byte[] message)
Calculate the hash-based message authentication code.
|
static byte[] |
getKeyPasswordHash(String userName,
char[] password)
Calculate the hash of a password by prepending the user name and a '@'
character.
|
static byte[] |
getPBKDF2(byte[] password,
byte[] salt,
int iterations,
int resultLen)
Calculate the hash using the password-based key derivation function 2.
|
public static byte[] getHashWithSalt(byte[] data, byte[] salt)
data
- the data to hashsalt
- the salt to usepublic static byte[] getKeyPasswordHash(String userName, char[] password)
userName
- the user namepassword
- the passwordpublic static byte[] getHMAC(byte[] key, byte[] message)
key
- the keymessage
- the messagepublic static byte[] getPBKDF2(byte[] password, byte[] salt, int iterations, int resultLen)
password
- the passwordsalt
- the saltiterations
- the number of iterationsresultLen
- the number of bytes in the resultpublic static byte[] getHash(byte[] data, boolean nullData)
data
- the data to hashnullData
- if the data should be filled with zeros after calculating
the hash codeCopyright © 2020 JBoss by Red Hat. All rights reserved.