note 94096 added to book.mcrypt
| From: | Anonymous at osu1 dot php dot net | Date: | Fri, 16 Oct 2009 03:11:39 +0000 |
| Subject: | note 94096 added to book.mcrypt | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-161797@lists.php.net to get a copy of this message | ||
When using 3DES between PHP and C#, it is to be noted that there are subtle differences that if not
strictly observed, will result in annoying problem encrypt/decrypt data.
1), When using a 16 bytes key, php and c# generates total different outcome string. it seems that a
24 bytes key is required for php and c# to work alike.
2), php doesnt have a "padding" option, while c# has 3 (?). My work around is to add nulls
i.e. chr(0) to the end of the source string to make its size times of 8, while in c#,
PaddingMode.Zeros is required.
3) the key size has to be times of 8, in php, to make it work for c#.
you may also find this url helpful http://www.sanity-free.org/131/triple_des_between_php_and_csharp.html
----
Server IP: 222.73.227.205
Probable Submitter: 218.87.47.170
----
Manual Page -- http://www.php.net/manual/en/book.mcrypt.php
Edit -- https://master.php.net/note/edit/94096
Del: integrated -- https://master.php.net/note/delete/94096/integrated
Del: useless -- https://master.php.net/note/delete/94096/useless
Del: bad code -- https://master.php.net/note/delete/94096/bad+code
Del: spam -- https://master.php.net/note/delete/94096/spam
Del: non-english -- https://master.php.net/note/delete/94096/non-english
Del: in docs -- https://master.php.net/note/delete/94096/in+docs
Del: other reasons-- https://master.php.net/note/delete/94096
Reject -- https://master.php.net/note/reject/94096
Search -- https://master.php.net/manage/user-notes.php