effusion v0.2.0 Effusion.Hash View Source
Utilities for working with SHA-1 hashes.
Link to this section Summary
Functions
Calculate the SHA-1 hash on a binary.
Formats a hash into a nice, readable hex string.
Returns true
if term
is a 20-byte binary; otherwise returns false
.
Link to this section Functions
Calculate the SHA-1 hash on a binary.
Examples
iex> Effusion.Hash.calc("Hello!")
<<105, 52, 44, 92, 57, 229, 174, 95, 0, 119, 174, 204, 50, 192, 248, 24, 17, 251, 129, 147>>
Formats a hash into a nice, readable hex string.
Examples
iex> Effusion.Hash.calc("Hello!") |> Effusion.Hash.encode()
"69342c5c39e5ae5f0077aecc32c0f81811fb8193"
Returns true
if term
is a 20-byte binary; otherwise returns false
.
Allowed in guard tests.
Examples
iex> Effusion.Hash.is_hash("12345678901234567890")
true
iex> Effusion.Hash.is_hash("1234567890")
false