This repository was archived by the owner on Jul 4, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +2
-24
lines changed Expand file tree Collapse file tree 2 files changed +2
-24
lines changed Original file line number Diff line number Diff line change 1- const sha256 = require ( "js-sha256" ) ;
2- const sha512 = require ( "js-sha512" ) ;
3- const argon2 = require ( "argon2" ) ;
4-
5- async function hash_it ( str ) {
6- try {
7- const hash = await argon2 . hash ( str ) ;
8- const newHash = await hash . replace ( / [ ` ~ ! @ # $ % ^ & * ( ) _ | + \- = ? ; : ' " , . < > \] \\ ] / gi, "" ) ;
9- const ultraNewHash = await newHash . replace ( "argon" , " " ) ;
10- console . log ( ultraNewHash ) ;
11- } catch ( err ) {
12- console . log ( err ) ;
13- }
14- }
15-
161module . exports = ( req , res ) => {
172 const randomStr = Math . random ( )
183 . toString ( 36 )
194 . replace ( "." , "" ) ;
20- const moreRandomStr = sha256 ( randomStr ) ;
21- const ultraRandomStr = sha512 ( moreRandomStr ) . replace ( "." , " " ) ;
22- const test = hash_it ( ultraRandomStr ) ;
23- console . log ( test ) ;
5+ const moreRandomStr = Math . random ( randomStr ) . toString ( 36 ) ;
6+ const ultraRandomStr = Math . random ( moreRandomStr ) . toString ( 36 ) ;
247 res . send ( `${ ultraRandomStr } ` ) ;
258} ;
Original file line number Diff line number Diff line change 77 "test" : " node api/index.js" ,
88 "lint" : " eslint --fix ."
99 },
10- "dependencies" : {
11- "argon2" : " ^0.28.2" ,
12- "js-sha256" : " ^0.9.0" ,
13- "js-sha512" : " ^0.8.0"
14- },
1510 "devDependencies" : {
1611 "eslint" : " ^7.32.0" ,
1712 "vercel" : " ^23.1.2"
You can’t perform that action at this time.
0 commit comments