Skip to content

Instantly share code, notes, and snippets.

@firaja
Last active October 6, 2022 11:50
Show Gist options
  • Save firaja/541e2314f61721ababa602cf6948e915 to your computer and use it in GitHub Desktop.
Save firaja/541e2314f61721ababa602cf6948e915 to your computer and use it in GitHub Desktop.
Password4j - Verify scrypt hash without specifying parameters
String hash = "$100801$cHJpdmF0ZS1zYWx0$ibAGantBIzk0Zcpl11VLaywBOdVA4mgrwTkIxWbNYBsIDROtTIMGULxMS9AJj7MOs74D/fQk6WtodZ1115i5wg==";
ScryptFunction scrypt = ScryptFunction.getInstanceFromHash(hash);
boolean verified = Password.check("my password", hash)
.addPepper("shared-secret")
.with(scrypt);
// true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment