`SHA2` hash algorithm family. See: - [[ https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf ]] - [[ https://datatracker.ietf.org/doc/html/rfc3874 ]]

Collection Info

View Source
Collection
core
Path
crypto/sha2
Entries
20

Source Files

Constants

7

BLOCK_SIZE_256 #

Source
BLOCK_SIZE_256 :: 64

BLOCK_SIZE_256 is the SHA-224 and SHA-256 block size in bytes.

BLOCK_SIZE_512 #

Source
BLOCK_SIZE_512 :: 128

BLOCK_SIZE_512 is the SHA-384, SHA-512, and SHA-512/256 block size in bytes.

DIGEST_SIZE_224 #

Source
DIGEST_SIZE_224 :: 28

DIGEST_SIZE_224 is the SHA-224 digest size in bytes.

DIGEST_SIZE_256 #

Source
DIGEST_SIZE_256 :: 32

DIGEST_SIZE_256 is the SHA-256 digest size in bytes.

DIGEST_SIZE_384 #

Source
DIGEST_SIZE_384 :: 48

DIGEST_SIZE_384 is the SHA-384 digest size in bytes.

DIGEST_SIZE_512 #

Source
DIGEST_SIZE_512 :: 64

DIGEST_SIZE_512 is the SHA-512 digest size in bytes.

DIGEST_SIZE_512_256 #

Source
DIGEST_SIZE_512_256 :: 32

DIGEST_SIZE_512_256 is the SHA-512/256 digest size in bytes.

Types

2

Procedures

11

clone #

Source
clone :: proc(ctx, other: ^$T) {…}

clone clones the Context other into ctx.

final #

Source
final :: proc(ctx: ^$T, hash: []u8, finalize_clone: bool = false) {…}

final finalizes the Context, writes the digest to hash, and calls reset on the Context. If and only if (⟺) finalize_clone is set, final will work on a copy of the Context, which is useful for for calculating rolling digests.

is_hardware_accelerated_256 #

Source
is_hardware_accelerated_256 :: proc "contextless" () -> bool {…}

is_hardware_accelerated_256 returns true if and only if (⟺) hardware accelerated SHA-224/SHA-256 is supported.

is_hardware_accelerated_512 #

Source
is_hardware_accelerated_512 :: proc "contextless" () -> bool {…}

is_hardware_accelerated_512 returns true if and only if (⟺) hardware accelerated SHA-384, SHA-512, and SHA-512/256 are supported.

reset #

Source
reset :: proc(ctx: ^$T) {…}

reset sanitizes the Context. The Context must be re-initialized to be used again.

update #

Source
update :: proc(ctx: ^$T, data: []u8) {…}

update adds more data to the Context.