An implementation of the SHA-1 cryptographic hash.

First create a sha1 object using the sha1 constructor, then feed it input using the input or input_str methods, which may be called any number of times.

After the entire input has been fed to the hash read the result using the result or result_str methods.

The sha1 object may be reused to create multiple hashes by calling the reset method.

Struct Sha1

pub struct Sha1 {
    priv h: [u32, ..DIGEST_BUF_LEN],
    priv len_low: u32,
    priv len_high: u32,
    priv msg_block: [u8, ..MSG_BLOCK_LEN],
    priv msg_block_idx: uint,
    priv computed: bool,
    priv work_buf: [u32, ..WORK_BUF_LEN],
}

Structure representing the state of a Sha1 computation

Implementation for Sha1

Method new

fn new() -> Sha1

Construct a sha object

Implementation of Digest for Sha1

Method reset

fn reset(&mut self)

Method input

fn input(&mut self, msg: &[u8])

Method result

fn result(&mut self, out: &mut [u8])

Method output_bits

fn output_bits(&self) -> uint