@Test public void testEncryptSHAStringString() throws NoSuchAlgorithmException { Assert.assertEquals("", SHA.encryptSHA(null, null)); Assert.assertEquals(SHA_foo, SHA.encryptSHA("foo", "SHA")); Assert.assertEquals(SHA_1_foo, SHA.encryptSHA("foo", "SHA-1")); Assert.assertEquals(SHA_256_foo, SHA.encryptSHA("foo", "SHA-256")); Assert.assertEquals(SHA_bar, SHA.encryptSHA("bar", "SHA")); Assert.assertEquals(SHA_1_bar, SHA.encryptSHA("bar", "SHA-1")); Assert.assertEquals(SHA_256_bar, SHA.encryptSHA("bar", "SHA-256")); }
public static byte[] encryptSHA(byte[] data) throws Exception { MessageDigest sha = MessageDigest.getInstance(KEY_SHA1); sha.update(data); return sha.digest(); }
SHA { public static byte[] encryptSHA(byte[] data) throws Exception { MessageDigest sha = MessageDigest.getInstance(KEY_SHA1); sha.update(data); return sha.digest(); } }
SHA { public static byte[] encryptSHA(byte[] data) throws Exception { MessageDigest sha = MessageDigest.getInstance(KEY_SHA1); sha.update(data); return sha.digest(); } SHA(); }
SHA { public static byte[] encryptSHA(byte[] data) throws Exception { MessageDigest sha = MessageDigest.getInstance(KEY_SHA1); sha.update(data); return sha.digest(); } SHA(); static byte[] encryptSHA(byte[] data); static String encryptSHA(String data); static String encryptSHA(String str,String ecryptCode); static void main(String[] args); }
SHA { public static byte[] encryptSHA(byte[] data) throws Exception { MessageDigest sha = MessageDigest.getInstance(KEY_SHA1); sha.update(data); return sha.digest(); } SHA(); static byte[] encryptSHA(byte[] data); static String encryptSHA(String data); static String encryptSHA(String str,String ecryptCode); static void main(String[] args);  }