Skip to content

Instantly share code, notes, and snippets.

@wchristian
Forked from brianmed/gist:7083904
Last active December 26, 2015 03:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wchristian/7083923 to your computer and use it in GitHub Desktop.
Save wchristian/7083923 to your computer and use it in GitHub Desktop.
sub hash_password {
my ($self, $plain_text, $settings_str) = @_;
return Crypt::Eksblowfish::Bcrypt::bcrypt($plain_text, $settings_str) if $settings_str;
my $salt = join '', map { chr int rand(256) } 1 .. 16;
my %settings = (key_nul => 1, cost => 10, salt => $salt);
return Crypt::Eksblowfish::Bcrypt::bcrypt_hash(\%settings, $password);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment