php - Crypt int into 4-char String -


i'd crypt int 7'000'000 4-char string , decrypt back.

any idea on how can easy achieved php?

clarification

i want create unique slug each wordpress user based on user id length of 4 chars.

example.com/rdfy

log2(7,000,000) = 22.7 or < 3 full bytes. make value 4-byte integer , cast 4-byte array , base64 encode least significant 3 bytes 4-bytes, encoding, not encryption may suffice.

if need encryption encrypt byte array using substitution cipher, sure not strong encryption.


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -