0

how i can transpose this program to make the decryption

file name ekripsi.php <?php include_once("enc.lib.php"); $plaintext = block('5 TEKNIK DASAR KRIPTOGRAFI','6'); $a = ($plaintext); echo $a.'<br/>'; ?> file enc.lib.php <?php function block($msg,$m) { $x=array(); for($i=0;$i<strlen($msg);$i++) { $c = $i%$m; $x[$c] =(isset($x[$c])?$x[$c]:'').substr($msg,$i,1); } return join('',$x); } ?>

20th Oct 2018, 11:41 AM
aswin sianturi
aswin sianturi - avatar
7 Antworten
+ 1
it's called cryptography blocking method, the plaintext is divided into blocks consisting of several characters. this is one of the old cryptography techniques. i dont understand how to make program for decryption. i made to .php file , the lib and the encrypt
20th Oct 2018, 2:34 PM
aswin sianturi
aswin sianturi - avatar
+ 1
can you write in source code, because i dont really understand , thanks in advance, sorry
21st Oct 2018, 3:19 AM
aswin sianturi
aswin sianturi - avatar
+ 1
can i text you via Facebook, Instagram , whatsapp or others?
21st Oct 2018, 10:12 AM
aswin sianturi
aswin sianturi - avatar
0
can you explain your how the encryption works ? some part doesnt make sense to me
20th Oct 2018, 12:11 PM
Taste
Taste - avatar
0
sorry for late answer i got it, now it make sense to me its still rough but maybe you can try. first get the value of textlength%key lets call this leftover, next seperate the block by (textlength-leftover)/key lets call this blocklength. now get block. if the leftover is not 0 then substring the text from 0 to blocklength+1 then reduce left over by 1. then continue and store them in array as a block. now the block are seperated in array all you need to do is arrange them
20th Oct 2018, 3:42 PM
Taste
Taste - avatar
0
leftover=text.length%m blocklen=(text.length-leftover)/m block=[] k=0 while i < text.length j = blocklen if(leftover>0) j++ leftover-- if(j>text.length) j=text.length block[k++]= text.substring(i,j) i=j s="" for i = 0, i < block[0].length for j=0, j<block.size s+=block[j].charat(i)
21st Oct 2018, 5:28 AM
Taste
Taste - avatar
0
nice
21st Oct 2018, 4:08 PM
Giat Alexander S
Giat Alexander S - avatar