hashes 0.1.9

Rust implementation of cryptographic hash function algorithms
Documentation
mod algorithm;

use algorithm::define_hash_algorithm;

pub type Word = u32;
pub type MessageLen = u64;

pub const N_DIGEST_WORDS: usize = 5; // 256 bits
pub const N_CHUNK_BYTES: usize = 64; // 512 bits
pub const N_ROUNDS: usize = 80;

pub const INITIAL_DIGEST: [Word; N_DIGEST_WORDS] =
    [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];

define_hash_algorithm!();

crate::test_macros::define_hash_tests!(
    [
        [
            0xda, 0x39, 0xa3, 0xee, 0x5e, 0x6b, 0x4b, 0x0d, 0x32, 0x55, 0xbf, 0xef, 0x95, 0x60,
            0x18, 0x90, 0xaf, 0xd8, 0x07, 0x09
        ],
        [
            0xa9, 0x99, 0x3e, 0x36, 0x47, 0x06, 0x81, 0x6a, 0xba, 0x3e, 0x25, 0x71, 0x78, 0x50,
            0xc2, 0x6c, 0x9c, 0xd0, 0xd8, 0x9d
        ],
        [
            0x84, 0x98, 0x3e, 0x44, 0x1c, 0x3b, 0xd2, 0x6e, 0xba, 0xae, 0x4a, 0xa1, 0xf9, 0x51,
            0x29, 0xe5, 0xe5, 0x46, 0x70, 0xf1
        ],
        [
            0xa4, 0x9b, 0x24, 0x46, 0xa0, 0x2c, 0x64, 0x5b, 0xf4, 0x19, 0xf9, 0x95, 0xb6, 0x70,
            0x91, 0x25, 0x3a, 0x04, 0xa2, 0x59
        ],
        [
            0x34, 0xaa, 0x97, 0x3c, 0xd4, 0xc4, 0xda, 0xa4, 0xf6, 0x1e, 0xeb, 0x2b, 0xdb, 0xad,
            0x27, 0x31, 0x65, 0x34, 0x01, 0x6f
        ]
    ],
    [
        0x77, 0x89, 0xf0, 0xc9, 0xef, 0x7b, 0xfc, 0x40, 0xd9, 0x33, 0x11, 0x14, 0x3d, 0xfb, 0xe6,
        0x9e, 0x20, 0x17, 0xf5, 0x92
    ]
);