std1.0.0-beta-7 SafeC docs

std :: crypto::sha256

Struct std::Sha256Ctx

#include <std/crypto/sha256.h> source

struct Sha256Ctx {
    unsigned int h[8];
    unsigned char buf[SHA256_BLOCK_SIZE];
    unsigned long total_bytes;
    int is224;
}

Fields

§unsigned int h[8]source

current hash state

§unsigned char buf[SHA256_BLOCK_SIZE]source

partial block buffer

§unsigned long total_bytessource

total bytes processed

§int is224source

1 = SHA-224 variant

Methods

§static struct Sha256Ctx new()source · definition

A fresh SHA-256 context.

§static struct Sha256Ctx new_224()source · definition

A fresh SHA-224 context (same struct, is224 = 1).

§void update([]const unsigned char data)source · definition

Feed len bytes of data into the hash.

§void finish([]unsigned char digest)source · definition

Finalise and write the digest. For SHA-256: digest must be at least 32 bytes. For SHA-224: digest must be at least 28 bytes.

§unsigned long digest_size() constsource · definition

32 (SHA-256) or 28 (SHA-224) / SHA256_BLOCK_SIZE (hash.h's BlockHash).

§unsigned long block_size() constsource · definition