Skip to content

Instantly share code, notes, and snippets.

View ssill2's full-sized avatar

Stephen Sill II ssill2

  • Thornton, Colorado
View GitHub Profile
@lukaszb
lukaszb / Hasher.java
Last active January 31, 2025 16:40
Java implementation of Django PasswordHasher
/* Example implementation of password hasher similar to Django's PasswordHasher
* Requires Java8 (but should be easy to port to older JREs)
* Currently it would work only for pbkdf2_sha256 algorithm
*
* Django code: https://github.com/django/django/blob/1.6.5/django/contrib/auth/hashers.py#L221
*/
import java.nio.charset.Charset;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.KeySpec;