Coding and decoding method of Base64

Source: Internet
Author: User
Tags base64 mail

Base64 is a very common encoding method that allows you to encode any binary character into 64 characters that can be printed, so that both the picture and the Chinese text can be encoded as plain text with only ASCII. As for why to do this conversion, mainly used in the email field, the early mail gateway to identify only ASCII, if found that there are other characters in the mail will be filtered out, so that Chinese mail, there are pictures attached to the mail in these nets will have problems, So the Chinese and pictures are used base64 encoding and then transmitted, and then decoded after receiving the question of customer service. Base64 can be used in a similar situation, but can also be used as a simple encryption and so on. The following Base64 methods are described below:

The first is all the characters that may appear in the Base64:

0 A R i wuyi Z

1 B S/J 52 0

2 C T k 53 1

3 D U L 54 2

4 E V M 55 3

5 F W 56 4

6 G X o 57 5

7 H Y P 58 6

8 I Z Q 59 7

9 J/R 60 8

K-B 61 9

One L C T 62 +

M d/U 63/

N e V

F W (PAD) =

P g x

Q-H y

All characters are ' a ' ~ ' Z ', ' a ' ~ ' z ', ' 0 ' ~ ' 9 ', ' + ', '/' a total of 64, and the padding character at the end ' = '

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.