Appendix D

Base64 Encoding

Base64 encoding represents a 6-bit binary string using a printable character (see Table D.1), where a 6-bit value of 0–25 represents an upper-case letter A–Z correspondingly; a 6-bit value of 26–51 represents a lower-case letter a–z correspondingly; a 6-bit value of 52–61 represents a digit 0–9 correspondingly; and the last two 6-bit values of 62 and 63 represent “bapp04-math-0001” and “bapp04-math-0002”, respectively. Transmitted in ASCII format, this means that every 6-bit string is replaced with an 8-bit string.

Table D.1 Base64 encoding

6-bit value 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
character encoding A B C D E F G H I J K L M N O P Q R S T
6-bit value 20 21 22 23 24 25 26 27 28 29 31 31 32 33 34 35 36 37 38 39
character encoding U V W Z Y Z a b c d e f g h i j k l m n
6-bit value 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
character encoding o p q r s t u v w x y z 0 1 2 3 4 5 6 7
6-bit value 60 61 62 63
character encoding 8 9 + bapp04-math-0003

In addition, Base64 encoding uses character “=” as a special indicator. Using Base64 encoding, a binary string is converted to a character string as follows:

Case 1: The binary ...

Get Introduction to Network Security, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.