Skip to content

Commit 53a4971

Browse files
committed
couple libsodium related fixes
1 parent a536cca commit 53a4971

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/crypt_sodium.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public static function plaintext($string, $key) {
3434
$crypt_string = substr($raw_string, 56);
3535

3636
if (\Sodium\crypto_auth_verify($hmac, $crypt_string, $crypt_key)) {
37-
$res = Sodium\crypto_secretbox_open($crypt_string, $salt, $crypt_key);
37+
$res = \Sodium\crypto_secretbox_open($crypt_string, $salt, $crypt_key);
3838
}
3939
if ($res === false) {
4040
return parent::plaintext($string, $key);
@@ -68,7 +68,7 @@ public static function hash_password($password, $salt=false, $count=false, $algo
6868
if (!LIBSODIUM) {
6969
return parent::hash_password($password, $salt, $count, $algo, $type);
7070
}
71-
return Sodium\crypto_pwhash_str( $password,
71+
return \Sodium\crypto_pwhash_str( $password,
7272
\Sodium\CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE,
7373
\Sodium\CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE
7474
);

lib/framework.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
}
3333

3434
if (!defined('LIBSODIUM')) {
35-
define('LIBSODIUM', extension_loaded('libsodium'));
35+
define('LIBSODIUM', extension_loaded('libsodium') && function_exists('\Sodium\crypto_pwhash_str_verify'));
3636
}
3737

3838
if (!class_exists('Hm_Functions')) {

0 commit comments

Comments
 (0)