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;
66
77var Sha1 = require ( '../' ) . sha1 ;
88
9+
10+ let nodeSupportsUint16 = false
11+ try {
12+ crypto . createHash ( 'sha1' ) . update ( new Uint16Array ( ) )
13+ nodeSupportsUint16 = true
14+ } catch ( err ) { }
15+
916var inputs = [
1017 [ '' , 'ascii' ] ,
1118 [ 'abc' , 'ascii' ] ,
@@ -16,7 +23,8 @@ var inputs = [
1623 [ '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcde' , 'ascii' ] ,
1724 [ '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef' , 'ascii' ] ,
1825 [ 'foobarbaz' , 'ascii' ] ,
19- typeof Uint16Array === 'function' ? [ new Uint16Array ( [ 1 , 2 , 3 ] ) ] : null
26+ [ Buffer . from ( 'buffer' ) ] ,
27+ nodeSupportsUint16 ? [ new Uint16Array ( [ 1 , 2 , 3 ] ) ] : null
2028] . filter ( Boolean ) ;
2129
2230tape ( "hash is the same as node's crypto" , function ( t ) {
You can’t perform that action at this time.
0 commit comments