pass v0.3.0 Pass.Hash

Implements methods for password hashing, verification, and formatting for data storage.

Summary

Functions

Given a plaintext string it generates a new salt, hashes the string, and returns a string formatted for data storage. The formatted string is broken up into multiple sections with the “$” delimiter. The current format is: “hash_algorithm$#blocks$#interations$salt$hash”. Both the salt and the hash are unpadded, URL-safe, Base 64 encoded values

Implements the PBKDF2 algorithm with SHA512 to hash a password

Takes in a plaintext and a string formatted using the db_password/1 function and returns true if the formatted string is the derived key for the plaintext string provided

Functions

db_password(password)

Given a plaintext string it generates a new salt, hashes the string, and returns a string formatted for data storage. The formatted string is broken up into multiple sections with the “$” delimiter. The current format is: “hash_algorithm$#blocks$#interations$salt$hash”. Both the salt and the hash are unpadded, URL-safe, Base 64 encoded values.

password(password, salt, blocks \\ 2, cost \\ 96000)

Implements the PBKDF2 algorithm with SHA512 to hash a password.

verify(password, hash)

Takes in a plaintext and a string formatted using the db_password/1 function and returns true if the formatted string is the derived key for the plaintext string provided.