UNPKG

crypto-es

Version:

A cryptography algorithms library compatible with ES6 and TypeScript

1 lines 1.79 kB
{"version":3,"file":"sha224.mjs","names":["SHA224: HashFn","HmacSHA224: HMACHashFn"],"sources":["../src/sha224.ts"],"sourcesContent":["import {\n WordArray,\n HashFn,\n HMACHashFn,\n} from './core';\nimport { SHA256Algo } from './sha256';\n\n/**\n * SHA-224 hash algorithm.\n */\nexport class SHA224Algo extends SHA256Algo {\n _doReset(): void {\n this._hash = new WordArray([\n 0xc1059ed8,\n 0x367cd507,\n 0x3070dd17,\n 0xf70e5939,\n 0xffc00b31,\n 0x68581511,\n 0x64f98fa7,\n 0xbefa4fa4,\n ]);\n }\n\n _doFinalize(): WordArray {\n const hash = super._doFinalize.call(this);\n\n hash.sigBytes -= 4;\n\n return hash;\n }\n\n clone(): this {\n const clone = super.clone.call(this);\n return clone;\n }\n}\n\n/**\n * Shortcut function to the hasher's object interface.\n *\n * @param message - The message to hash.\n * @returns The hash.\n *\n * @example\n * ```js\n * const hash = CryptoJS.SHA224('message');\n * const hash = CryptoJS.SHA224(wordArray);\n * ```\n */\nexport const SHA224: HashFn = SHA256Algo._createHelper(SHA224Algo);\n\n/**\n * Shortcut function to the HMAC's object interface.\n *\n * @param message - The message to hash.\n * @param key - The secret key.\n * @returns The HMAC.\n *\n * @example\n * ```js\n * const hmac = CryptoJS.HmacSHA224(message, key);\n * ```\n */\nexport const HmacSHA224: HMACHashFn = SHA256Algo._createHmacHelper(SHA224Algo);"],"mappings":";;;;;;;AAUA,IAAa,aAAb,cAAgC,WAAW;CACzC,WAAiB;AACf,OAAK,QAAQ,IAAI,UAAU;GACzB;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;CACF;CAED,cAAyB;EACvB,MAAM,OAAO,MAAM,YAAY,KAAK;AAEpC,OAAK,YAAY;AAEjB,SAAO;CACR;CAED,QAAc;EACZ,MAAM,QAAQ,MAAM,MAAM,KAAK;AAC/B,SAAO;CACR;AACF;;;;;;;;;;;;;AAcD,MAAaA,SAAiB,WAAW,cAAc;;;;;;;;;;;;;AAcvD,MAAaC,aAAyB,WAAW,kBAAkB"}