package example; import helpers.ScryptHelper; import java.nio.CharBuffer; import org.bouncycastle.util.Arrays; public class Example { public static void main(String[] args) { // generate hash using Strings String password1 = "testing123"; String hash1 = ScryptHelper.hash(password1).toString(); System.out.println(hash1); // check the hash against the password boolean valid1 = ScryptHelper.check(hash1, password1); System.out.println("Valid? " + valid1); // generate hash using char[] and CharBuffer char[] password2 = "testing123".toCharArray(); CharBuffer cb = CharBuffer.wrap(password2); CharBuffer hash2 = ScryptHelper.hash(cb); System.out.println(hash2); // check the hash against the password boolean valid2 = ScryptHelper.check(hash2, cb); System.out.println("Valid? " + valid2); // zero the password and hash Arrays.fill(password2, '0'); Arrays.fill(hash2.array(), '0'); System.out.println(password2); System.out.println(cb); System.out.println(hash2); } }