コード例 #1
0
 @Test
 public void testGeneratingBlank() throws Exception {
   UsernamePasswordHashUtil util = new UsernamePasswordHashUtil();
   String hash = util.generateHashedHexURP("", "", new char[] {});
   assertEquals("4501c091b0366d76ea3218b6cfdd8097", hash);
 }
コード例 #2
0
 @Test
 public void testGeneratingHexWithUtf() throws Exception {
   UsernamePasswordHashUtil util = new UsernamePasswordHashUtil();
   String hash = util.generateHashedHexURP("管理员", "测试", "秘密".toCharArray());
   assertEquals("64a5cd94a3953484a1e473d0ca35d208", hash);
 }
コード例 #3
0
 @Test
 public void testGeneratingHexWithAlternativeDigest() throws Exception {
   UsernamePasswordHashUtil util = new UsernamePasswordHashUtil(MessageDigest.getInstance("SHA1"));
   String hash = util.generateHashedHexURP("admin", "test", "secret".toCharArray());
   assertEquals("88b8bf3682564e447713c1ed8b09810df135195a", hash);
 }
コード例 #4
0
 @Test
 public void testGeneratingHex() throws Exception {
   UsernamePasswordHashUtil util = new UsernamePasswordHashUtil();
   String hash = util.generateHashedHexURP("admin", "test", "secret".toCharArray());
   assertEquals("d6f18efa527f1bd22b4a67fc621cfbe7", hash);
 }