Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

Commit

Permalink
Bring back convenience function hash.bytes()
Browse files Browse the repository at this point in the history
  • Loading branch information
twiss committed Jul 30, 2018
1 parent e37ffaf commit e293477
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/hash/sha1/sha1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@ export class Sha1 extends Hash<sha1result> {
protected static heap_pool = [];
protected static asm_pool = [];
protected static asm_function = sha1_asm;

static bytes(data: Uint8Array): Uint8Array {
return new Sha1().process(data).finish().result;
}
}
4 changes: 4 additions & 0 deletions src/hash/sha256/sha256.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@ export class Sha256 extends Hash<sha256result> {
protected static heap_pool = [];
protected static asm_pool = [];
protected static asm_function = sha256_asm;

static bytes(data: Uint8Array): Uint8Array {
return new Sha256().process(data).finish().result;
}
}
4 changes: 4 additions & 0 deletions src/hash/sha512/sha512.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@ export class Sha512 extends Hash<sha512result> {
protected static heap_pool = [];
protected static asm_pool = [];
protected static asm_function = sha512_asm;

static bytes(data: Uint8Array): Uint8Array {
return new Sha512().process(data).finish().result;
}
}

0 comments on commit e293477

Please sign in to comment.