Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
TripleDES encryption

Posted by sm519 (sm519), 1 December 2004
Hi There,

I'm currently working in porting over our password encryption/authorisation system from Java to PHP.

I'm using the same cipher and mode in PHP as was used in Java however the resulting encrypted strings differ slightly.

I have base64 encoded the encrypted string in both languages and they produce a final string of the same length.

The difference I've noticed with Java encryption is that a salt is used to prepare a key for generation and then the generated key is passed to the cipher. In PHP a salt is not used within the mcrypt functions - simply a user defined key and IV is passed to the module_open function.

Has anyone had any experience of porting TripleDES encryption functionality from Java to PHP? Any suggestions advice would be appreciated as I have been unable to find much information from the usual sources - ie google

Posted by admin (Graham Ellis), 2 December 2004
Not an area I've got much personal experience in, and overnight seems to have been fully taking up with sleeping and firefighting ... I did grab the "secure PHP development" book off the shelf but it's less helpful than I would have expected.   Also looked at the "crypt" manual page for clues ... and several other book.

"Fools rush in ...." etc.    Pure guess. Is there some extra parameter / constant associated with the 3DES encoding that you don't actually get an opportunity to specify - and is it written differently in Java to PHP?

Wait .. (just writing as I research) .... there's about 8 pages on encryption in the PHP cookbook
pages 371 onwards ...

Do you have a copy / local bookstore you can have a quick look in ??

This page is a thread posted to the opentalk forum at and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2024: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: • WEB: • SKYPE: wellho