- support for web worker.
- typescript types. #10

Changed
- prevent webpack to require dependencies.
This commit is contained in:
Yi-Cyuan Chen
2017-11-19 15:15:13 +08:00
parent cf975dfa0c
commit 4e5354859f
13 changed files with 352 additions and 118 deletions
Vendored
+59
View File
@@ -0,0 +1,59 @@
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;