@Test public void testSHA1() { eq(Crypto.sha1("abc"), "a9993e364706816aba3e25717850c26c9cd0d89d"); eq(Crypto.sha1("x"), "11f6ad8ec52a2984abaafd7c3b516503785c2072"); eq(Crypto.sha1(" "), "b858cb282617fb0956d960215c8e84d1ccf909c6"); eq(Crypto.sha1(""), "da39a3ee5e6b4b0d3255bfef95601890afd80709"); }
public static String sha1(byte[] bytes) { return bytesAsText(sha1Bytes(bytes)); }
Crypto extends RapidoidThing { public static String sha1(byte[] bytes) { return bytesAsText(sha1Bytes(bytes)); } }
Crypto extends RapidoidThing { public static String sha1(byte[] bytes) { return bytesAsText(sha1Bytes(bytes)); }  }
Crypto extends RapidoidThing { public static String sha1(byte[] bytes) { return bytesAsText(sha1Bytes(bytes)); }  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 String sha1(byte[] bytes) { return bytesAsText(sha1Bytes(bytes)); }  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; }