What is the quickest and best performance way to turn a string into a string of numbers and/or letters, then reverse engineer to the original string. Similar to turning a string into it's hash code, but that's a one-way conversion. I need a two-way method. I'm creating a simple url shorting service and I don't want to deal with a database.
I considered MD5 encrypting/decrypting via a private key, but I imagine there's another way that might be better on performance.
If encrypting/decrypting is the way to go, then which is the easiest on the processor?
Thanks!
When you encrypt you don't shorten anything. The cipher text is roughly the same length as the clear text. However, if you use a cryptographic hash you shorten the string to the length of hash. The drawback is that you are no longer able to reverse the hash back to the original string. I don't think you will be able to create a URL shortener using neither an encryption algorithm nor a cryptographic hash function. If that was possible to you could achieve infinite or at least very high compression of information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With