File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,13 @@ var Buffer = require('safe-buffer').Buffer;
6
6
7
7
var Sha1 = require ( '../' ) . sha1 ;
8
8
9
+
10
+ let nodeSupportsUint16 = false
11
+ try {
12
+ crypto . createHash ( 'sha1' ) . update ( new Uint16Array ( ) )
13
+ nodeSupportsUint16 = true
14
+ } catch ( err ) { }
15
+
9
16
var inputs = [
10
17
[ '' , 'ascii' ] ,
11
18
[ 'abc' , 'ascii' ] ,
@@ -16,7 +23,8 @@ var inputs = [
16
23
[ '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcde' , 'ascii' ] ,
17
24
[ '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef' , 'ascii' ] ,
18
25
[ 'foobarbaz' , 'ascii' ] ,
19
- typeof Uint16Array === 'function' ? [ new Uint16Array ( [ 1 , 2 , 3 ] ) ] : null
26
+ [ Buffer . from ( 'buffer' ) ] ,
27
+ nodeSupportsUint16 ? [ new Uint16Array ( [ 1 , 2 , 3 ] ) ] : null
20
28
] . filter ( Boolean ) ;
21
29
22
30
tape ( "hash is the same as node's crypto" , function ( t ) {
You can’t perform that action at this time.
0 commit comments