sha384.js 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. (function() {
  2. var nodeEnv = typeof require !== 'undefined' && typeof process !== 'undefined';
  3. var __module = nodeEnv ? module : {exports:{}};
  4. var __filename = 'preview-scripts/__node_modules/sha.js/sha384.js';
  5. var __require = nodeEnv ? function (request) {
  6. return cc.require(request);
  7. } : function (request) {
  8. return __quick_compile_project__.require(request, __filename);
  9. };
  10. function __define (exports, require, module) {
  11. if (!nodeEnv) {__quick_compile_project__.registerModule(__filename, module);}var inherits = require('inherits')
  12. var SHA512 = require('./sha512')
  13. var Hash = require('./hash')
  14. var Buffer = require('safe-buffer').Buffer
  15. var W = new Array(160)
  16. function Sha384 () {
  17. this.init()
  18. this._w = W
  19. Hash.call(this, 128, 112)
  20. }
  21. inherits(Sha384, SHA512)
  22. Sha384.prototype.init = function () {
  23. this._ah = 0xcbbb9d5d
  24. this._bh = 0x629a292a
  25. this._ch = 0x9159015a
  26. this._dh = 0x152fecd8
  27. this._eh = 0x67332667
  28. this._fh = 0x8eb44a87
  29. this._gh = 0xdb0c2e0d
  30. this._hh = 0x47b5481d
  31. this._al = 0xc1059ed8
  32. this._bl = 0x367cd507
  33. this._cl = 0x3070dd17
  34. this._dl = 0xf70e5939
  35. this._el = 0xffc00b31
  36. this._fl = 0x68581511
  37. this._gl = 0x64f98fa7
  38. this._hl = 0xbefa4fa4
  39. return this
  40. }
  41. Sha384.prototype._hash = function () {
  42. var H = Buffer.allocUnsafe(48)
  43. function writeInt64BE (h, l, offset) {
  44. H.writeInt32BE(h, offset)
  45. H.writeInt32BE(l, offset + 4)
  46. }
  47. writeInt64BE(this._ah, this._al, 0)
  48. writeInt64BE(this._bh, this._bl, 8)
  49. writeInt64BE(this._ch, this._cl, 16)
  50. writeInt64BE(this._dh, this._dl, 24)
  51. writeInt64BE(this._eh, this._el, 32)
  52. writeInt64BE(this._fh, this._fl, 40)
  53. return H
  54. }
  55. module.exports = Sha384
  56. }
  57. if (nodeEnv) {
  58. __define(__module.exports, __require, __module);
  59. }
  60. else {
  61. __quick_compile_project__.registerModuleFunc(__filename, function () {
  62. __define(__module.exports, __require, __module);
  63. });
  64. }
  65. })();