This is a creation in Article, where the information may have evolved or changed.
Previous research and analysis of URL compression (continued) introduced the BASE62 algorithm, a hash algorithm similar to Base64. Today found another optimization of the Base64 algorithm, and reference to the next Golang source, in the encoding/base64/base64.go
inside.
const encodeStd = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
The traditional Base64 is a-Z, A-Z, 0-9, plus + and/, a 64-coded string.
However, the standard Base64 is not suitable for direct transmission in the URL, because the URL encoder will be in the standard Base64 "/" and "+" characters into the form of "%XX", and these "%" number in the database will need to be converted, because ANSI SQL has the "%" Used as a wildcard character.
To solve this problem, a modified Base64 encoding for URLs is used, which does not populate the ' = ' at the end, and the "+" and "/" in standard Base64 are changed to "-" and "_" respectively, thus eliminating the conversion required for URL codec and database storage. Avoids the increase in the length of encoded information in this process, and unifies the format of object identifiers in databases, forms, and so on.
The Base64.go file also defines a Base64 algorithm dedicated to URL security in URLs.
const encodeURL = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"
Replaced the previous plus sign with a minus sign, and the slash was underlined.
For this reason, I found that one of my coding results and should get only one bit, one is a plus, one is a minus. Because if the code string different reasons, even if it is a difference, the result is completely different, poor one certainly not because of this. The original is so, understand or too little ...
###### References + Base64-wikipedia
Original link: Security URL Base64 Encoding, reproduced please specify the source!