summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/VNDB/Util/Auth.pm8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/VNDB/Util/Auth.pm b/lib/VNDB/Util/Auth.pm
index 519e5523..ce548a98 100644
--- a/lib/VNDB/Util/Auth.pm
+++ b/lib/VNDB/Util/Auth.pm
@@ -8,6 +8,7 @@ use Exporter 'import';
use Digest::MD5 'md5';
use Digest::SHA qw|sha1_hex sha256 sha256_hex|;
use Time::HiRes;
+use Encode 'encode_utf8';
use POSIX 'strftime';
@@ -117,9 +118,10 @@ sub _authCheck {
# Arguments: self, pass, salt, binary mode
# Returns: encrypted password
sub _authEncryptPass{
- my ($self, $pass, $salt, $bin) = @_;
- return sha256($self->{global_salt} . $pass . $salt) if $bin;
- return sha256_hex($self->{global_salt} . $pass . $salt);
+ my($self, $pass, $salt, $bin) = @_;
+ my $str = $self->{global_salt} . encode_utf8($pass) . encode_utf8($salt);
+ return sha256($str) if $bin;
+ return sha256_hex($str);
}