Requirements:
1. The length of the encryption is as long as the length before encryption
2. Only letters from A to Z and numbers 0 to 9 are allowed in the encrypted string
3. According to the secret key can be counted back
The string before encryption is also a combination of letters and numbers
such as the string before encryption: Us3kqvu
Reply to discussion (solution)
You can try Caesar encryption and fence encryption, or use both of these 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: 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: Us3kqvu
is there a large probability of the repetition of this encryption and decryption method
Caesar password is implemented by moving character Map mappings, there is no possibility of duplication in theory
so-called mobile Character Map mapping is like
original ABCD
Move distance 4
Ciphertext efgh
One byte has 8 bits, 6 bits has 2^6=64 Possible, the letter + number Total 62
So there is a mapping table can be compressed into 6 bits
6 bit to 6 bits of the bit operation is more, any choice, and then reverse mapping to alphanumeric
The process above is reversible
Caesar encryption and fence encryption