All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit 7bb29c43 authored by Leigh B Stoller's avatar Leigh B Stoller

Add a function to convert string to password hash.

parent 9b3f4ad6
......@@ -15,7 +15,7 @@ use vars qw(@ISA @EXPORT);
@EXPORT = qw(TBDB_CHECKDBSLOT_NOFLAGS TBDB_CHECKDBSLOT_WARN
TBDB_CHECKDBSLOT_ERROR TBcheck_dbslot TBFieldErrorString
TBGetUniqueIndex ParRun VersionInfo UpdateVersionInfo
SpanningTree BackTraceOnWarning);
SpanningTree BackTraceOnWarning PassWordHash);
use emdb;
use English;
......@@ -615,5 +615,20 @@ sub BackTraceOnWarning($)
}
}
#
# Convert to an encrypted hash.
#
sub PassWordHash($)
{
my ($password) = @_;
my @salt_chars = ('a'..'z','A'..'Z','0'..'9');
my $salt = $salt_chars[rand(@salt_chars)] .
$salt_chars[rand(@salt_chars)];
my $passhash = crypt($password, "\$1\$${salt}");
return $passhash;
}
# _Always_ make sure that this 1 is at the end of the file...
1;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment