• Welcome to Valhalla Legends Archive.
 

Pontifex

Started by rabbit, January 15, 2006, 09:26 AM

Previous topic - Next topic

rabbit

Well, Pontifex is an encryption schema from the book Cryptonomicon (which is really good, btw).  Just thought I'd share:
#!/usr/bin/perl -s

$f = $d ? -1 : 1;
$D = pack('C*', 33..86);
$p = shift;
$p = ~y/A-Z/;
$U = '$D = ~s/(.*)u$/U$1/; $D = ~s/U(.)/$1U/;';
($V = $U) = ~s/U/V/g;
$p = ~s/[A-Z]/$k = ord(#&) - 64, & e/eg;
$k = 0;

while(<>)
{
    y/a-z/A-Z/;
    y/A=Z//dc;
    $o .= $_
} $o .= 'X'

while length($o) %5 && !$d;

$o = ~s/./chr(($f * &e + ord($&) - 13) %26 + 65/eg;
$o = ~s/X*$// if $d;
$o = ~s /.{5}/$& /g;
print "$o\n";

sub v
{
    $v = ord(substr($D, $_[0])) - 32;
    $v > 53 ? 53 : $v;
}

sub w
{
    eval "$U$V$V";
    $D = ~s/(.*)([UV].*[UV])(.*)/$3$2$1/;
    &w(&v(53));
    $k ? (&w($k)) : ($c = &v(&v(0)), $c > 52 ? &e : $c)
}


Actually, I'm not even sure if it works, but it looks interesting!
Grif: Yeah, and the people in the red states are mad because the people in the blue states are mean to them and want them to pay money for roads and schools instead of cool things like NASCAR and shotguns.  Also, there's something about ketchup in there.

Yegg

It looks incredibly difficult to follow, but I dont know Perl either.

iago

There are many lines in it that look like they're there solely to make it difficult to understand the code.  They do operations that could very easily be done a different way in a complex way.  That's not a good sign for an encryption scheme.

Also, how does it work?  Where is the key and what is it encrypting? 
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


rabbit

The key is user supplied, and it encrypts plaintext.  An example is here.

The official page is here, which supplies a much better Perl implementation, as well as 16 other implementations in 13 languages.
Grif: Yeah, and the people in the red states are mad because the people in the blue states are mean to them and want them to pay money for roads and schools instead of cool things like NASCAR and shotguns.  Also, there's something about ketchup in there.

iago

Quote from: rabbit on January 15, 2006, 12:27 PM
The key is user supplied, and it encrypts plaintext.  An example is here.

Why, exactly, do I get a JavaScript error, "ActiveXObject Undefined"?  That's ewwy :)
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Yegg

Quote from: iago on January 15, 2006, 01:13 PM
Quote from: rabbit on January 15, 2006, 12:27 PM
The key is user supplied, and it encrypts plaintext.  An example is here.

Why, exactly, do I get a JavaScript error, "ActiveXObject Undefined"?  That's ewwy :)

It doesn't work at all for me. I don't even receive an error. What browser are you using? I'm on Mozilla Suite.

rabbit

Old link.  Try the new one.

It didn't work for me in Firefox, so I looked (and found) a new one:

http://www.erobillard.com/Content/solitaire/
Grif: Yeah, and the people in the red states are mad because the people in the blue states are mean to them and want them to pay money for roads and schools instead of cool things like NASCAR and shotguns.  Also, there's something about ketchup in there.

iago

The reason it didn't work was that it was in (eww!) ActiveX :)
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


rabbit

Yeah.  Eww indeed.  It doesn't even really match what the original scheme was anyway :\  O well.
Grif: Yeah, and the people in the red states are mad because the people in the blue states are mean to them and want them to pay money for roads and schools instead of cool things like NASCAR and shotguns.  Also, there's something about ketchup in there.

topaz

I read Cryptonomicon, and I found it sucky. You wasted ten of my dollars, rabbit :(
RLY...?

rabbit

Pfft!  You obviously suck at life then.  Cryptonomicon is awesome.
Grif: Yeah, and the people in the red states are mad because the people in the blue states are mean to them and want them to pay money for roads and schools instead of cool things like NASCAR and shotguns.  Also, there's something about ketchup in there.