@Test public void testDigest() { notNull(Crypto.digest("MD5")); notNull(Crypto.digest("SHA-1")); notNull(Crypto.digest("SHA-512")); }
public static MessageDigest digest(String algorithm) { try { return MessageDigest.getInstance(algorithm); } catch (NoSuchAlgorithmException e) { throw U.rte("Cannot find crypto algorithm: " + algorithm); } }
Crypto extends RapidoidThing { public static MessageDigest digest(String algorithm) { try { return MessageDigest.getInstance(algorithm); } catch (NoSuchAlgorithmException e) { throw U.rte("Cannot find crypto algorithm: " + algorithm); } } }
Crypto extends RapidoidThing { public static MessageDigest digest(String algorithm) { try { return MessageDigest.getInstance(algorithm); } catch (NoSuchAlgorithmException e) { throw U.rte("Cannot find crypto algorithm: " + algorithm); } }  }
Crypto extends RapidoidThing { public static MessageDigest digest(String algorithm) { try { return MessageDigest.getInstance(algorithm); } catch (NoSuchAlgorithmException e) { throw U.rte("Cannot find crypto algorithm: " + algorithm); } }  static void reset(); static MessageDigest digest(String algorithm); static Cipher cipher(String transformation); static String bytesAsText(byte[] bytes); static byte[] md5Bytes(byte[] bytes); static String md5(byte[] bytes); static String md5(String data); static byte[] sha1Bytes(byte[] bytes); static String sha1(byte[] bytes); static String sha1(String data); static byte[] sha512Bytes(byte[] bytes); static String sha512(byte[] bytes); static String sha512(String data); static synchronized CryptoKey getSecretKey(); static String randomStr(int byteCount); static byte[] encrypt(byte[] data, CryptoKey key); static byte[] decrypt(byte[] data, CryptoKey key); static byte[] encrypt(byte[] data); static byte[] decrypt(byte[] data); static byte[] pbkdf2(char[] password, byte[] salt, int iterations, int length); 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[] randomBytes(int byteCount); static byte[] hmac(byte[] data, byte[] secret, byte[] salt); static boolean hmacMatches(byte[] hmac, byte[] data, byte[] secret, byte[] salt); }
Crypto extends RapidoidThing { public static MessageDigest digest(String algorithm) { try { return MessageDigest.getInstance(algorithm); } catch (NoSuchAlgorithmException e) { throw U.rte("Cannot find crypto algorithm: " + algorithm); } }  static void reset(); static MessageDigest digest(String algorithm); static Cipher cipher(String transformation); static String bytesAsText(byte[] bytes); static byte[] md5Bytes(byte[] bytes); static String md5(byte[] bytes); static String md5(String data); static byte[] sha1Bytes(byte[] bytes); static String sha1(byte[] bytes); static String sha1(String data); static byte[] sha512Bytes(byte[] bytes); static String sha512(byte[] bytes); static String sha512(String data); static synchronized CryptoKey getSecretKey(); static String randomStr(int byteCount); static byte[] encrypt(byte[] data, CryptoKey key); static byte[] decrypt(byte[] data, CryptoKey key); static byte[] encrypt(byte[] data); static byte[] decrypt(byte[] data); static byte[] pbkdf2(char[] password, byte[] salt, int iterations, int length); 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[] randomBytes(int byteCount); static byte[] hmac(byte[] data, byte[] secret, byte[] salt); static boolean hmacMatches(byte[] hmac, byte[] data, byte[] secret, byte[] salt); static final SecureRandom RANDOM; }