kvarnerexpress 0 Report post Posted October 18, 2005 Just for fun, I made my own encryption system. I was wondering if people had any suggestions or could write code to break it.Code for encryption system, use amfrencrypt() to encrypt and amfrdecrypt() to decryptPHP Code: function amfrencrypt($string, $password){ $password = md5($password); $encnum = 0; for($k = 0; $k < strlen($password); $k++) { if(is_string($password{$k})) { $encnum += ord($password{$k}); } } if($encnum == 0) { die('Invlaid password!'); } for ($i = 0; $i < strlen($string); $i++) { $str[] = $string{$i}; } $count = count($str); for($j = 0; $j < $count; $j++) { $encstr[] = ord($str[$j]) * $encnum; } $return = implode(':', $encstr); return $return;}function amfrdecrypt($string, $password){ $password = md5($password); $str = explode(':', $string); $encnum = 0; for($k = 0; $k < strlen($password); $k++) { if(is_string($password{$k})) { $encnum += ord($password{$k}); } } if($encnum == 0) { die('Invlaid password!'); } $count = count($str); for($j = 0; $j < $count; $j++) { $encstr[] = chr($str[$j] / $encnum); } $return = implode('', $encstr); return $return;} I am not planning to use this encryptions system, and if you do, please dont sue me if someone decrypts all your data!kvarnerexpress Share this post Link to post Share on other sites
tuddy 0 Report post Posted October 18, 2005 Showing the source code also makes it just that little easier for people to 'conflict' with the code to break it. Are you asking people to break so you can make it better? or so you can see how ood your skills are? Share this post Link to post Share on other sites
arboc7 0 Report post Posted October 19, 2005 Your script looks pretty good...but I generally use a one-way hash (MD5 or the one built into MySQL) for all of my encrypting, but, then again, I never have to decrypt anything...I wonder if anyone will actually attempt to break your code/script.Good coding!! Share this post Link to post Share on other sites
Unregistered 015 0 Report post Posted October 19, 2005 I had a quick look at this code and dont have time for analysys. I can see it converts chars to coresponding nubmers after MD5, and back in decription (not sure tough). What do you actually want to know (since you already gave decryption algorithm)? Share this post Link to post Share on other sites
Spectre 0 Report post Posted October 20, 2005 It's primarily relying on MD5 to provide security, so really, it's not an 'encryption system' in itself. If you stripped out its reliance on MD5 and constructed your own hashing function, then maybe it could be titled as such. But anyway, it's simple enough, and still effective. It obviously works by adding up the ASCII character codes for the MD5 hash, then multiplying the character code for each character in the string by this value. This makes it quite difficult to reverse the method, and uncover the actual text without the password. Share this post Link to post Share on other sites
vitrus 0 Report post Posted October 20, 2005 Yes, if you want to encrypt a small piece of text (In php I was thinking about a personal (private) message or something.Than you have two excellent functions over here Share this post Link to post Share on other sites
farsiscript 0 Report post Posted October 13, 2006 nice code dear kvarnerexpressi need more info about 2 functions : amfrencrypt() and amfrdecrypt() i look at in php.net but i can understand this functions if you have tutorial or one good soruce like your soruce plz post here thanks all Share this post Link to post Share on other sites
electron 0 Report post Posted October 13, 2006 Well nice one but use sha1() function rather than MD5().But its a good one Share this post Link to post Share on other sites
Spectre 0 Report post Posted October 14, 2006 Wow, this thread is certainly old.farsiscript, what are you asking exactly? The functions are obviously custom, so they aren't going to be on PHP.net (or in many other locations)... you'll just have to get information on them by looking at the source code above. Share this post Link to post Share on other sites