main
Last change
on this file since 65b6638 was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | var inherits = require('inherits')
|
---|
2 | var SHA512 = require('./sha512')
|
---|
3 | var Hash = require('./hash')
|
---|
4 | var Buffer = require('safe-buffer').Buffer
|
---|
5 |
|
---|
6 | var W = new Array(160)
|
---|
7 |
|
---|
8 | function Sha384 () {
|
---|
9 | this.init()
|
---|
10 | this._w = W
|
---|
11 |
|
---|
12 | Hash.call(this, 128, 112)
|
---|
13 | }
|
---|
14 |
|
---|
15 | inherits(Sha384, SHA512)
|
---|
16 |
|
---|
17 | Sha384.prototype.init = function () {
|
---|
18 | this._ah = 0xcbbb9d5d
|
---|
19 | this._bh = 0x629a292a
|
---|
20 | this._ch = 0x9159015a
|
---|
21 | this._dh = 0x152fecd8
|
---|
22 | this._eh = 0x67332667
|
---|
23 | this._fh = 0x8eb44a87
|
---|
24 | this._gh = 0xdb0c2e0d
|
---|
25 | this._hh = 0x47b5481d
|
---|
26 |
|
---|
27 | this._al = 0xc1059ed8
|
---|
28 | this._bl = 0x367cd507
|
---|
29 | this._cl = 0x3070dd17
|
---|
30 | this._dl = 0xf70e5939
|
---|
31 | this._el = 0xffc00b31
|
---|
32 | this._fl = 0x68581511
|
---|
33 | this._gl = 0x64f98fa7
|
---|
34 | this._hl = 0xbefa4fa4
|
---|
35 |
|
---|
36 | return this
|
---|
37 | }
|
---|
38 |
|
---|
39 | Sha384.prototype._hash = function () {
|
---|
40 | var H = Buffer.allocUnsafe(48)
|
---|
41 |
|
---|
42 | function writeInt64BE (h, l, offset) {
|
---|
43 | H.writeInt32BE(h, offset)
|
---|
44 | H.writeInt32BE(l, offset + 4)
|
---|
45 | }
|
---|
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 |
|
---|
54 | return H
|
---|
55 | }
|
---|
56 |
|
---|
57 | module.exports = Sha384
|
---|
Note:
See
TracBrowser
for help on using the repository browser.