File tree Expand file tree Collapse file tree 4 files changed +25
-22
lines changed
Expand file tree Collapse file tree 4 files changed +25
-22
lines changed Original file line number Diff line number Diff line change 1- import xxhash from "xxhash-wasm" ;
1+ import { hashPrefix } from './hash.js' ;
2+
3+ document . addEventListener ( "keyup" , ( { key} ) => {
4+ if ( key === 'Enter' ) {
5+ submitPassword ( )
6+ }
7+ } )
8+ document . getElementById ( 'submittedPasswordButton' ) . addEventListener ( 'click' , ( e ) => {
9+ submitPassword ( ) ;
10+ } )
211
312function submitPassword ( ) {
4- let password = document . getElementById ( " submittedPassword" ) . value ;
13+ let password = document . getElementById ( ' submittedPassword' ) . value ;
514 hashPrefix ( password ) . then ( prefix => alert ( prefix ) ) ;
6- }
7-
8- async function hashPrefix ( password ) {
9- const { h32, h64 } = await xxhash ( ) ;
10- let digest = h32 ( password ) ;
11- let hexadecimal_digest = digest . toString ( 16 )
12- return hexadecimal_digest . substring ( 0 , 5 )
13- }
14-
15- export { hashPrefix } ;
15+ }
Original file line number Diff line number Diff line change 1+ import xxhash from "xxhash-wasm" ;
2+
3+ async function hashPrefix ( password ) {
4+ const { h32, h64 } = await xxhash ( ) ;
5+ let digest = h32 ( password ) ;
6+ let hexadecimal_digest = digest . toString ( 16 )
7+ return hexadecimal_digest . substring ( 0 , 5 )
8+ }
9+
10+ export { hashPrefix } ;
Original file line number Diff line number Diff line change 1717 < h2 > Test de la fuite de mot de passe</ h2 >
1818 < p > Cette page permet de tester si votre mot de passe est présent dans la base < a
1919 href ="https://en.wikipedia.org/wiki/RockYou#Data_breach " target ="_blank "> RockYou</ a > .</ p >
20- < input id =submittedPassword/ >
21- < input type =" button " onclick =" submitPassword() " value ="Tester ">
20+ < input id =" submittedPassword " />
21+ < input id =" submittedPasswordButton " type =" button " value ="Tester ">
2222 < p > Le mot de passe n'est pas envoyé au serveur, uniquement les premiers caractères de son hash.</ p >
2323</ div >
2424
25- < script >
26- document . addEventListener ( "keyup" , ( { key} ) => {
27- if ( key === "Enter" ) {
28- submitPassword ( )
29- }
30- } )
31- </ script >
3225</ body >
3326</ html >
Original file line number Diff line number Diff line change 1- import { hashPrefix } from "../static/check_password_leak .js" ;
1+ import { hashPrefix } from "../static/hash .js" ;
22
33test ( 'hash prefix is identical to Python version' , async ( ) => {
44 let prefix = await hashPrefix ( "rockyou" ) ;
You can’t perform that action at this time.
0 commit comments