Requires support for Chinese characters (non-rigid requirements), alphanumeric, decimal, etc., the encrypted string consists of numbers and characters, preferably encrypted and before the length of the encryption
such as the "Www.qq.com" string before encryption
Reply to discussion (solution)
The same can be considered the replacement algorithm, the simplest, the substitution rules can be defined by themselves,
The same can be considered the replacement algorithm, the simplest of the substitution rules can be defined by themselves, there is code
If you don't think about Chinese characters, just use Caesar to encrypt it.
$s = ' www.qq.com~ '; $k = 13;//encryption for ($i =0; $i
126) $n = ($n + +) & 0x7f; $s {$i} = Chr ($n);} Echo $s, php_eol; $$$;~~;p |z+//decryption for ($i =0; $i
If you don't think about Chinese characters, just use Caesar to encrypt it.
$s = ' www.qq.com~ '; $k = 13;//encryption for ($i =0; $i
126) $n = ($n + +) & 0x7f; $s {$i} = Chr ($n);} Echo $s, php_eol; $$$;~~;p |z+//decryption for ($i =0; $i
This method is good, but did not meet my requirements, that is, the encrypted string can only have numbers, letters
If you don't think about Chinese characters, just use Caesar to encrypt it.
$s = ' www.qq.com~ '; $k = 13;//encryption for ($i =0; $i
126) $n = ($n + +) & 0x7f; $s {$i} = Chr ($n);} Echo $s, php_eol; $$$;~~;p |z+//decryption for ($i =0; $i
Like ' abcdefghijklmnopqrstuvwxyz1234567890_-. ' After the string is encrypted, it can only be made up of strings and numbers 、-、 _, and the decimal point is converted to other
If I'm not mistaken, your request is, "the encrypted string is made up of numbers and characters."
I don't know what the character is.
Put a character beyond the alphanumeric range to be an alphanumeric representation, or change the length
"Put the elephant in the freezer" is just a joke, you are serious?
Generate string only alphanumeric words, according to your red letter part of the conditions, it is impossible to achieve the blue character requirements
Requires support for Chinese characters (non-rigid requirements), alphanumeric, decimal, etc., the encrypted string consists of numbers and characters, preferably encrypted and before the length of the encryption
such as the "Www.qq.com" string before encryption
Put a character beyond the alphanumeric range to be an alphanumeric representation, or change the length
"Put the elephant in the freezer" is just a joke, you are serious?
Base64 will not be able to "abcdefghijklmnopqrstuvwxyz1234567890_-." Converted to pure numbers and letters? Even if it's a little bit longer, it's just that it feels base64 too long.
Generate string only alphanumeric words, according to your red letter part of the conditions, it is impossible to achieve the blue character requirements
Requires support for Chinese characters (non-rigid requirements), alphanumeric, decimal, etc., the encrypted string consists of numbers and characters, preferably encrypted and before the length of the encryption
such as the "Www.qq.com" string before encryption
It can be a little longer.
You know the bit knowledge of the byte base64 is the limit of visual non-compression encryption
If you want to shorten it, you can use a compression algorithm.
Put a character beyond the alphanumeric range to be an alphanumeric representation, or change the length
"Put the elephant in the freezer" is just a joke, you are serious?
Base64 will not be able to "abcdefghijklmnopqrstuvwxyz1234567890_-." Converted to pure numbers and letters? Even if it's a little bit longer, it's just that it feels base64 too long.
A byte can only represent 256 states
All compression algorithms store consecutive identical fragments in the form of: Count + Fragment
So compression doesn't always reduce the size of the
Base64 converted also with/and =
To be replaced with-_
But Base64 can convert any data, such as Chinese characters, every 3 characters 4, 1/3 longer. It is estimated that the landlord is too wasteful.
It should be changed to convert only the specified characters.
At least be able to convert a-za-z0-9-_. A total of 65 legal characters.
And the output cannot take a point. A total of 64 legal characters, in theory, will grow at least 1/64.
Base64 converted also with/and =
To be replaced with-_
But Base64 can convert any data, such as Chinese characters, every 3 characters 4, 1/3 longer. It is estimated that the landlord is too wasteful.
It should be changed to convert only the specified characters.
At least be able to convert a-za-z0-9-_. A total of 65 legal characters.
And the output cannot take a point. A total of 64 legal characters, in theory, will grow at least 1/64. Theoretically, 1/64 can also be used to find algorithms
The shift algorithm can achieve