Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

sha384.js 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. var inherits = require('inherits')
  2. var SHA512 = require('./sha512')
  3. var Hash = require('./hash')
  4. var Buffer = require('safe-buffer').Buffer
  5. var W = new Array(160)
  6. function Sha384 () {
  7. this.init()
  8. this._w = W
  9. Hash.call(this, 128, 112)
  10. }
  11. inherits(Sha384, SHA512)
  12. Sha384.prototype.init = function () {
  13. this._ah = 0xcbbb9d5d
  14. this._bh = 0x629a292a
  15. this._ch = 0x9159015a
  16. this._dh = 0x152fecd8
  17. this._eh = 0x67332667
  18. this._fh = 0x8eb44a87
  19. this._gh = 0xdb0c2e0d
  20. this._hh = 0x47b5481d
  21. this._al = 0xc1059ed8
  22. this._bl = 0x367cd507
  23. this._cl = 0x3070dd17
  24. this._dl = 0xf70e5939
  25. this._el = 0xffc00b31
  26. this._fl = 0x68581511
  27. this._gl = 0x64f98fa7
  28. this._hl = 0xbefa4fa4
  29. return this
  30. }
  31. Sha384.prototype._hash = function () {
  32. var H = Buffer.allocUnsafe(48)
  33. function writeInt64BE (h, l, offset) {
  34. H.writeInt32BE(h, offset)
  35. H.writeInt32BE(l, offset + 4)
  36. }
  37. writeInt64BE(this._ah, this._al, 0)
  38. writeInt64BE(this._bh, this._bl, 8)
  39. writeInt64BE(this._ch, this._cl, 16)
  40. writeInt64BE(this._dh, this._dl, 24)
  41. writeInt64BE(this._eh, this._el, 32)
  42. writeInt64BE(this._fh, this._fl, 40)
  43. return H
  44. }
  45. module.exports = Sha384