core/crypto/hash

crypto_hash

Types

2

Algorithm

Algorithm :: enum int { Invalid = 0, BLAKE2B = 1, BLAKE2S = 2, SHA224 = 3, SHA256 = 4, SHA384 = 5, SHA512 = 6, SHA512_256 = 7, SHA3_224 = 8, SHA3_256 = 9, SHA3_384 = 10, SHA3_512 = 11, SM3 = 12, Legacy_KECCAK_224 = 13, Legacy_KECCAK_256 = 14, Legacy_KECCAK_384 = 15, Legacy_KECCAK_512 = 16, Insecure_MD5 = 17, Insecure_SHA1 = 18, }Source

Algorithm is the algorithm identifier associated with a given Context.

Constants

2

Variables

3

ALGORITHM_NAMES

ALGORITHM_NAMES :: [19]string = [Algorithm]string { .Invalid = "Invalid", .BLAKE2B = "BLAKE2b", .BLAKE2S = "BLAKE2s", .SHA224 = "SHA-224", .SHA256 = "SHA-256", .SHA384 = "SHA-384", .SHA512 = "SHA-512", .SHASource

ALGORITHM_NAMES is the Algorithm to algorithm name string.

Procedures

15

final

final :: proc(ctx: ^Context, hash: []u8, finalize_clone: bool)Source

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.

hash_bytes

hash_bytes :: proc(algorithm: Algorithm, data: []u8, allocator: mem.Allocator = context.allocator) -> ([]u8)Source

hash_bytes will hash the given input and return the computed digest in a newly allocated slice.

hash_bytes_to_buffer

hash_bytes_to_buffer :: proc(algorithm: Algorithm, data: []u8, hash: []u8) -> ([]u8)Source

hash_bytes_to_buffer will hash the given input and write the computed digest into the third parameter. It requires that the destination buffer is at least as big as the digest size. The provided destination buffer is returned to match the behavior of hash_bytes.

hash_stream

hash_stream :: proc(algorithm: Algorithm, s: io.Stream, allocator: mem.Allocator = context.allocator) -> ([]u8, io.Error)Source

hash_stream will incrementally fully consume a stream, and return the computed digest in a newly allocated slice.

reset

reset :: proc(ctx: ^Context)Source

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

Procedure Groups

2

Reference search

Find anything

Documentation preferences

Settings

System theme variants

Used only while Theme is set to System.