How does php encrypt a number? after encryption, it is still a number. for example, how does php encrypt a number in the url of Zhihu or segmentfault? after encryption, it is still a number, similar to the number in the url of Zhihu or segmentfault.
Reply content:
How to encrypt a number in php? after encryption, it is still a number, similar to the number in the url of Zhihu or segmentfault.
This urlencode is not strictly encrypted, but only encoded. for example, if the space ascii is 32 and the hexadecimal value is 20, it is % 20 (the function will convert it to + ), numbers and letters are not processed.
I think you can use regular expressions to process strings cyclically. in addition to not processing numbers, other functions can be divided into segments and encrypted using symmetric encryption. decryption can also be implemented.
Simply add numbers to salt for md5
Md5 ($ id. $ salt)
Convert the first N bits to the 10-digit system (the md5 result is equivalent to the 36-digit number), and then extract the first N bits.
Then, confuse the above result with the original id according to certain rules.
If it is not enough, you can convert the id into an octal format and try again.
The password_hash () function is commonly used for php form data encryption. let's take a look at the document.
Thank you for your invitation. You can directly useMd5
Echo md5 (1, 123456 );
You can use sprintf to format the encoding.