<?php
$C1 = "1010110010011110011111101110011001101100111010001111011101101011101000110010011000000101001110111010010111100100111101001010000011000001010001001001010000000010101001000011100100010011011011011011010111010011000101010111111110010011010111001001010101110001111101010000001011110100000000010010111001111010110000001101010010110101100010011111111011101101001011111001101111101111000100100001000111101111011011001011110011000100011111100001000101111000011101110101110010010100010111101111110011011011001101110111011101100110010100010001100011001010100110001000111100011011001000010101100001110011000000001110001011101111010100101110101000100100010111011000001111001110000011111111111110010111111000011011001010010011100011100001011001101110110001011101011101111110100001111011011000110001011111111101110110101101101001011110110010111101000111011001111";
$l1 = strlen($C1);
$m1 = "THETHETHETHETHETHETHETHETHETHETHETHETHETHETHE";
$lm1 = strlen($m1);
$pad = str_pad($m1, $l1, " ", STR_PAD_RIGHT);
#
$CA1 = "";
$K1 = "";
for ($i=0; $i<$l1; $i=$i+7) {
$char7 = substr($C1, $i, 7);
$dec = bindec($char7);
$chr = chr($dec);
$CA1 .= $chr;
$mes1 = $pad[$i/7];
$k1 = $C1[$i/7];
$xor = ord($mes1)^ord($k1);
$chor = chr($xor);
$K1 .= $chor;
printf("%3d) %s + %s (%s)\n", $i, $chr, $mes1, $chor);
}
printf ("Mensaje:\n%s\n", $m1);
printf ("Cifrado:\n%s\n", $CA1);
printf ("Clave:\n%s\n", $K1);
/*
$c = "0";
$co = ord($c);
print "Claro: $c, $co\n";
$k = "k";
$ko = ord($k);
print "Clave: $k, $ko\n";
$s = $ko ^ $co;
$so = chr($s);
print "Secre: $s, $so\n";
# una linea mas de comentario
# 4
# 5
# 4
# una linea mas de comentario
*/
?>
# |
Change |
User |
Description |
Committed |
|
#1
|
8583 |
juvalen |
New proyect for breaking OTP |
|
|