@@ -14,26 +14,21 @@ const encrypta = (st: string, salt: string, d = 1) => {
1414} ;
1515
1616export const encrypt = (
17- param : Object | string | number | any [ ] ,
18- salt : string ,
19- d = 1
17+ param : Object | string | number | any [ ] ,
18+ salt : string ,
19+ d = 1
2020) => {
21- const hashSalt : number = hashFun ( salt . trim ( ) . substring ( 0 , 20 ) ) ;
22- return JSON . stringify ( param )
23- . split ( '' )
24- . map ( ( c , i ) =>
25- String . fromCharCode ( c . charCodeAt ( 0 ) + configNum ( hashSalt , i ) * d )
26- )
27- . join ( '' )
28- . replace ( / \\ / g, 'blacard' )
29- . replace ( / \/ / g, 'danger' )
30- . replace ( / " / g, 'killer' )
31- . replace ( / ' / g, 'terror' )
32- . replace ( / / g, 'blankart' )
33- . replace ( / { / g, 'alpha' )
34- . replace ( / } / g, 'mega' )
35- . replace ( / ` / g, 'omega' ) ;
21+ return encrypta ( JSON . stringify ( param ) , salt , d )
22+ . replace ( / \\ / g, 'blacard' )
23+ . replace ( / \/ / g, 'danger' )
24+ . replace ( / " / g, 'killer' )
25+ . replace ( / ' / g, 'terror' )
26+ . replace ( / / g, 'blankart' )
27+ . replace ( / { / g, 'alpha' )
28+ . replace ( / } / g, 'mega' )
29+ . replace ( / ` / g, 'omega' ) ;
3630} ;
31+
3732export const decrypt = ( str : string , salt : string ) => {
3833 let encryption = encrypta (
3934 str
0 commit comments