File tree 3 files changed +109
-0
lines changed 3 files changed +109
-0
lines changed Original file line number Diff line number Diff line change @@ -13,3 +13,5 @@ exports.sha224 = require('./sha224')
13
13
exports . sha256 = require ( './sha256' )
14
14
exports . sha384 = require ( './sha384' )
15
15
exports . sha512 = require ( './sha512' )
16
+ exports [ 'sha512-224' ] = require ( './sha512-224' )
17
+ exports [ 'sha512-256' ] = require ( './sha512-256' )
Original file line number Diff line number Diff line change
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 Sha512h256 ( ) {
9
+ this . init ( )
10
+ this . _w = W
11
+
12
+ Hash . call ( this , 128 , 112 )
13
+ }
14
+
15
+ inherits ( Sha512h256 , Sha512 )
16
+
17
+ Sha512h256 . prototype . init = function ( ) {
18
+ this . _ah = 0x8c3d37c8
19
+ this . _bh = 0x73e19966
20
+ this . _ch = 0x1dfab7ae
21
+ this . _dh = 0x679dd514
22
+ this . _eh = 0x0f6d2b69
23
+ this . _fh = 0x77e36f73
24
+ this . _gh = 0x3f9d85a8
25
+ this . _hh = 0x1112e6ad
26
+
27
+ this . _al = 0x19544da2
28
+ this . _bl = 0x89dcd4d6
29
+ this . _cl = 0x32ff9c82
30
+ this . _dl = 0x582f9fcf
31
+ this . _el = 0x7bd44da8
32
+ this . _fl = 0x04c48942
33
+ this . _gl = 0x6a1d36c8
34
+ this . _hl = 0x91d692a1
35
+
36
+ return this
37
+ }
38
+
39
+ Sha512h256 . prototype . _hash = function ( ) {
40
+ var H = Buffer . allocUnsafe ( 28 )
41
+
42
+ H . writeInt32BE ( this . _ah , 0 )
43
+ H . writeInt32BE ( this . _al , 4 )
44
+ H . writeInt32BE ( this . _bh , 8 )
45
+ H . writeInt32BE ( this . _bl , 12 )
46
+ H . writeInt32BE ( this . _ch , 16 )
47
+ H . writeInt32BE ( this . _cl , 20 )
48
+ H . writeInt32BE ( this . _dh , 24 )
49
+
50
+ return H
51
+ }
52
+
53
+ module . exports = Sha512h256
Original file line number Diff line number Diff line change
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 Sha512h256 ( ) {
9
+ this . init ( )
10
+ this . _w = W
11
+
12
+ Hash . call ( this , 128 , 112 )
13
+ }
14
+
15
+ inherits ( Sha512h256 , Sha512 )
16
+
17
+ Sha512h256 . prototype . init = function ( ) {
18
+ this . _ah = 0x22312194
19
+ this . _bh = 0x9f555fa3
20
+ this . _ch = 0x2393b86b
21
+ this . _dh = 0x96387719
22
+ this . _eh = 0x96283ee2
23
+ this . _fh = 0xbe5e1e25
24
+ this . _gh = 0x2b0199fc
25
+ this . _hh = 0x0eb72ddc
26
+
27
+ this . _al = 0xfc2bf72c
28
+ this . _bl = 0xc84c64c2
29
+ this . _cl = 0x6f53b151
30
+ this . _dl = 0x5940eabd
31
+ this . _el = 0xa88effe3
32
+ this . _fl = 0x53863992
33
+ this . _gl = 0x2c85b8aa
34
+ this . _hl = 0x81c52ca2
35
+
36
+ return this
37
+ }
38
+
39
+ Sha512h256 . prototype . _hash = function ( ) {
40
+ var H = Buffer . allocUnsafe ( 32 )
41
+
42
+ H . writeInt32BE ( this . _ah , 0 )
43
+ H . writeInt32BE ( this . _al , 4 )
44
+ H . writeInt32BE ( this . _bh , 8 )
45
+ H . writeInt32BE ( this . _bl , 12 )
46
+ H . writeInt32BE ( this . _ch , 16 )
47
+ H . writeInt32BE ( this . _cl , 20 )
48
+ H . writeInt32BE ( this . _dh , 24 )
49
+ H . writeInt32BE ( this . _dl , 28 )
50
+
51
+ return H
52
+ }
53
+
54
+ module . exports = Sha512h256
You can’t perform that action at this time.
0 commit comments