IFF Encoding

Questions about programming languages and debugging
Post Reply
User avatar
Gogeta70
^_^
^_^
Posts: 3275
Joined: 25 Jun 2005, 16:00
18

IFF Encoding

Post by Gogeta70 »

For all of you folks out there that would like practically unbreakable encryption/encoding, i bring you the IFF code.

The variables in this script: $s1, $s2, and $s3 will need to be changed by you. More specifically, you'll need to change the contents between the str_split(" and ");. These characters are the ones allowed to be encoded, so pick ones that work for you. Also, they each MUST be in a different order, or it defeats the purpose of the code itself. They also must be the same length. Enjoy.

Code: Select all

<?PHP

$sequence = str_split(312);
$s1 = str_split("abcdefghijklmnopqrstuvwxyz1234567890!@#$%^&*()_+{}:\"<>?-=[];',./\| ");
$s2 = str_split("qazwsxedcrfvtgbyhnujmikolp,./;'[]\=-)(*&^%$# @!?><\":|}{+_0123456789");
$s3 = str_split("poiuytrewqasdfghjklmnbvcxz/']\.;[,=-)(*&^!@#$%<>:{?\"}| _+1324576809");
$string = str_split(strtolower($_GET['s']));
$b = 0;
$encrypted = NULL;

for($a = 0; $a < count($string); $a++)
{
if($b > 2)
  $b = 0;

if($b == 0)
{
$key = array_search($string[$a], $s3);
if($key === FALSE)
  die("Invalid characters in string.");
$encrypted .= "$key:";
}

if($b == 1)
{
$key = array_search($string[$a], $s1);
if($key === FALSE)
  die("Invalid characters in string.");
$encrypted .= "$key:";
}

if($b == 2)
{
$key = array_search($string[$a], $s2);
if($key === FALSE)
  die("Invalid characters in string.");
$encrypted .= "$key:";
}

$b++;
}

$len = strlen($encrypted)-1;
$encrypted = substr($encrypted, 0, $len);

echo $encrypted;

?>
¯\_(ツ)_/¯ It works on my machine...

G-Brain
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 467
Joined: 08 Nov 2007, 17:00
16
Location: NL

Post by G-Brain »

Actually, that's very breakable. I'll post some code soon :)

G-Brain
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 467
Joined: 08 Nov 2007, 17:00
16
Location: NL

Post by G-Brain »

Code: Select all

function iffdecode($encoded)                                                                                                                                                                                        
{                                                                                                                                                                                                                   
    $s1 = str_split("abcdefghijklmnopqrstuvwxyz1234567890!@#$%^&*()_+{}:\"<>?-=[];',./\| ");                                                                                                                        
    $s2 = str_split("qazwsxedcrfvtgbyhnujmikolp,./;'[]\=-)(*&^%$# @!?><\":|}{+_0123456789");                                                                                                                        
    $s3 = str_split("poiuytrewqasdfghjklmnbvcxz/']\.;[,=-)(*&^!@#$%<>:{?\"}| _+1324576809");                                                                                                                        
    $split = split(":",$encoded);                                                                                                                                                                                   
    $i = 1;                                                                                                                                                                                                         
    $result = "";                                                                                                                                                                                                   
    foreach ($split as $number) {
        if ($i == 4) {
            $i = 1;
        }
        if ($i == 1) {
            $result .= $s3[$number];
        }
        elseif ($i == 2) {
            $result .= $s1[$number];
        }
        elseif ($i == 3) {
            $result .= $s2[$number];
        }
        $i++;
    }
    return $result;
}

User avatar
Gogeta70
^_^
^_^
Posts: 3275
Joined: 25 Jun 2005, 16:00
18

Post by Gogeta70 »

Well, you have to understand that you will not have the keys to use to break the code. So of course you can break the iff code if you have the keys lol.
¯\_(ツ)_/¯ It works on my machine...

Post Reply