effusion v0.1.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

Check a piece of data’s SHA-1 hash against another SHA-1 hash

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.inspect(<<1, 2, 3>>)
"010203"

iex> Effusion.Hash.inspect(<<50, 100, 150, 200, 250>>)
"326496c8fa"

Check a piece of data’s SHA-1 hash against another SHA-1 hash.

Examples

Effusion.Hash.matches(Effusion.Hash.calc("Hello!"), "Hello!")
true

Effusion.Hash.matches(<<1, 2, 3>>, "Nope!")
false