随机密码生成器Shell脚本-基于PHP类+SHA1
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了随机密码生成器Shell脚本-基于PHP类+SHA1相关的知识,希望对你有一定的参考价值。
#!/usr/bin/php <?php /** * Generate a random password */ class Password { /** * Generate the new password * * @access public * @param array $params * @return string **/ { $upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; $lower = "abcdefghijklmnopqrstuvwxyz"; $number = "0123456789"; $seed_length = 0; $seed = ''; $password = ''; if($use_upper === TRUE){ $seed_length += 26; $seed .= $upper; } if($use_lower === TRUE){ $seed_length += 26; $seed .= $lower; } if($use_number === TRUE){ $seed_length += 10; $seed .= $number; } $seed .= $use_custom; } for($i = 1; $i <= $length; $i++){ } return $password; } // End of generate } // End of Class Password // ------------------------------------------------------------------------ /** * With Special Characters **/ echo " With Special Characters: "; echo "------------------------- "; $password = new Password; for ($i=10; $i <= 80; $i += 10) { $password = new Password; } // ------------------------------------------------------------------------ /** * Without Special Characters **/ echo " Without Special Characters: "; echo "---------------------------- "; $password = new Password; for ($i=10; $i <= 80; $i += 10) { $password = new Password; } // ------------------------------------------------------------------------ /** * SHA1 Based * These passwords will only contain lowercase letters from a to f and numbers from 0 to 9 **/ echo " SHA1 Based: "; echo "------------ "; echo "40: ${hash1} "; echo "80: ${hash2} ";
以上是关于随机密码生成器Shell脚本-基于PHP类+SHA1的主要内容,如果未能解决你的问题,请参考以下文章