File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 11import Big from 'big.js' ;
2- import { createHash } from 'crypto' ;
2+ import { createHash , type BinaryToTextEncoding } from 'crypto' ;
33
44const baseEncodeTables = {
55 26 : 'abcdefghijklmnopqrstuvwxyz' ,
@@ -72,13 +72,13 @@ const getHashDigest = (
7272 digestType === 'base62' ||
7373 digestType === 'base64'
7474 ) {
75- return encodeBufferToBase ( hash . digest ( ) , parseInt ( digestType . substr ( 4 ) , 10 ) ) . substr (
75+ return encodeBufferToBase ( hash . digest ( ) , parseInt ( digestType . substring ( 4 ) , 10 ) ) . substring (
7676 0 ,
7777 maxLength
7878 ) ;
7979 }
80- const encoding = ( digestType as 'latin1' ) || 'hex' ;
81- return hash . digest ( encoding ) . substr ( 0 , maxLength ) ;
80+ const encoding = ( digestType as BinaryToTextEncoding ) || 'hex' ;
81+ return hash . digest ( encoding ) . substring ( 0 , maxLength ) ;
8282} ;
8383
8484export default getHashDigest ;
You can’t perform that action at this time.
0 commit comments