I need a way to encode a set of information in a way that the result would be as short as possible with a requirement of it being usable as part of URL string.

I don't really care that much about security, the encryption is applied mostly for the plain text to not be visible right away. At the same time, just encoding (like base64) is not enough, there needs to be at least minimal security, meaning I don't want someone to take the encoded string and decode it in 5 seconds with some online decoder :) Much more important than security is performance.

I've heard about Format-Preserving Encryption, it seems that it could be a good idea length-wise. However, would it be a good idea to also compress the string before encrypting it?

The text do encrypt/encode would look something like this: 3:dfsafdsfasd-d343dffdsf:20232233:20333421:a2c1,2:QLGHTYUDJD:Tables:23454545

  • $\begingroup$ Your requirement sounds similar to this, except they're signing/authenticating the URL. Since you said you "don't really care that much about security", I assume you mean you don't care much about the secrecy, but authentication may be a primary goal. $\endgroup$
    – DannyNiu
    Apr 27 at 7:10
  • $\begingroup$ Yes, I guess you are right $\endgroup$
    – mnj
    Apr 28 at 12:04
  • $\begingroup$ Would you like to close your question as a duplicate? $\endgroup$
    – DannyNiu
    Apr 28 at 12:15


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.