Der SHA1-Hash der Mitgliedschaft ist nicht für alle Benutzer gleich
Ich habe eine Benutzertabelle im Klartext und habe sie auf den Mitgliedschaftsanbieter migriert.
Mit ColdFusion (aktuelles System) habe ich es geschafft, das Passwort eines Benutzers (Testbenutzer) zu HASHEN, und es stimmte perfekt überein. Aber jetzt stimmen die nachfolgenden Benutzer nicht überein. Was mache ich falsch.
<cfscript>
theEncoding = "UTF-16LE";
thePassword = "dtD3v310p3r!";
base64Salt = "JZjdzUXREM0A7DPI3FV3iQ==";
theSalt = charsetEncode( binaryDecode(base64Salt, "base64"), theEncoding );
theHash = hash(theSalt & thePassword, "SHA1", theEncoding);
// hash always returns hex. convert it to base64 so it matches DNN
theBase64Hash = binaryEncode(binaryDecode(theHash, "hex"), "base64");
WriteOutput("<br />theBase64Hash= "& theBase64Hash &"<br/>");
WriteOutput("DBPassword= 5khDDMmoFtW+j99r/whE/TjyIUo= <br />");
theEncoding = "UTF-16LE";
thePassword = "DT!@12";
base64Salt = "+muo6gAmjvvyy5doTdjyaA==";
theSalt = charsetEncode( binaryDecode(base64Salt, "base64"), theEncoding );
theHash = hash(theSalt & thePassword, "SHA1", theEncoding);
// hash always returns hex. convert it to base64 so it matches DNN
theBase64Hash = binaryEncode(binaryDecode(theHash, "hex"), "base64");
WriteOutput("<br />theBase64Hash= "& theBase64Hash &"<br/>");
WriteOutput("DBPassword= nfcqQBgeAm0Dp1oGZI0O70Y6DvA= <br />");
</cfscript>
Der erste arbeitet zu 100%. Aber der zweite tut es nicht. Der zweite erzeugt einen Hash-Wert von86SrPKXW5xywDYoC8MVy0q259sQ=