| Modifier and Type | Field and Description |
|---|---|
static SecureRandom |
RANDOM |
| Constructor and Description |
|---|
Crypto() |
| Modifier and Type | Method and Description |
|---|---|
static String |
bytesAsText(byte[] bytes) |
static Cipher |
cipher(String transformation) |
static byte[] |
decrypt(byte[] data) |
static byte[] |
decrypt(byte[] data,
CryptoKey key) |
static MessageDigest |
digest(String algorithm) |
static byte[] |
encrypt(byte[] data) |
static byte[] |
encrypt(byte[] data,
CryptoKey key) |
static CryptoKey |
getSecretKey() |
static byte[] |
hmac(byte[] data,
byte[] secret,
byte[] salt) |
static boolean |
hmacMatches(byte[] hmac,
byte[] data,
byte[] secret,
byte[] salt) |
static String |
md5(byte[] bytes) |
static String |
md5(String data) |
static byte[] |
md5Bytes(byte[] bytes) |
static String |
passwordHash(char[] password) |
static String |
passwordHash(char[] password,
int iterations) |
static String |
passwordHash(char[] password,
int iterations,
byte[] salt) |
static boolean |
passwordMatches(char[] password,
String saltedHash) |
static boolean |
passwordMatches(String password,
String saltedHash) |
static byte[] |
pbkdf2(char[] password,
byte[] salt,
int iterations,
int length) |
static byte[] |
randomBytes(int byteCount) |
static String |
randomStr(int byteCount) |
static void |
reset() |
static String |
sha1(byte[] bytes) |
static String |
sha1(String data) |
static byte[] |
sha1Bytes(byte[] bytes) |
static String |
sha512(byte[] bytes) |
static String |
sha512(String data) |
static byte[] |
sha512Bytes(byte[] bytes) |
public static final SecureRandom RANDOM
public static void reset()
public static MessageDigest digest(String algorithm)
public static String bytesAsText(byte[] bytes)
public static byte[] md5Bytes(byte[] bytes)
public static String md5(byte[] bytes)
public static byte[] sha1Bytes(byte[] bytes)
public static String sha1(byte[] bytes)
public static byte[] sha512Bytes(byte[] bytes)
public static String sha512(byte[] bytes)
public static CryptoKey getSecretKey()
public static String randomStr(int byteCount)
public static byte[] encrypt(byte[] data,
CryptoKey key)
public static byte[] decrypt(byte[] data,
CryptoKey key)
public static byte[] encrypt(byte[] data)
public static byte[] decrypt(byte[] data)
public static byte[] pbkdf2(char[] password,
byte[] salt,
int iterations,
int length)
public static String passwordHash(char[] password)
public static String passwordHash(char[] password, int iterations)
public static String passwordHash(char[] password, int iterations, byte[] salt)
public static boolean passwordMatches(char[] password,
String saltedHash)
public static byte[] randomBytes(int byteCount)
public static byte[] hmac(byte[] data,
byte[] secret,
byte[] salt)
throws Exception
ExceptionCopyright © 2014–2018 Nikolche Mihajlovski and contributors. All rights reserved.