fn sha1(inp: &[u8]) -> Result<[u32; 5], HashError> {
    if inp.len() >= 2 << 61 {
        return Err(HashError::DataTooLarge);
    }

    // Initial hash values to be used.
    let mut hash: [Wrapping<u32>; 5] = [
        Wrapping(0x67452301),
        Wrapping(0xefcdab89),
        Wrapping(0x98badcfe),
        Wrapping(0x10325476),
        Wrapping(0xc3d2e1f0),
    ];

    let blocks = pad_data(inp);

    for i in 0..blocks.len() {
        block(&mut hash, &blocks[i]);
    }

    Ok([
       hash[0].0,
       hash[1].0,
       hash[2].0,
       hash[3].0,
       hash[4].0,
    ])
}
// SHA1 function takes in a u8 slice that is
// less than 2^64 bits in length and returns
// a 160 bit hash composed of u32 bit parts
SHA1 function takes in a u8 slice that is
less than 2^64 bits in length and returns
a 160 bit hash composed of u32 bit parts
SHA1 function takes in a u8 slice that is less than 2^64 bits in length and returns a 160 bit hash composed of u32 bit parts
fn sha1(inp: &[u8]) -> Result<[u32; 5], HashError> {
    if inp.len() >= 2 << 61 {
        return Err(HashError::DataTooLarge);
    }
    // Initial hash values to be used.
    let mut hash: [Wrapping<u32>; 5] = [
        Wrapping(0x67452301),
        Wrapping(0xefcdab89),
        Wrapping(0x98badcfe),
        Wrapping(0x10325476),
        Wrapping(0xc3d2e1f0),
    ];
    let blocks = pad_data(inp);
    for i in 0..blocks.len() {
        block(&mut hash, &blocks[i]);
    }
    Ok([
       hash[0].0,
       hash[1].0,
       hash[2].0,
       hash[3].0,
       hash[4].0,
    ])
}
fn sha1 ( inp : & [ u8 ] ) -> Result < [ u32 ; 5 ] , HashError > { if inp . len ( ) >= 2 << 61 { return Err ( HashError :: DataTooLarge ) ; } // Initial hash values to be used. let mut hash : [ Wrapping < u32 > ; 5 ] = [ Wrapping ( 0x67452301 ) , Wrapping ( 0xefcdab89 ) , Wrapping ( 0x98badcfe ) , Wrapping ( 0x10325476 ) , Wrapping ( 0xc3d2e1f0 ) , ] ; let blocks = pad_data ( inp ) ; for i in 0 .. blocks . len ( ) { block ( & mut hash , & blocks [ i ] ) ; } Ok ( [ hash [ 0 ] . 0 , hash [ 1 ] . 0 , hash [ 2 ] . 0 , hash [ 3 ] . 0 , hash [ 4 ] . 0 , ] ) }
SHA1 function takes in a u8 slice that is
less than 2^64 bits in length and returns
a 160 bit hash composed of u32 bit parts
SHA1 function takes in a u8 slice that is less than 2^64 bits in length and returns a 160 bit hash composed of u32 bit parts
inp
&[u8]
inp
&[u8]