2 ms·
Why 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:
by bonzoesc 16y ago
Why 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.