Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80538 views
1
var inherits = require('inherits')
2
var SHA512 = require('./sha512');
3
var Hash = require('./hash')
4
5
var W = new Array(160)
6
7
function Sha384() {
8
this.init()
9
this._w = W
10
11
Hash.call(this, 128, 112)
12
}
13
14
inherits(Sha384, SHA512)
15
16
Sha384.prototype.init = function () {
17
this._a = 0xcbbb9d5d|0
18
this._b = 0x629a292a|0
19
this._c = 0x9159015a|0
20
this._d = 0x152fecd8|0
21
this._e = 0x67332667|0
22
this._f = 0x8eb44a87|0
23
this._g = 0xdb0c2e0d|0
24
this._h = 0x47b5481d|0
25
26
this._al = 0xc1059ed8|0
27
this._bl = 0x367cd507|0
28
this._cl = 0x3070dd17|0
29
this._dl = 0xf70e5939|0
30
this._el = 0xffc00b31|0
31
this._fl = 0x68581511|0
32
this._gl = 0x64f98fa7|0
33
this._hl = 0xbefa4fa4|0
34
35
return this
36
}
37
38
Sha384.prototype._hash = function () {
39
var H = new Buffer(48)
40
41
function writeInt64BE(h, l, offset) {
42
H.writeInt32BE(h, offset)
43
H.writeInt32BE(l, offset + 4)
44
}
45
46
writeInt64BE(this._a, this._al, 0)
47
writeInt64BE(this._b, this._bl, 8)
48
writeInt64BE(this._c, this._cl, 16)
49
writeInt64BE(this._d, this._dl, 24)
50
writeInt64BE(this._e, this._el, 32)
51
writeInt64BE(this._f, this._fl, 40)
52
53
return H
54
}
55
56
module.exports = Sha384
57
58