ios--Algorithm--BASE64 Chapter

Source: Internet
Author: User
Tags base64

As a common standard of string transcoding in various languages, Base64 is loved by programmers.


To introduce: The BASE64 encoding requires 3 8-bit bytes (3*8=24) to be converted to 4 6-bit bytes (4*6=24), followed by 6-bit two, to form 0-bit bytes. If the remaining characters are less than 3 bytes, then the 0 padding, the output character using ' = ', so the text output after encoding may appear 1 or 2 ' = '


In order to ensure the output of the encoded bit readable characters, BASE64 developed a coding table for unified conversion. The size of the encoded table is 2^6=64, which is also the origin of the Base64 name.


Base64 Coding Table

Code Value character Code Value character Code Value character Code Value character
0 A 16 Q 32 G 48 W
1 B 17 R 33 H 49 X
2 C 18 S 34 I 50 Y
3 D 19 T 35 J 51 Z
4 E 20 U 36 K 52 0
5 F 21st V 37 L 53 1
6 G 22 W 38 M 54 2
7 H 23 X 39 N 55 3
8 I 24 Y 40 O 56 4
9 J 25 Z 41 P 57 5
10 K 26 A 42 Q 58 6
11 L 27 B 43 R 59 7
12 M 28 C 44 S 60 8
13 N 29 D 45 T 61 9
14 O 30 E 46 U 62 +
P to
Related Article

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.