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); } ?>
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
+ 1
can you write in source code, because i dont really understand , thanks in advance, sorry
+ 1
can i text you via Facebook, Instagram , whatsapp or others?
0
can you explain your how the encryption works ? some part doesnt make sense to me
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
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)
0
nice