Skip to content

Instantly share code, notes, and snippets.

View spapas's full-sized avatar

Serafeim Papastefanos spapas

View GitHub Profile
@spapas
spapas / Hasher.java
Created March 17, 2016 21:46 — forked from lukaszb/Hasher.java
Java implementation of Django PasswordHasher
/* Example implementation of password hasher similar on 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;