A reversible encryption algorithm requires high requirements:
1. the encrypted length is the same as the encrypted length.
2. only letters from a to z and numbers from 0 to 9 are allowed in the encrypted string.
3. you can calculate it back based on the key.
The strings before encryption are also a combination of letters and numbers.
For example, the string before encryption: us3kqvu
Reply to discussion (solution)
You can try Caesar encryption and fence encryption, or use both methods.
Caesar password
$ Key = '3ae '; $ s = caesar_encode ('us3kqvu', $ key); echo "$ s \ n"; echo caesar_decode ($ s, $ key ); function caesar_encode ($ s, $ k) {$ k = "$ k"; for ($ I = 0; $ I
Ciphertext: ljubhml
Original article: us3kqvu
Caesar password
$ Key = '3ae '; $ s = caesar_encode ('us3kqvu', $ key); echo "$ s \ n"; echo caesar_decode ($ s, $ key ); function caesar_encode ($ s, $ k) {$ k = "$ k"; for ($ I = 0; $ I
Ciphertext: ljubhml
Original article: us3kqvu
Is there a high probability that this encryption/decryption method is repetitive?
The Caesar password is implemented by moving the sequence table ing. Theoretically, there is no possibility of repetition.
The so-called moving two-dimensional table ING is like
Original article abcd
Moving distance 4
Ciphertext efgh
One byte has 8 bits, and 6 bits can be 2 ^ 6 = 64, with a total of 62 letters and numbers
Therefore, a ing table can be compressed to six digits.
6-to 6-bit bitwise operations are much more. Ren Jun chooses, and then reversely maps to letters and numbers.
The above process is reversible.
Caesar encryption and fence encryption