From: Nikita Popov Date: Fri, 14 Aug 2020 13:37:48 +0000 (+0200) Subject: Reduce cost factors in sodium password_hash tests X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=86072d60de587caf87bc2580ed8ab34baa9b26a6;p=php Reduce cost factors in sodium password_hash tests Drop the 4x factors to make these tests a bit less obscenely slow. --- diff --git a/ext/sodium/tests/php_password_hash_argon2i.phpt b/ext/sodium/tests/php_password_hash_argon2i.phpt index c9a2586721..836e19ac5c 100644 --- a/ext/sodium/tests/php_password_hash_argon2i.phpt +++ b/ext/sodium/tests/php_password_hash_argon2i.phpt @@ -8,14 +8,15 @@ if (!function_exists('sodium_crypto_pwhash_str_verify')) { if (!in_array('argon2i', password_algos(), true /* strict */)) { echo "skip - No argon2i support in password_hash()"; } +?> --FILE-- PASSWORD_ARGON2_DEFAULT_MEMORY_COST * $mem, 'time_cost' => PASSWORD_ARGON2_DEFAULT_TIME_COST * $time, @@ -45,10 +46,6 @@ Hash: string(96) "$argon2i$v=19$m=65536,t=8,p=1$%s$%s" bool(true) bool(false) Using password: string(44) "%s" -Hash: string(97) "$argon2i$v=19$m=65536,t=16,p=1$%s$%s" -bool(true) -bool(false) -Using password: string(44) "%s" Hash: string(97) "$argon2i$v=19$m=131072,t=4,p=1$%s$%s" bool(true) bool(false) @@ -56,19 +53,3 @@ Using password: string(44) "%s" Hash: string(97) "$argon2i$v=19$m=131072,t=8,p=1$%s$%s" bool(true) bool(false) -Using password: string(44) "%s" -Hash: string(98) "$argon2i$v=19$m=131072,t=16,p=1$%s$%s" -bool(true) -bool(false) -Using password: string(44) "%s" -Hash: string(97) "$argon2i$v=19$m=262144,t=4,p=1$%s$%s" -bool(true) -bool(false) -Using password: string(44) "%s" -Hash: string(97) "$argon2i$v=19$m=262144,t=8,p=1$%s$%s" -bool(true) -bool(false) -Using password: string(44) "%s" -Hash: string(98) "$argon2i$v=19$m=262144,t=16,p=1$%s$%s" -bool(true) -bool(false) diff --git a/ext/sodium/tests/php_password_hash_argon2id.phpt b/ext/sodium/tests/php_password_hash_argon2id.phpt index 3176a79bbf..6d69e16903 100644 --- a/ext/sodium/tests/php_password_hash_argon2id.phpt +++ b/ext/sodium/tests/php_password_hash_argon2id.phpt @@ -14,8 +14,8 @@ if (!in_array('argon2id', password_algos(), true /* strict */)) { echo 'Argon2 provider: '; var_dump(PASSWORD_ARGON2_PROVIDER); -foreach([1, 2, 4] as $mem) { - foreach([1, 2, 4] as $time) { +foreach([1, 2] as $mem) { + foreach([1, 2] as $time) { $opts = [ 'memory_cost' => PASSWORD_ARGON2_DEFAULT_MEMORY_COST * $mem, 'time_cost' => PASSWORD_ARGON2_DEFAULT_TIME_COST * $time, @@ -45,10 +45,6 @@ Hash: string(97) "$argon2id$v=19$m=65536,t=8,p=1$%s$%s" bool(true) bool(false) Using password: string(44) "%s" -Hash: string(98) "$argon2id$v=19$m=65536,t=16,p=1$%s$%s" -bool(true) -bool(false) -Using password: string(44) "%s" Hash: string(98) "$argon2id$v=19$m=131072,t=4,p=1$%s$%s" bool(true) bool(false) @@ -56,20 +52,3 @@ Using password: string(44) "%s" Hash: string(98) "$argon2id$v=19$m=131072,t=8,p=1$%s$%s" bool(true) bool(false) -Using password: string(44) "%s" -Hash: string(99) "$argon2id$v=19$m=131072,t=16,p=1$%s$%s" -bool(true) -bool(false) -Using password: string(44) "%s" -Hash: string(98) "$argon2id$v=19$m=262144,t=4,p=1$%s$%s" -bool(true) -bool(false) -Using password: string(44) "%s" -Hash: string(98) "$argon2id$v=19$m=262144,t=8,p=1$%s$%s" -bool(true) -bool(false) -Using password: string(44) "%s" -Hash: string(99) "$argon2id$v=19$m=262144,t=16,p=1$%s$%s" -bool(true) -bool(false) - diff --git a/ext/sodium/tests/php_password_verify.phpt b/ext/sodium/tests/php_password_verify.phpt index 5c09fccd2e..803ca640c1 100644 --- a/ext/sodium/tests/php_password_verify.phpt +++ b/ext/sodium/tests/php_password_verify.phpt @@ -19,12 +19,10 @@ if (!in_array($algo, password_algos(), true /* strict */)) { $opsSet = [ SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE, SODIUM_CRYPTO_PWHASH_OPSLIMIT_MODERATE, - SODIUM_CRYPTO_PWHASH_OPSLIMIT_SENSITIVE, ]; $memSet = [ SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE, SODIUM_CRYPTO_PWHASH_MEMLIMIT_MODERATE, - SODIUM_CRYPTO_PWHASH_MEMLIMIT_SENSITIVE, ]; echo 'Argon2 provider: '; @@ -56,10 +54,6 @@ Hash: string(98) "$argon2id$v=19$m=262144,t=2,p=1$%s$%s" bool(true) bool(false) Using password: string(44) "%s" -Hash: string(99) "$argon2id$v=19$m=1048576,t=2,p=1$%s$%s" -bool(true) -bool(false) -Using password: string(44) "%s" Hash: string(97) "$argon2id$v=19$m=65536,t=3,p=1$%s$%s" bool(true) bool(false) @@ -67,19 +61,3 @@ Using password: string(44) "%s" Hash: string(98) "$argon2id$v=19$m=262144,t=3,p=1$%s$%s" bool(true) bool(false) -Using password: string(44) "%s" -Hash: string(99) "$argon2id$v=19$m=1048576,t=3,p=1$%s$%s" -bool(true) -bool(false) -Using password: string(44) "%s" -Hash: string(97) "$argon2id$v=19$m=65536,t=4,p=1$%s$%s" -bool(true) -bool(false) -Using password: string(44) "%s" -Hash: string(98) "$argon2id$v=19$m=262144,t=4,p=1$%s$%s" -bool(true) -bool(false) -Using password: string(44) "%s" -Hash: string(99) "$argon2id$v=19$m=1048576,t=4,p=1$%s$%s" -bool(true) -bool(false)