1<?php 2// Check the arguments 3if ($argc != 2) { 4 echo 'Use a single argument which is the password to be used' . PHP_EOL; 5 echo PHP_EOL; 6 echo 'Usage:' . PHP_EOL; 7 echo ' ' . $argv[0] . ' CLEAR_TEXT' . PHP_EOL; 8 exit(1); 9} 10$clear = $argv[1]; 11 12require('vendor/paragonie/random_compat/lib/random.php'); 13// Load DokuWiki PassHash class 14// Since release 2020-07-29 the class has changed name 15if (file_exists('inc/PassHash.php')) { 16 require('inc/PassHash.php'); 17 $pass = new dokuwiki\PassHash(); 18} else { 19 require('inc/PassHash.class.php'); 20 $pass = new PassHash(); 21} 22 23// Output using a random salt 24echo $pass->hash_smd5($clear) . PHP_EOL; 25