info-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: password generation


From: Andrew McGhee
Subject: RE: password generation
Date: Tue, 25 Sep 2001 09:30:17 +0100

Martin,
First one will hash a password, which you can throw into the CVSROOT/passwd
file
Second one will generate a random password for you.

Andrew
========================================
# Hash a password
sub HashPassword {
  my ($self) = shift;
  my $Password = shift || carp("No password supplied!");
  srand (time());
  my $randletter = "(int (rand (26)) + (int (rand (1) + .5) % 2 ? 65 :
97))";
  my $salt = sprintf ("%c%c", eval $randletter, eval $randletter);
  my $crypttext = crypt ($Password, $salt);
  return ${crypttext};
}

# Generate a random password
sub GeneratePassword {
  my ($self) = shift;
  my $Charstring="23456789ABCDEFGHJKMNPQRSTUVWXYZ";
#  my
$Charstring="23456789ABCDEFGHJKMNPQRSTUVWXYZabcdefghjkmnpqrstuvwxyz,.?!$%^
&*()address@hidden<>";
  my @Chars = split(//, $Charstring);
  my $passwordLength = 12;
  my $passwd = "";
  srand (time());
  for (my $i = 1; $i < $passwordLength; $i++) {
    my $charPosition = int (rand ($#Chars));
    $passwd .= $Chars[$charPosition];
  }
  return $passwd;
}
========================================
-----Original Message-----
From: Martín Marqués [mailto:address@hidden
Sent: 24 September 2001 22:52
To: address@hidden
Subject: password generation


How can I generate passwords for my cvs server, so that it doesn't use the 
system passwords.
Carrfull!!! I want a way to generate the passwords, not how to make cvs 
authenticate against another password file (I know how to do that).

TIA

-- 
Porqué usar una base de datos relacional cualquiera,
si podés usar PostgreSQL?
-----------------------------------------------------------------
Martín Marqués                  |        address@hidden
Programador, Administrador, DBA |       Centro de Telematica
                       Universidad Nacional
                            del Litoral
-----------------------------------------------------------------

_______________________________________________
Info-cvs mailing list
address@hidden
http://mail.gnu.org/mailman/listinfo/info-cvs



reply via email to

[Prev in Thread] Current Thread [Next in Thread]