Gossamer Forum
Home : General : Perl Programming :

encryption of password file

Quote Reply
encryption of password file
Hello,
I have a file for DBman with more than 200 users which I want to give several permissions. How have i to make it to encrypt this file with perl and how can i decrypt it later to make changes??
Quote Reply
Re: encryption of password file In reply to
Hi,

You need to use perl's crypt() function to encrypt the password. Usage is:

Call this only once.
Quote:
srand;
my @salt_chars = ('A' .. 'Z', 0 .. 9, 'a' .. 'z', '.', '/');

Now, for each password:

Quote:
my $salt = join '', @salt_chars[rand 64, rand 64];
my $encrypted = crypt($password, $salt);

You can't decrypt passwords, it's a one way process.

Cheers,

Alex