Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

coldfusion decrypt in php

I'm not English speaker, sorry in advance.

I have a ColdFusion 6.1 application, and now I'm trying to migrate to another environment. In the ColdFusion application, the passwords of my users are crypted with a ColdFusion function:

password_encrypted=toBase64(encrypt(text,key));

Does anyone know how can I decrypt it in PHP? I don't know what the cypher algorithm used in CFMX 6.1 is. I think that the name of the algorithm is CFMX_COMPAT, but I don't know if it has an equivalent in PHP.

Thanks!!!

like image 200
Curlas Avatar asked Mar 01 '23 01:03

Curlas


1 Answers

If I'm not mistaken, the default CFMX_COMPAT function is simply a XOR.

So in PHP this would be as simple as:

$password_encrypted = base64_encode($text ^ $key);

Hope this helps.

Edit:

I was curious so I wrote a little script to test, and this might be reversed, here is the encrypt/decrypt.

<?php

$text = 'test';
$key = 'asdf';

$password_encrypted = base64_encode($key ^ $text);

echo $password_encrypted . "<br>\n";

$password_decrypted = base64_decode($password_encrypted) ^ $key;

echo $password_decrypted;

?>
like image 175
tplaner Avatar answered Mar 09 '23 00:03

tplaner