Re: ITP seahorse
On Fri, May 19, 2000 at 03:22:19AM +0200, Simon Richter wrote:
> Are you sure about that? I remember something about programs providing
> the necessary hooks to insert encryption software to be restricted
> too.
I, too, have heard about this. But I think it is something that people
have said, rather than something which makes sense.
Think about it: how many bits of encryption does a hook support?
If the hook supports, say, an 8 bit key, that means it's not a restricted
piece of munitions, right? But if a hook supports, say, a 448 bit key,
that means it's a restricted piece of munitions, right? But what about
a hook that doesn't care about keys?
Aside: it's possible to write a trivial routine which takes a
hash function and turns it into an encryption routine. So imagine
I write a really dumb encryption routine, like:
#!/usr/bin/perl
sub hash {
return @_;
}
# el-cheapo mechanism to turn string into a character generator
sub gen {
my ($string)= @_;
my $j= 0;
return sub {
return substr $string, $j++, 1;
}
}
sub gen_encrypt {
my ($key, $gen_next_char)= @_;
my ($char, $new_byte);
return sub {
if (length ($char= &$gen_next_char)) {
$key= hash $key;
$new_byte= chr(ord($key) ^ ord($char));
$key.= $new_byte;
return $new_byte;
} else {
return undef;
}
}
}
sub gen_decrypt {
my ($key, $gen_next_char)= @_;
my ($char, $new_byte);
return sub {
if (length ($char= &$gen_next_char)) {
$key= hash $key;
$new_byte= chr(ord($key) ^ ord($char));
$key.= $char;
return $new_byte;
} else {
return undef;
}
}
}
# demo
$stream= gen_decrypt "foo", gen_encrypt "foo", gen "bar\n";
while (defined ($c= &$stream)) {
print $c;
}
Ok, nothing illegal about that. Replace hash() with a 16 or 32 bit
checksum, and you're fine, regardless of the size of your key. But,
replace hash with md5sum (use Digest::MD5 'md5'), and all of a sudden
you've got a 128 bit algorithm you can't export. But that didn't make
the stupid xor encryption routine illegal.
--
Raul
Reply to: