You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
956 B
TypeScript
60 lines
956 B
TypeScript
type Message = string | number[] | ArrayBuffer | Uint8Array;
|
|
|
|
interface Hasher {
|
|
/**
|
|
* Update hash
|
|
*
|
|
* @param message The message you want to hash.
|
|
*/
|
|
update(message: Message): Hasher;
|
|
|
|
/**
|
|
* Return hash in hex string.
|
|
*/
|
|
hex(): string;
|
|
|
|
/**
|
|
* Return hash in hex string.
|
|
*/
|
|
toString(): string;
|
|
|
|
/**
|
|
* Return hash in ArrayBuffer.
|
|
*/
|
|
arrayBuffer(): ArrayBuffer;
|
|
|
|
/**
|
|
* Return hash in integer array.
|
|
*/
|
|
digest(): number[];
|
|
|
|
/**
|
|
* Return hash in integer array.
|
|
*/
|
|
array(): number[];
|
|
}
|
|
|
|
interface Hash {
|
|
/**
|
|
* Hash and return hex string.
|
|
*
|
|
* @param message The message you want to hash.
|
|
*/
|
|
(message: Message): string;
|
|
|
|
/**
|
|
* Create a hash object.
|
|
*/
|
|
create(): Hasher;
|
|
|
|
/**
|
|
* Create a hash object and hash message.
|
|
*
|
|
* @param message The message you want to hash.
|
|
*/
|
|
update(message: Message): Hasher;
|
|
}
|
|
|
|
export var sha256: Hash;
|
|
export var sha224: Hash;
|