bcrypt_elixir v0.12.0 Bcrypt.Base64 View Source

Module that provides base64 encoding for bcrypt.

Most developers will not need to use this module directly.

Bcrypt uses an adapted base64 alphabet (using . instead of +, starting with ./ and with no padding).

Link to this section Summary

Functions

Decode using the adapted Bcrypt alphabet

Encode using the adapted Bcrypt alphabet

Shorten the salt to 128 bits + 4 zeros

Link to this section Functions

Decode using the adapted Bcrypt alphabet.

Examples

iex> Bcrypt.Base64.decode 'a1/fZUDsXETlX1K'
'spamandeggs'

Encode using the adapted Bcrypt alphabet.

Examples

iex> Bcrypt.Base64.encode 'spamandeggs'
'a1/fZUDsXETlX1K'

Shorten the salt to 128 bits + 4 zeros.

Examples

iex> Bcrypt.Base64.normalize '0CaBPBIAm2pgeQiCrTSa5O'
'0CaBPBIAm2pgeQiCrTSa5O'
iex> Bcrypt.Base64.normalize '0CaBPBIAm2pgeQiCrTSa5S'
'0CaBPBIAm2pgeQiCrTSa5O'
iex> Bcrypt.Base64.normalize '0CaBPBIAm2pgeQiCrTSa5B'
'0CaBPBIAm2pgeQiCrTSa5.'