[Nh-pm] encryption recommendation
Andrew Brosnan
andrew at broscom.com
Mon Aug 4 09:53:55 CDT 2003
On 8/4/03 at 10:14 AM, ben at blackavar.com (Ben Boulanger) wrote:
> On Mon, 2003-08-04 at 09:25, Andrew Brosnan wrote:
> > Can someone recommend a method or module for encrypting and
> > decrypting
> > strings(passwords)? I'm a little overwhelmed by the choices on the
> > CPAN, some of which have quite a long list of dependencies.
>
> If you're looking for simple, I just use the crypt routine. Here's
> sample code:
>
> my $salt = &generate_random_salt;
> my $password = crypt($password, $salt);
>
> sub generate_random_salt {
> my @range = ('A'..'Z','a'..'z','0'..'9','.','/');
> my $highest_array_value = $#range;
> my $random_number1 = rand $highest_array_value;
> my $random_number2 = rand $highest_array_value;
> my $return_salt = $range[$random_number1] .
> $range[$random_number2];
> return $return_salt;
> }
>
>
That just does one way encryption. I need decryption too.
More information about the Nh-pm
mailing list