]> granicus.if.org Git - php/commitdiff
Reduce cost factors in sodium password_hash tests
authorNikita Popov <nikita.ppv@gmail.com>
Fri, 14 Aug 2020 13:37:48 +0000 (15:37 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Fri, 14 Aug 2020 13:39:42 +0000 (15:39 +0200)
Drop the 4x factors to make these tests a bit less obscenely
slow.

ext/sodium/tests/php_password_hash_argon2i.phpt
ext/sodium/tests/php_password_hash_argon2id.phpt
ext/sodium/tests/php_password_verify.phpt

index c9a2586721f4cc7fe2b66d794ba3dcaca114ddd1..836e19ac5c0183f2b34b2fd33aff314881ba0c00 100644 (file)
@@ -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--
 <?php
 
 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 +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)
index 3176a79bbf03a771e464482060915d89f7228660..6d69e169032dd88455f44c9ea4ca04c83b59a9e7 100644 (file)
@@ -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)
-
index 5c09fccd2edbcc87f56cd4370c1ed1ad5211bf70..803ca640c14de3085d527fc1f45cafc0b375bc16 100644 (file)
@@ -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)