summaryrefslogtreecommitdiff
path: root/tests/algo-hashes.php
diff options
context:
space:
mode:
authorGeo Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2026-07-12 15:51:52 +0300
committerGeo Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2026-07-12 15:51:52 +0300
commit02608271bb2a9f3a65ed536984d306ee14b48e34 (patch)
tree3f23ec48a694ec014e845c4f70d9b5f1c065403c /tests/algo-hashes.php
downloadkalassa-02608271bb2a9f3a65ed536984d306ee14b48e34.tar.gz
kalassa-02608271bb2a9f3a65ed536984d306ee14b48e34.tar.bz2
kalassa-02608271bb2a9f3a65ed536984d306ee14b48e34.zip
initialize repository; add docker config; migrate configuration to new specsHEADmaster
Diffstat (limited to 'tests/algo-hashes.php')
-rwxr-xr-xtests/algo-hashes.php52
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/algo-hashes.php b/tests/algo-hashes.php
new file mode 100755
index 0000000..8457949
--- /dev/null
+++ b/tests/algo-hashes.php
@@ -0,0 +1,52 @@
+<?php
+$userManager = new UserManager();
+
+$password = $userManager->cryptPassword('102030!!!');
+
+$user = (new User())
+ ->setUserName('geo@roptron.gr')
+ ->setPassword($password)
+ ->setRoles([1]);
+
+$userManager->createUserToken($user);
+
+
+$algos = [
+ [ PASSWORD_DEFAULT, 10 ],
+ [ PASSWORD_ARGON2I, 10 ],
+ [ CRYPT_BLOWFISH, 10 ],
+ [ PASSWORD_DEFAULT, 9 ],
+ [ PASSWORD_ARGON2I, 9 ],
+ [ CRYPT_BLOWFISH, 9 ],
+ [ PASSWORD_DEFAULT, 11 ],
+ [ PASSWORD_ARGON2I, 11 ],
+ [ CRYPT_BLOWFISH, 11 ],
+ [ PASSWORD_DEFAULT, 12 ],
+ [ PASSWORD_ARGON2I, 12 ],
+ [ CRYPT_BLOWFISH, 12 ],
+ [ PASSWORD_DEFAULT, 8 ],
+ [ PASSWORD_ARGON2I, 8 ],
+ [ CRYPT_BLOWFISH, 8 ],
+ [ PASSWORD_DEFAULT, 7 ],
+ [ PASSWORD_ARGON2I, 7 ],
+ [ CRYPT_BLOWFISH, 7]
+]
+?>
+<html>
+ <head>
+ <style>pre{ font: 400 14px/18px 'JetBrains Mono NL', 'Ununtu Mono', Consolas, Monaco; }</style>
+ <body>
+ <pre>
+
+<?php
+foreach($algos as $algo) {
+ echo "\n\nalgo= {$algo[0]}, cost={$algo[1]}"
+ ."\nhash= ". ( $x = password_hash('102030', $algo[0], ['cost' => $algo[1]]) )
+ ."\nbase64=". base64_encode($x);
+}
+
+?>
+
+ </pre>
+ </body>
+</html>