I wouldn't call it encryption at all. If you noticed, the print "" will return 1 (1 + 19 = 20), and ord("a") + 20 = ord("u") - this is simply packing and unpacking a number. Encoding, yes, encrypting, by no means.On Mon, 18 Apr 2005 14:37:49 +0530, [EMAIL PROTECTED] (Anish Kumar K) wrote:
Can any one suggest a good algorithm for encrpt and decrypt the files ..I donot want to use any perl module for that...
I don't know if I would call it "good" encryption, but......
#!/usr/bin/perl
use warnings;
use strict;
#by fokat of perlmonks
my $string = 'justanotherperlhacker'; print "$string\n";
my $obscure = pack("u",$string); print "$obscure\n";
my $unobscure = unpack(chr(ord("a") + 19 + print ""),$obscure);
same as my $unobscure = unpack(chr(ord('u')),$obscure);
print "$unobscure\n";
__END__
How about RSA <http://world.std.com/~franl/crypto/rsa-example.html> or DES <http://www.eventid.net/docs/desexample.htm>?
RSA<http://search.cpan.org/~vipul/Crypt-RSA-1.55/lib/Crypt/RSA.pm>
DES<http://search.cpan.org/~dparis/Crypt-DES-2.03/DES.pm>
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>