Plug.Crypto

Namespace and module for crypto functionality.

Source

Summary

mask(left, right)

Masks the token on the left with the token on the right

masked_compare(left, right, mask)

Compares the two binaries (one being masked) in constant-time to avoid timing attacks

secure_compare(left, right)

Compares the two binaries in constant-time to avoid timing attacks

Functions

mask(left, right)

Masks the token on the left with the token on the right.

Both tokens are required to have the same size.

Source
masked_compare(left, right, mask)

Compares the two binaries (one being masked) in constant-time to avoid timing attacks.

It is assumed the right token is masked according to the given mask.

Source
secure_compare(left, right)

Compares the two binaries in constant-time to avoid timing attacks.

See: http://codahale.com/a-lesson-in-timing-attacks/

Source