(Post a new answer so that the "encrypted" process is separated from the "hash")
For "encrypted" keys, the DNN side uses standard algorithms, such as DES, 3DES or AES, depending on the machineKey settings. But with some differences, you need to match your CF code. Not knowing your actual settings, I assume that you are using the default 3DES at the moment.
Data for encryption
The encrypted value is a combination of salt and password. But as with hashing, DNN uses UTF-16LE . Unfortunately, the ColdFusion Encrypt() function always assumes UTF-8, which will lead to a completely different result. Therefore, you need to use the EncryptBinary function.
// sample valus plainPassword = "password12345"; base64Salt = "x7le6CBSEvsFeqklvLbMUw=="; hexDecryptKey = "303132333435363738393031323334353637383930313233"; // first extract the bytes of the salt and password saltBytes = binaryDecode(base64Salt, "base64"); passBytes = charsetDecode(plainPassword, "UTF-16LE" ); // next combine the bytes. note, the returned arrays are immutable, // so we cannot use the standard CF tricks to merge them ArrayUtils = createObject("java", "org.apache.commons.lang.ArrayUtils"); dataBytes = ArrayUtils.addAll( saltBytes, passBytes );
Encryption algorithm
With ColdFusion block ciphers, the default is ECB mode . (See Strong Encryption in ColdFusion .) While .NET uses CBC mode by default, which requires an additional IV value. Therefore, you must adjust your CF code.
// convert DNN hex key to base64 for ColdFusion base64Key = binaryEncode(binaryDecode( hexDecryptKey, "hex"), "base64"); // create an IV and intialize it with all zeroes // block size: 16 => AES, 8=> DES or TripleDES blockSize = 8; iv = javacast("byte[]", listToArray(repeatString("0,", blocksize))); // encrypt using CBC mode bytes = encryptBinary(dataBytes, base64Key, "DESede/CBC/PKCS5Padding", iv); // result: WBAnoV+7cLVI95LwVQhtysHb5/pjqVG35nP5Zdu7T/Cn94Sd8v1Vk9zpjQSFGSkv WriteOutput("encrypted password="& binaryEncode( bytes, "base64" ));