Hmailserver script to set account #passwords

Views: 1623

I am going to try the following code to pre-set a password on Hmailserver. My previous code doesn’t work on the newly installed Cloud Instance. Stay Tuned. The link and code are pretty old, but hope it will still work. Advice welcome!

 

<?PHP
// Users password
$strPassword = “test123”;

// Generate 6 Character Random HEX string for the SALT
$chars = “0123456789abcdef”;

$i = 0;
$strSALT = “”;

while ( $i <= 5 ) {
$strSALT .= $chars{ mt_rand( 0, strlen( $chars ) ) };
$i++;
}

// Create a temp string containing salt+pass
$strTemp = $strSALT.$strPassword;

// SHA256 the temp string
$strHash = hash( ‘sha256’, $strTemp );
unset( $strTemp );

// The final string to be stored
$strHashedPass = $strSALT.$strHash;

echo $strHashedPass;
?>

<?PHP // Users password $strPassword = “test123”; // Generate 6 Character Random HEX string for the SALT $chars = “0123456789abcdef”; $i = 0; $strSALT = “”; while ( $i

Source: hMailServer.INI and MD5 Encryption Please Help 911 – hMailServer forum

Leave a Reply