package core:crypto/sha2

⌘K
Ctrl+K
or
/

    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

    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_224 ¶

    DIGEST_SIZE_224 :: 28
     

    DIGEST_SIZE_224 is the SHA-224 digest size in bytes.

    DIGEST_SIZE_256 ¶

    DIGEST_SIZE_256 :: 32
     

    DIGEST_SIZE_256 is the SHA-256 digest size in bytes.

    DIGEST_SIZE_384 ¶

    DIGEST_SIZE_384 :: 48
     

    DIGEST_SIZE_384 is the SHA-384 digest size in bytes.

    DIGEST_SIZE_512 ¶

    DIGEST_SIZE_512 :: 64
     

    DIGEST_SIZE_512 is the SHA-512 digest 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

    clone ¶

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

    clone clones the Context other into ctx.

    final ¶

    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.

    Iff finalize_clone is set, final will work on a copy of the Context, which is useful for for calculating rolling digests.

    init_224 ¶

    init_224 :: proc(ctx: ^Context_256) {…}
     

    init_224 initializes a Context_256 for SHA-224.

    init_256 ¶

    init_256 :: proc(ctx: ^Context_256) {…}
     

    init_256 initializes a Context_256 for SHA-256.

    init_384 ¶

    init_384 :: proc(ctx: ^Context_512) {…}
     

    init_384 initializes a Context_512 for SHA-384.

    init_512 ¶

    init_512 :: proc(ctx: ^Context_512) {…}
     

    init_512 initializes a Context_512 for SHA-512.

    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.

    update ¶

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

    update adds more data to the Context.

    Procedure Groups

    This section is empty.

    Source Files

    Generation Information

    Generated with odin version dev-2024-04 (vendor "odin") Windows_amd64 @ 2024-04-18 21:08:56.515559000 +0000 UTC