File tree Expand file tree Collapse file tree 3 files changed +5
-12
lines changed
static/lessons/cryptoBreaker Expand file tree Collapse file tree 3 files changed +5
-12
lines changed Original file line number Diff line number Diff line change @@ -79,9 +79,10 @@ let caesarEnc = (mes, key) => {
7979 return getRes ( mes , shifted ) ;
8080}
8181
82- let vigenereEnc = ( mes , key ) => {
82+ let vigenereEnc = ( m , key ) => {
8383 let keyArray = [ ] ;
8484 let keyLen = 3 ;
85+ let mes = "LOREM " + m ;
8586
8687 if ( util . isNullOrUndefined ( key ) ) {
8788 for ( let i = 0 ; i < keyLen ; i ++ ) {
Original file line number Diff line number Diff line change 1616 "name" :" Vigenère Cipher" ,
1717 "description" : " crypto_vigenere.md" ,
1818 "type" :" quiz" ,
19- "mission" :" Decrypt the cipher below. As before, the plain text is in Latin ." ,
19+ "mission" :" Decrypt the cipher below knowing that the first word is 'LOREM' ." ,
2020 "codeBlockIds" :[]
2121 },
2222 {
Original file line number Diff line number Diff line change @@ -21,22 +21,14 @@ describe("qna", () => {
2121 let text = "PLAIN TEXT" ;
2222 for ( let alg in qna . DEFS ) {
2323 if ( alg === "crypto_analysis" ) continue ;
24- let res = qna . getCode ( alg , text ) ;
24+ let res = qna . getCode ( alg , text ) ;
25+ if ( alg === "crypto_vigenere" ) text = "LOREM " + text ;
2526 let check = qna . checkCode ( text , res . digest ) ;
2627 assert ( check === true , `Validation failed for correct text using ${ alg } ` ) ;
2728 }
2829 } ) ;
2930
3031
31- test ( "vigenere should return plain text for 'AAA'" , ( ) => {
32- let text = "PLAIN TEXT" ;
33- let expected = "BYOUA HQKH"
34- let key = "MNO"
35- let res = qna . getCode ( "crypto_vigenere" , text , key ) ;
36- assert . strictEqual ( res . code , expected , "Did not result in the same cipher for key: 'MNO'" ) ;
37-
38- } ) ;
39-
4032 test ( "xorOp should return plain text for '0x0'" , ( ) => {
4133 let text = "PLAIN TEXT" ;
4234 let expected = "50 4C 41 49 4E 20 54 45 58 54" ;
You can’t perform that action at this time.
0 commit comments