Skip to content | Skip to navigation
Jan 21, 2003 17:28 # 8076
Jaz *** (9) has all the information you need...
Here is a minimalist Perl script that checks a RSA key for validity, then enciphers a simple message and deciphers it again. I post it here in case someone could be interested in the basic concept behind public key cryptography.
#!/usr/bin/perl
# Simple public-key cryptography script
# ----------------------------------------------------------------
# 2002 by Henning Koch
#
# Checks an RSA key for validity, then enciphers a simple message
# and deciphers it again.
# Public key is ($n, $b)
# Private key is ($p, $q, $a)
# Message is $x
use strict;
my ($n, $a, $b, $p, $q, $x) = (195487, 178791, 759, 839, 233, 101010);
sub square_and_multiply # computes g^l mod n
{
my ($g, $l, $n) = @_;
my($x, $y, $m) = (1, $g, $l);
while($m > 0)
{
if($m % 2 == 1)
{
$x = ($x*$y) % $n;
$m--;
}
else
{
$y = ($y*$y) % $n;
$m = $m / 2;
}
}
return $x;
}
sub is_prime
{
my ($i) = @_;
use integer;
foreach my $test (2 .. $i / 2)
{
if($i % $test == 0) { return 0 }
}
return 1;
}
my $enciphered = &square_and_multiply($x, $b, $n);
my $deciphered = &square_and_multiply($enciphered, $a, $n);
print "n = pq: " . ($n == $p * $q) . "\n";
print "ab = 1 mod eul(n): " . ( ($a*$b) % (($p - 1)*($q - 1)) == 1) . "\n";
print "p is prime: " . &is_prime($p) . "\n";
print "q is prime: " . &is_prime($q) . "\n";
print "p <> q: " . ($p != $q) . "\n";
print "Enciphered x: " . $enciphered . "\n";
print "Re-deciphered x: " . $deciphered . "\n";
'Yeah, That's what Jesus would do. Jesus would bomb Afghanistan. Yeah.' - snowlion
This post was edited by Jaz on Jan 21, 2003.
Oh my, hurry pinch me. Am I dreaming??? Am I actually seeing code that Jaz wrote??? This can't be. Its gotta be a bug in the system. Surely I am not seeing Jaz's code... This is totally amazing. Now if Jaz can release code I'm sure Microsoft will do it eventually.
Jaz what are the licensing terms to this script? Surely we can't modify it and let others use our modified code.
that's almost exactly what i thought when i saw this. but i don't think it's a good idea to get sarcastic on jaz's first steps in the world of open .. err .. published source ;>
Note that, u. o. u., s. is not a computer program and his answers might not always be appropriate.
This post is far to contraversal
Controversial is an opinion that differs from the majority. What you do is just being hollow. The fact that you spent the major part of your post declaring how hollow you are doesn't make you look less like an ass in any respect.
'Yeah, That's what Jesus would do. Jesus would bomb Afghanistan. Yeah.' - snowlion
This post is far to contraversal.
If you call senseless flames "controversial", yes.
Say, and that's something I'd really like to know, why the fsck are you always provoking people and practically begging for reds? Can't you just be nice? Is it because you have that urge to demonstrate social incompetence? What the heck do you get from pissing people off this way? If you just don't like this place anymore, you could just stay away from it and never bother with it again. There's absolutely no need to provoke people until you get kicked out.
Is this so hard to grasp?
When life hands you a lemon, that's 40% of your RDA of vitamin C taken care of.
This harkens back to the days when the big flame wars about open source were going on. Many of you will not remember because you weren't around NAO those days.
I've been there, and I remember. I also remember you doing things that... well, things people could understand as sabotage. Just because you didn't like NAO's closed-source character. (Whatever happened to your open-source rival site anyway?)
Thats why I get alot of red ratings. Because I have differing views than the majority of NAO readers.
Sorry to kill your soap bubble here, buddy. If you get a red from me, it's because I feel you're actively trying to offend me. Different opinions are perfectly acceptable for me. The way you declare yours is not.
As many people seem to have similar thoughts, you might want to reconsider your style. When people don't like what you write, it's not always because they can't take the genius of your oh-so controversial yet brilliant statements (altho that must be a tempting thought) - more often it's plain and simply because your inappropriate way of telling it pisses them off.
When life hands you a lemon, that's 40% of your RDA of vitamin C taken care of.
Jan 23, 2003 15:18 # 8153
null ™ (15) has all the information you need...
Like? I'd like to hear some examples of this sabotage.
Remember your resolution to bring NAO down because it's evil closed-source?
Nothing ever happened to it. Because there was never any open source rival site made.
Well my humble self remembers a story on NAO with a screenshot (? not sure about that one), and even some half-working title page. I can't remember the name tho.
When life hands you a lemon, that's 40% of your RDA of vitamin C taken care of.