拓恒河湖长制全民护河平台WEB端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
2.2KB

  1. ;(function (root, factory, undef) {
  2. if (typeof exports === "object") {
  3. // CommonJS
  4. module.exports = exports = factory(require("./core"), require("./x64-core"), require("./sha512"));
  5. }
  6. else if (typeof define === "function" && define.amd) {
  7. // AMD
  8. define(["./core", "./x64-core", "./sha512"], factory);
  9. }
  10. else {
  11. // Global (browser)
  12. factory(root.CryptoJS);
  13. }
  14. }(this, function (CryptoJS) {
  15. (function () {
  16. // Shortcuts
  17. var C = CryptoJS;
  18. var C_x64 = C.x64;
  19. var X64Word = C_x64.Word;
  20. var X64WordArray = C_x64.WordArray;
  21. var C_algo = C.algo;
  22. var SHA512 = C_algo.SHA512;
  23. /**
  24. * SHA-384 hash algorithm.
  25. */
  26. var SHA384 = C_algo.SHA384 = SHA512.extend({
  27. _doReset: function () {
  28. this._hash = new X64WordArray.init([
  29. new X64Word.init(0xcbbb9d5d, 0xc1059ed8), new X64Word.init(0x629a292a, 0x367cd507),
  30. new X64Word.init(0x9159015a, 0x3070dd17), new X64Word.init(0x152fecd8, 0xf70e5939),
  31. new X64Word.init(0x67332667, 0xffc00b31), new X64Word.init(0x8eb44a87, 0x68581511),
  32. new X64Word.init(0xdb0c2e0d, 0x64f98fa7), new X64Word.init(0x47b5481d, 0xbefa4fa4)
  33. ]);
  34. },
  35. _doFinalize: function () {
  36. var hash = SHA512._doFinalize.call(this);
  37. hash.sigBytes -= 16;
  38. return hash;
  39. }
  40. });
  41. /**
  42. * Shortcut function to the hasher's object interface.
  43. *
  44. * @param {WordArray|string} message The message to hash.
  45. *
  46. * @return {WordArray} The hash.
  47. *
  48. * @static
  49. *
  50. * @example
  51. *
  52. * var hash = CryptoJS.SHA384('message');
  53. * var hash = CryptoJS.SHA384(wordArray);
  54. */
  55. C.SHA384 = SHA512._createHelper(SHA384);
  56. /**
  57. * Shortcut function to the HMAC's object interface.
  58. *
  59. * @param {WordArray|string} message The message to hash.
  60. * @param {WordArray|string} key The secret key.
  61. *
  62. * @return {WordArray} The HMAC.
  63. *
  64. * @static
  65. *
  66. * @example
  67. *
  68. * var hmac = CryptoJS.HmacSHA384(message, key);
  69. */
  70. C.HmacSHA384 = SHA512._createHmacHelper(SHA384);
  71. }());
  72. return CryptoJS.SHA384;
  73. }));