package core:crypto/sha2
Overview
package sha2 implements the SHA2 hash algorithm family.
See: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf https://datatracker.ietf.org/doc/html/rfc3874
Index
Types (2)
Variables (0)
This section is empty.
Procedure Groups (0)
This section is empty.
Types
Context_256 ¶
Context_256 :: struct { block: [64]u8, h: [8]u32, bitlength: u64, length: u64, md_bits: int, is_initialized: bool, }
Context_256 is a SHA-224 or SHA-256 instance.
Related Procedures With Parameters
Context_512 ¶
Context_512 :: struct { block: [128]u8, h: [8]u64, bitlength: u64, length: u64, md_bits: int, is_initialized: bool, }
Context_512 is a SHA-384, SHA-512 or SHA-512/256 instance.
Related Procedures With Parameters
Constants
BLOCK_SIZE_256 ¶
BLOCK_SIZE_256 :: 64
BLOCK_SIZE_256 is the SHA-224 and SHA-256 block size in bytes.
BLOCK_SIZE_512 ¶
BLOCK_SIZE_512 :: 128
BLOCK_SIZE_512 is the SHA-384, SHA-512, and SHA-512/256 block size in bytes.
DIGEST_SIZE_512_256 ¶
DIGEST_SIZE_512_256 :: 32
DIGEST_SIZE_512_256 is the SHA-512/256 digest size in bytes.
Variables
This section is empty.
Procedures
final ¶
final finalizes the Context, writes the digest to hash, and calls reset on the Context.
Iff finalize_clone is set, final will work on a copy of the Context, which is useful for for calculating rolling digests.
init_512_256 ¶
init_512_256 :: proc(ctx: ^Context_512) {…}
init_512_256 initializes a Context_512 for SHA-512/256.
reset ¶
reset :: proc(ctx: ^$T) {…}
reset sanitizes the Context. The Context must be re-initialized to be used again.
Procedure Groups
This section is empty.
Source Files
Generation Information
Generated with odin version dev-2024-12 (vendor "odin") Windows_amd64 @ 2024-12-17 21:11:00.946376800 +0000 UTC