Plug v1.2.2 Plug.Crypto

Namespace and module for crypto functionality.

Summary

Functions

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

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

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.

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.

secure_compare(left, right)

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

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