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

jsf - "PropertyNotWritableException: Illegal Syntax for Set Operation" error when setting value in bean -

arrays - Algorithm to find ideal starting spot in a circle -

php - Autoloader issue not returning Class -