On Jan 16, 2008, at 1:28 AM, Andrés Robinet wrote:
1 - Mike is right about first encrypting and then doing a base64_encode (then saving results to DB, cookies, etc). I don't know why replacing " " to "+" for decrypting, though.
His other post explains that php didn't seem to like spaces. No spaces in the test strings -- I'll check for those when/if I can get the core en/decryption working.
2 - Mike is also right about $text = base64_decode($text) which should be $text = base64_decode($text_out) I think.
Yup -- that's what i get for trying to do this hastily and late at night --
3 - You are trimming the results on return, according to one post in the manual notes this will remove null padding on the decrypted string. This is desired, most of the time, but if the original (cleartext message) string ended in nulls you will get a difference and that may be the cause of the errors you are getting.
I understand that, thank you. There are no trailing nulls on the original string.
After correcting the my program, I still get the same results, about 4% wrong:
---------------------------------------------------- 70: String: 5214006139804600 -|- Enc: Ϊ%bÇCsšB>sìD%Å#z[ä. m…‡¿m§ð -|- Dec:àc8 -|- Nope 75: String: 1034702254251899 -|- Enc: !:Ã2ºÍé×»àe2s? :Ù0LµŒÕ[« -|- Dec:à`*' -|- Nope 89: String: 8245007043826594 -|- Enc: µÆ Íãd-‘Á´E3½yÍ×v‹,ZØW"éûqüŽ‚ó -|- Dec:û@Öë7�¼ -|- Nope etc. Wrong: 23/500 ---------------------------------------------------- Phooey. Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php