4 ms·
PHP's modulus operator is broken for larger values. http://php.net/manual/en/language.operators.arithmetic.php#99112 http://php.net/manual/en/language.operators
by KevBurnsJr 16y ago
PHP's modulus operator is broken for larger values.
http://php.net/manual/en/language.operators.arithmetic.php#99112 http://php.net/manual/en/language.operators.arithmetic.php#9...
True about consecutive hash calculation. Notedly it's for obfuscation, not encryption.
- bonzoesc 16y agoWhy not just use an algorithm that is less than 2,000 years old, such as AES (usable through the http://us3.php.net/manual/en/function.openssl-encrypt.php http://us3.php.net/manual/en/function.openssl-encrypt.php API): > openssl_encrypt('asdf', 'aes-256-cfb', 'a password', false, 'initialization v'); returns: 4kavvg== You get the same direct mapping of inputs to outputs but you don't have to re-invent affine ciphers and make guesses about its security properties. And since you're just using it to turn a small integer into something bigger to make clients/users happy and not to protect data, Mr. Ptacek won't flame you out.
- KevBurnsJr 16y agoThat might also be a good solution, particularly if reversibility is necessary.