diff options
Diffstat (limited to 'src/crypto/primitives')
-rw-r--r-- | src/crypto/primitives/kdf.ts | 4 | ||||
-rw-r--r-- | src/crypto/primitives/sha256.ts | 10 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/crypto/primitives/kdf.ts b/src/crypto/primitives/kdf.ts index 03deb3727..edc681bc1 100644 --- a/src/crypto/primitives/kdf.ts +++ b/src/crypto/primitives/kdf.ts @@ -51,11 +51,11 @@ export function hmac( return digest(b2); } -export function hmacSha512(key: Uint8Array, message: Uint8Array) { +export function hmacSha512(key: Uint8Array, message: Uint8Array): Uint8Array { return hmac(sha512, 128, key, message); } -export function hmacSha256(key: Uint8Array, message: Uint8Array) { +export function hmacSha256(key: Uint8Array, message: Uint8Array): Uint8Array { return hmac(sha256, 64, key, message); } diff --git a/src/crypto/primitives/sha256.ts b/src/crypto/primitives/sha256.ts index ed88b5ffd..97723dbfc 100644 --- a/src/crypto/primitives/sha256.ts +++ b/src/crypto/primitives/sha256.ts @@ -215,7 +215,7 @@ export class HashSha256 { } // Cleans internal buffers and re-initializes hash state. - clean() { + clean(): void { for (let i = 0; i < this.buffer.length; i++) { this.buffer[i] = 0; } @@ -306,14 +306,14 @@ export class HashSha256 { } // Internal function for use in HMAC for optimization. - _saveState(out: Uint32Array) { + _saveState(out: Uint32Array): void { for (let i = 0; i < this.state.length; i++) { out[i] = this.state[i]; } } // Internal function for use in HMAC for optimization. - _restoreState(from: Uint32Array, bytesHashed: number) { + _restoreState(from: Uint32Array, bytesHashed: number): void { for (let i = 0; i < this.state.length; i++) { this.state[i] = from[i]; } @@ -376,7 +376,7 @@ export class HMAC { } // Cleans HMAC state. - clean() { + clean(): void { for (let i = 0; i < this.istate.length; i++) { this.ostate[i] = this.istate[i] = 0; } @@ -418,7 +418,7 @@ export function sha256(data: Uint8Array): Uint8Array { } // Returns HMAC-SHA256 of data under the key. -export function hmacSha256(key: Uint8Array, data: Uint8Array) { +export function hmacSha256(key: Uint8Array, data: Uint8Array): Uint8Array { const h = new HMAC(key).update(data); const digest = h.digest(); h.clean(); |