Valhalla Legends Forums Archive | General Programming | Pontifex

AuthorMessageTime
rabbit
Well, Pontifex is an encryption schema from the book Cryptonomicon (which is really good, btw).  Just thought I'd share:
[pre]#!/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)
}[/pre]

Actually, I'm not even sure if it works, but it looks interesting!
January 15, 2006, 3:26 PM
Yegg
It looks incredibly difficult to follow, but I dont know Perl either.
January 15, 2006, 4:19 PM
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? 
January 15, 2006, 5:32 PM
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.
January 15, 2006, 6:27 PM
iago
[quote author=rabbit link=topic=13920.msg141933#msg141933 date=1137349675]
The key is user supplied, and it encrypts plaintext.  An example is here.
[/quote]

Why, exactly, do I get a JavaScript error, "ActiveXObject Undefined"?  That's ewwy :)
January 15, 2006, 7:13 PM
Yegg
[quote author=iago link=topic=13920.msg141934#msg141934 date=1137352418]
[quote author=rabbit link=topic=13920.msg141933#msg141933 date=1137349675]
The key is user supplied, and it encrypts plaintext.  An example is here.
[/quote]

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

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.
January 15, 2006, 7:54 PM
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/
January 15, 2006, 8:03 PM
iago
The reason it didn't work was that it was in (eww!) ActiveX :)
January 15, 2006, 11:34 PM
rabbit
Yeah.  Eww indeed.  It doesn't even really match what the original scheme was anyway :\  O well.
January 16, 2006, 3:15 AM
Topaz
I read Cryptonomicon, and I found it sucky. You wasted ten of my dollars, rabbit :(
January 17, 2006, 3:48 AM
rabbit
Pfft!  You obviously suck at life then.  Cryptonomicon is awesome.
January 18, 2006, 3:44 AM

Search