package core:crypto/legacy/sha1

⌘K
Ctrl+K
or
/

    Overview

    package sha1 implements the SHA1 hash algorithm.

    WARNING: The SHA1 algorithm is known to be insecure and should only be used for interoperating with legacy applications.

    See: https://eprint.iacr.org/2017/190 https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf https://datatracker.ietf.org/doc/html/rfc3174

    Index

    Types (1)
    Constants (2)
    Variables (0)

    This section is empty.

    Procedures (5)
    Procedure Groups (0)

    This section is empty.

    Types

    Context ¶

    Context :: struct {
    	data:           [64]u8,
    	state:          [5]u32,
    	k:              [4]u32,
    	bitlen:         u64,
    	datalen:        u32,
    	is_initialized: bool,
    }
     

    Context is a SHA1 instance.

    Related Procedures With Parameters

    Constants

    BLOCK_SIZE ¶

    BLOCK_SIZE :: 64
     

    BLOCK_SIZE is the SHA1 block size in bytes.

    DIGEST_SIZE ¶

    DIGEST_SIZE :: 20
     

    DIGEST_SIZE is the SHA1 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: ^Context, 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 ¶

    init :: proc(ctx: ^Context) {…}
     

    init initializes a Context.

    reset ¶

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

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

    update ¶

    update :: proc(ctx: ^Context, 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-12 (vendor "odin") Windows_amd64 @ 2024-12-06 21:12:12.400304100 +0000 UTC