diff options
Diffstat (limited to 'std/hash/sha512.ts')
-rw-r--r-- | std/hash/sha512.ts | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/std/hash/sha512.ts b/std/hash/sha512.ts index b55069f4d..1eef85a47 100644 --- a/std/hash/sha512.ts +++ b/std/hash/sha512.ts @@ -9,11 +9,11 @@ export type Message = string | number[] | ArrayBuffer; -// prettier-ignore +// deno-fmt-ignore const HEX_CHARS = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"] as const; const EXTRA = [-2147483648, 8388608, 32768, 128] as const; const SHIFT = [24, 16, 8, 0] as const; -// prettier-ignore +// deno-fmt-ignore const K = [ 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd, 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc, 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019, 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118, 0xd807aa98, 0xa3030242, @@ -37,7 +37,7 @@ const K = [ const blocks: number[] = []; -// prettier-ignore +// deno-fmt-ignore export class Sha512 { #blocks!: number[]; #block!: number; @@ -564,7 +564,7 @@ export class Sha512 { h0h = this.#h0h, h0l = this.#h0l, h1h = this.#h1h, h1l = this.#h1l, h2h = this.#h2h, h2l = this.#h2l, h3h = this.#h3h, h3l = this.#h3l, h4h = this.#h4h, h4l = this.#h4l, h5h = this.#h5h, h5l = this.#h5l, h6h = this.#h6h, h6l = this.#h6l, h7h = this.#h7h, h7l = this.#h7l, bits = this.#bits; - let hex = + let hex = HEX_CHARS[(h0h >> 28) & 0x0f] + HEX_CHARS[(h0h >> 24) & 0x0f] + HEX_CHARS[(h0h >> 20) & 0x0f] + HEX_CHARS[(h0h >> 16) & 0x0f] + HEX_CHARS[(h0h >> 12) & 0x0f] + HEX_CHARS[(h0h >> 8) & 0x0f] + @@ -747,8 +747,7 @@ export class HmacSha512 extends Sha512 { bytes[index++] = 0x80 | ((code >> 6) & 0x3f); bytes[index++] = 0x80 | (code & 0x3f); } else { - code = - 0x10000 + + code = 0x10000 + (((code & 0x3ff) << 10) | (secretKey.charCodeAt(++i) & 0x3ff)); bytes[index++] = 0xf0 | (code >> 18); bytes[index++] = 0x80 | ((code >> 12) & 0x3f); |