There are many functions to create password like MDS, hash etc.
we can create a function to create our encryption method to create a password.
The following function create a random password using its own method and will not be easily identified the method of creating the password.
function STEM_Key()
{
// Create the meta-password
$sMetaPassword = "";
$ahPasswordGenerator = array(
"C" => array('characters' => 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 'minimum' => 10, 'maximum' => 10),
"S" => array('characters' => "!@()-_=+?*^&", 'minimum' => 1, 'maximum' => 2),
"N" => array('characters' => '1234567890', 'minimum' => 10, 'maximum' => 10)
);
foreach ($ahPasswordGenerator as $cToken => $ahPasswordSeed){
$sMetaPassword .= str_repeat($cToken, rand($ahPasswordSeed['minimum'], $ahPasswordSeed['maximum']));
$sMetaPassword = str_shuffle($sMetaPassword);
}
// Create the real password
$arBuffer = array();
for ($i = 0; $i < strlen($sMetaPassword); $i ++){
$arBuffer[] = $ahPasswordGenerator[(string)$sMetaPassword[$i]]['characters'][rand(0, strlen($ahPasswordGenerator[$sMetaPassword[$i]]['characters']) - 1)];
}
return implode("", $arBuffer);
}
You can view the output of the function in the following way.
echo STEM_Key();
we can create a function to create our encryption method to create a password.
The following function create a random password using its own method and will not be easily identified the method of creating the password.
function STEM_Key()
{
// Create the meta-password
$sMetaPassword = "";
$ahPasswordGenerator = array(
"C" => array('characters' => 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 'minimum' => 10, 'maximum' => 10),
"S" => array('characters' => "!@()-_=+?*^&", 'minimum' => 1, 'maximum' => 2),
"N" => array('characters' => '1234567890', 'minimum' => 10, 'maximum' => 10)
);
foreach ($ahPasswordGenerator as $cToken => $ahPasswordSeed){
$sMetaPassword .= str_repeat($cToken, rand($ahPasswordSeed['minimum'], $ahPasswordSeed['maximum']));
$sMetaPassword = str_shuffle($sMetaPassword);
}
// Create the real password
$arBuffer = array();
for ($i = 0; $i < strlen($sMetaPassword); $i ++){
$arBuffer[] = $ahPasswordGenerator[(string)$sMetaPassword[$i]]['characters'][rand(0, strlen($ahPasswordGenerator[$sMetaPassword[$i]]['characters']) - 1)];
}
return implode("", $arBuffer);
}
You can view the output of the function in the following way.
echo STEM_Key();
No comments:
Post a Comment