Tool to decode/encode with ASCII85 (or Base85) is a coding system similar to base64, using 5 ASCII characters to code 4 bytes. ASCII 85 encoding is used in PDF file format for example.
ASCII85 Encoding - dCode
Tag(s) : Character Encoding
dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!
Encryption uses the binary code of the text (which depend on the encoding used: ASCII, Unicode, etc.)
Example: The message DCODE is encoded 01000100 01000011 01001111 01000100 01000101 (ASCII 8-bit encoding)
The binary string is then split every 32 bits (4 bytes)
Example: 01000100010000110100111101000100 (base2) = 1145261892 (base10) and 01000101000000000000000000000000 (base2) = 1157627904 (base10) (filled with 3 null characters = 24 times 0 to get 32 bits)
Numbers obtained are then converted to base 85.
Example: 1145261892 (base10) = [21,79,73,64,27] (base85) and 1157627904 (base10) = [22,15,0,26,69] (base85)
Each value in base 85 is replaced by an ASCII character of code (value+33)
Example: 21 => ASCII(54) = 6, 79 => ASCII(112) = p, 76 => ASCII(106) = j etc. thus the encrypted message is 6pja<70
There could be some final null characters ASCII(0), that can be deleted (it corresponds to the previously added null characters)
The decryption start by splitting the text into groups of 5 characters (if the tuple is not 5-character long, it is filled with u)
Example: The message 6pja<70 is split into 6pja< and 70 (that is treated as 70uuu)
For each group of 5 characters, get the ASCII code and subtract 33.
Example: 6pja< = 54,112,106,97,60 (ASCII codes), -33 => 21,79,73,64,27
Example: 70uuu = 55,48,117,117,117 (ASCII codes), -33 => 22,15,84,84,84
Every tuple of 5 numbers is then considered as a unique number written in base 85, and converted to base 2.
Example: [21,79,73,64,27] (base85) = 01000100010000110100111101000100 (base2)
Example: [22,15,84,84,84] (base85) = 01000101000010010101011000000101 (base2)
The plain text is then this binary code encoded with initial encoding (ASCII, Unicode, etc.), n last characters are ignored when n characters have been added in initial completion step.
Example: 01000100 01000011 01001111 01000100 01000101 (00001001 01010110 00000101) = DCODE (ASCII 8bit encoding).
The encoding table used by ASCII-85 is the ASCII table (starting at the first printable character)
Index | Asc85 | Index | Asc85 | Index | Asc85 | Index | Asc85 | Index | Asc85 |
---|---|---|---|---|---|---|---|---|---|
0 | ! | 1 | " | 2 | # | 3 | $ | 4 | % |
5 | & | 6 | ' | 7 | ( | 8 | ) | 9 | * |
10 | + | 11 | , | 12 | - | 13 | . | 14 | / |
15 | 0 | 16 | 1 | 17 | 2 | 18 | 3 | 19 | 4 |
20 | 5 | 21 | 6 | 22 | 7 | 23 | 8 | 24 | 9 |
25 | : | 26 | ; | 27 | < | 28 | = | 29 | > |
30 | ? | 31 | @ | 32 | A | 33 | B | 34 | C |
35 | D | 36 | E | 37 | F | 38 | G | 39 | H |
40 | I | 41 | J | 42 | K | 43 | L | 44 | M |
45 | N | 46 | O | 47 | P | 48 | Q | 49 | R |
50 | S | 51 | T | 52 | U | 53 | V | 54 | W |
55 | X | 56 | Y | 57 | Z | 58 | [ | 59 | \ |
60 | ] | 61 | ^ | 62 | _ | 63 | ` | 64 | a |
65 | b | 66 | c | 67 | d | 68 | e | 69 | f |
70 | g | 71 | h | 72 | i | 73 | j | 74 | k |
75 | l | 76 | m | 77 | n | 78 | o | 79 | p |
80 | q | 81 | r | 82 | s | 83 | t | 84 | u |
With the variant IPv6, the alphabet used is 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!#$%&()*+-;<=>?@^_`{|}~
With the variant ZeroMQ, the alphabet used is 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-:+=^!/*?&<>()[]{}@%$#
The message uses only ASCII characters of codes 33 (!) to 117 (u) with sometimes spaces, carriage return, but also sometimes characters y and z.
The message begins with <~ and ends with ~> (variant Adobe)
the message begins with xbtoa Begin and ends with xbtoa End (variant BTOA)
With IPv6 or ZeroMQ variants the characters are different (but there is no prefix)
Adobe Base85 is used in PDF files, it begins with <~ and ends with ~> and authorizes z exception.
In order to store shorter IPv6s, RFC 1924 proposed a compact representation using the mathematical base 85 and the symbols 0–9, A–Z, a–z, !#$%&()*+-;<=>?@^_`{|}~.
This page only reuses this alphabet and ASCII85 does not allow IPv6 encoding as provided by the RFC.
ZeroMQ is a messaging tool that uses Base85 in a function named zmq_z85_encode(), the 85 symbols used are: 0-9, a-z, A-Z, .-:+=^!/*?&<>()[]{}@%$#
ZeroMQ's conversion function is different from ASCII85, this page only uses the alphabet.
The character z is used (even if it is not in the character list) to indicate a group of 0, this trick allows reducing the size of the message. (used in Adobe and BTOA variants)
The character y is used to indicate a group of spaces. (not compatible with Adobe)
ASCII85 code was created around 1990 by Paul E. Rutter.
dCode retains ownership of the "ASCII85 Encoding" source code. Except explicit open source licence (indicated Creative Commons / free), the "ASCII85 Encoding" algorithm, the applet or snippet (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or the "ASCII85 Encoding" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) and all data download, script, or API access for "ASCII85 Encoding" are not public, same for offline use on PC, mobile, tablet, iPhone or Android app!
Reminder : dCode is free to use.
The copy-paste of the page "ASCII85 Encoding" or any of its results, is allowed (even for commercial purposes) as long as you credit dCode!
Exporting results as a .csv or .txt file is free by clicking on the export icon
Cite as source (bibliography):
ASCII85 Encoding on dCode.fr [online website], retrieved on 2024-12-19,