/sigmah/src/test/java/org/sigmah/server/auth/BCryptTest.java
Java | 36 lines | 22 code | 10 blank | 4 comment | 0 complexity | cb90b4f2508bdfeee078f7e824cce8ad MD5 | raw file
1/* 2 * All Sigmah code is released under the GNU General Public License v3 3 * See COPYRIGHT.txt and LICENSE.txt. 4 */ 5 6package org.sigmah.server.auth; 7 8import org.junit.Ignore; 9import org.junit.Test; 10import org.sigmah.server.auth.impl.BCrypt; 11 12import static org.junit.Assert.assertTrue; 13 14public class BCryptTest { 15 16 @Test 17 public void realityCheck() { 18 19 String input = "Hello world"; 20 21 String hashed = BCrypt.hashpw(input, BCrypt.gensalt()); 22 23 assertTrue(BCrypt.checkpw(input, hashed)); 24 } 25 26 @Test 27 @Ignore("for generating sample dbunit files only") 28 public void generateSamples() { 29 printSample("monday"); 30 printSample("tuesday"); 31 } 32 33 private void printSample(String password) { 34 System.out.println(password + " = " + BCrypt.hashpw(password, BCrypt.gensalt())); 35 } 36}