Gossamer Forum
Home : General : Perl Programming :

is there a 'crypt' for Windows?

Quote Reply
is there a 'crypt' for Windows?
Has anyone seen a version of the crypt command for Windows? My intention is to encrypt a list of passwords before sending them to the server (bcs my ISP will not allow me to schedule a program in CRON, and running a special prog everytime i upload a database is not practical...)
Quote Reply
Re: is there a 'crypt' for Windows? In reply to
The latest ActiveState has a working crypt() function. So you could do:

srand;
open (DB, "<password.txt") or die $!;
open (OUT, ">crypt-password.txt") or die $!;
@salt_chars = ('A' .. 'Z', 0 .. 9, 'a' .. 'z', '.', '/');
while (<DB&gt Wink {
chomp;
$salt = join '', @salt_chars[rand 64, rand 64];
$encrypted = crypt($_, $salt);
print OUT $encrypted, "\n";
}
close DB;
close OUT;

which will encrypt a list of passwords in password.txt and write it out to crypt-password.txt.

Hope this helps,

Alex