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.

Interface sha1

The SHA-1 interface

Method input

fn input(~[u8])

Provide message input as bytes

Method input_str

fn input_str(str)

Provide message input as string

Method result

fn result() -> ~[u8]

Read the digest as a vector of 20 bytes. After calling this no further input may be provided until reset is called.

Method result_str

fn result_str() -> str

Read the digest as a hex string. After calling this no further input may be provided until reset is called.

Method reset

fn reset()

Reset the SHA-1 state for reuse

Function sha1

fn sha1() -> sha1

Construct a sha object