Sha256: edfccd40fad9502c3b2439ff9baef862687eff54b454af156ba5050f495b036d

Contents?: true

Size: 1.07 KB

Versions: 35

Compression:

Stored size: 1.07 KB

Contents

/**
 * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined
 * in FIPS 180-2
 * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009.
 * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
 *
 */

var inherits = require('inherits')
var Sha256 = require('./sha256')
var Hash = require('./hash')
var Buffer = require('safe-buffer').Buffer

var W = new Array(64)

function Sha224 () {
  this.init()

  this._w = W // new Array(64)

  Hash.call(this, 64, 56)
}

inherits(Sha224, Sha256)

Sha224.prototype.init = function () {
  this._a = 0xc1059ed8
  this._b = 0x367cd507
  this._c = 0x3070dd17
  this._d = 0xf70e5939
  this._e = 0xffc00b31
  this._f = 0x68581511
  this._g = 0x64f98fa7
  this._h = 0xbefa4fa4

  return this
}

Sha224.prototype._hash = function () {
  var H = Buffer.allocUnsafe(28)

  H.writeInt32BE(this._a, 0)
  H.writeInt32BE(this._b, 4)
  H.writeInt32BE(this._c, 8)
  H.writeInt32BE(this._d, 12)
  H.writeInt32BE(this._e, 16)
  H.writeInt32BE(this._f, 20)
  H.writeInt32BE(this._g, 24)

  return H
}

module.exports = Sha224

Version data entries

35 entries across 34 versions & 12 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/sha.js/sha224.js
disco_app-0.18.0 test/dummy/node_modules/sha.js/sha224.js
disco_app-0.18.2 test/dummy/node_modules/sha.js/sha224.js
disco_app-0.16.1 test/dummy/node_modules/sha.js/sha224.js
disco_app-0.15.2 test/dummy/node_modules/sha.js/sha224.js
disco_app-0.18.4 test/dummy/node_modules/sha.js/sha224.js
disco_app-0.18.1 test/dummy/node_modules/sha.js/sha224.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/sha.js/sha224.js
disco_app-0.14.0 test/dummy/node_modules/sha.js/sha224.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/sha.js/sha224.js
tang-0.2.1 spec/tang_app/node_modules/sha.js/sha224.js
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/sha.js/sha224.js
groonga-client-model-6.0.0 test/apps/rails6.0.3.5/node_modules/sha.js/sha224.js
ruby2js-4.0.4 lib/tasks/testrails/node_modules/sha.js/sha224.js
ruby2js-4.0.3 lib/tasks/testrails/node_modules/sha.js/sha224.js
tang-0.2.0 spec/tang_app/node_modules/sha.js/sha224.js
tang-0.1.0 spec/tang_app/node_modules/sha.js/sha224.js
tang-0.0.9 spec/tang_app/node_modules/sha.js/sha224.js
enju_library-0.3.8 spec/dummy/node_modules/sha.js/sha224.js
ilog-0.4.1 node_modules/sha.js/sha224.js