[][src]Module lsx::sha256

An implementation of the SHA-256 cryptographic hash function, in both buffered and unbuffered flavors. Enabled by default, or if you request the "sha256" feature.

Use hash() if the data you're hashing is already present in contiguous memory, RawSha256 if it is convenient for you to provide data in 64-byte blocks, or BufSha256 otherwise.

Structs

BufSha256

A SHA-256 state, including a buffer to allow non-block-sized inputs.

RawSha256

A raw SHA-256 state. This does not include a buffer, so you must provide data in exact increments of BLOCKBYTES (64 bytes).

Constants

BLOCKBYTES

The number of bytes consumed in each "round" of SHA-256. (512 bits = 64 bytes)

HASHBYTES

The number of bytes in a SHA-256 hash. (256 bits = 32 bytes)

Functions

hash

Calculate the SHA-256 hash of a given byte string. Useful if your entire message is already in contiguous memory. If it's not, you should use one of this module's structs instead.