Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
mkpasswd -m sha-512 $pass $( openssl rand -base64 16 | tr -d '+=' | head -c 16 )
sub hashed_password {
my ( $pass ) = @_;
# mkpasswd -m sha-512 $pass $( openssl rand -base64 16 | tr -d '+=' | head -c 16 )
my $get_salt = sub {
my ( $out, $err );
my @command = split ' ', 'openssl rand -base64 16';
run3 \@command, undef, \$out, \$err;
chomp $out;
$out =~ s/[+=]//g;
return substr $out, 0, 16;
};
my ( $out, $err );
my @command = split ' ', "mkpasswd -m sha-512 $pass " . $get_salt->();
run3 \@command, undef, \$out, \$err;
chomp $out;
return $out;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.