|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-09-27 09:55 UTC] martin at appware dot co dot uk
Description: ------------ cipher using php code to allow 2 way encryption currently it uses a predefined array of Char's it then loops though this and creates every cipher possible by shifting the first char to the end in a new array, and as it ciphers one letter the cipher moves forward on cipher it's using No my problem is that i have had to place a check in to make sure the cipher has finished if it has and the decrypted cipher is not the same as the original string rerun the cipher with the same string, Now this should not be needed, also this still creates error's This has been tested in php 5.3.1 and 5.3.3, The occurrence the same some times refreshing the system give a cipher that's to short for the string and this is with the check whats more annoying is that there is a check in the code to prevent this happening as it was happening more and more P.S now i got to re-random my cipher base as its useless one made public haha Test script: --------------- http://pastebin.com/r934gLpM inside encryptString you will see if($this->decryptString($encoded) === $string){ return $encoded; }else{ return $this->encryptString($string); } at the end it should not be possible for me to get a string thats dose not break back. Expected result: ---------------- The cipher to not occasionally return a string that is to short Actual result: -------------- Using the code above works but keep refreshing it and you will see you will get ciphers back that are 2 small a common one for me is "LX" on its own. this happens more and more with a bigger string in the $secure->encryptString PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Thu Jan 29 12:00:01 2026 UTC |
if($this->decryptString($encoded) === $string){ return $encoded; }else{ return $this->encryptString($string); } Sorry but learn to read How the hell dose the code above Return a string that dose not work, even though the Decryptor works perfectly as i did all the math and worked it out and tested. Add die("<pre>".print_r(array($string, $this->decryptString($encoded)))."</pre>"); above the code i pasted at the top of this message and watch it loop yet it will say it works then return a code that dose not work something is happening to the return cipher.