forked from veracode/example-java-maven
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBCryptTest.java
More file actions
31 lines (25 loc) · 737 Bytes
/
BCryptTest.java
File metadata and controls
31 lines (25 loc) · 737 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
* © Copyright 2018 - SourceClear Inc
*/
package com.srcclr;
import static junit.framework.TestCase.assertFalse;
import org.junit.Test;
import org.mindrot.jbcrypt.BCrypt;
public class BCryptTest {
/**
* Test for correct hashing of non-US-ASCII passwords.
*/
@Test
public void testInternationalChars() {
System.out.print("BCrypt.hashpw w/ international chars: ");
String pw1 = "ππππππππ";
String pw2 = "????????";
String h1 = BCrypt.hashpw(pw1, BCrypt.gensalt());
assertFalse(BCrypt.checkpw(pw2, h1));
System.out.print(".");
String h2 = BCrypt.hashpw(pw2, BCrypt.gensalt());
assertFalse(BCrypt.checkpw(pw1, h2));
System.out.print(".");
System.out.println("");
}
}