Tool for coding with Base45 encoding, using 45 ASCII characters, which has become known since its use in the European green pass/certificate.

Base45 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*!

The **Base45** encoding consists in writing the data in **base 45** and using the following list of symbols `0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:` Which corresponds to the 45 characters that can be used in a QR-code in alphanumeric mode so the correspondance table

Index | CharacterBase45 |
---|---|

0 | 0 |

1 | 1 |

2 | 2 |

3 | 3 |

4 | 4 |

5 | 5 |

6 | 6 |

7 | 7 |

8 | 8 |

9 | 9 |

10 | A |

11 | B |

12 | C |

13 | D |

14 | E |

15 | F |

16 | G |

17 | H |

18 | I |

19 | J |

20 | K |

21 | L |

22 | M |

23 | N |

24 | O |

25 | P |

26 | Q |

27 | R |

28 | S |

29 | T |

30 | U |

31 | V |

32 | W |

33 | X |

34 | Y |

35 | Z |

36 | |

37 | $ |

38 | % |

39 | * |

40 | + |

41 | - |

42 | . |

43 | / |

44 | : |

Encoding begins by cutting the data to be encoded from left to right in groups of 2 bytes. If the data has an odd number of bytes, the last group is 1 byte in size.

__Example:__ Encode the 3 characters `B45`, of ASCII code `[66,52,53]`, which are then split `[66,52],[53]`

Each pair of 2 bytes $ [a, b] $ is interpreted as a number in base $ 256 $ such that $ n = (a \times 256) + b $ (in base 10) which can then be converted into **base 45** via a triple $ [c,d,e] $ such that $ n = c + (d \times 45) + (e \times 45^2) $. The characters in the correspondence table for the values '[c, d, e]' are noted (in that order) as encoded text.

Any last single byte $ a $ at the end of the data is also interpreted as a number in base 256 and converted to a pair $ [b,c] $ such that $ a = b + (45 \times c) $. The characters in the correspondence table for the values `[b,c]` are noted (in that order) as encoded text.

__Example:__ The couple `[66,52]` corresponds to the number 66 * 256 + 52 = 16948 and 16948 = 28 + 16 * 45 + 8 * 45 ^ 2, so the triplet [28,16,8] that is equivalent to the characters `S,G,8` in **base45**

The remaining byte `[53]` is written in **base 45** as follows: 53 = 1 * 45 + 8, either the pair [1,8] or the characters `1,8` in **base45**. The full encoding of `B45` in **base45** is `SG881`

For any string written in **Base45**, start by converting the characters into numeric values (according to the correspondence table).

__Example:__ Decode `SG881`, or the values `[28,16,8,8,1]`

Divide the values into groups of 3, from left to right. If the last group of 3 is not complete, add zeros `0` at the end.

__Example:__ `[28,16,8,8,1]` splits as `[28,16,8],[8,1,0]`

Interpret each group `[c,d,e]` as a number in **base 45** as follows: $ n = c + (d \times 45) + (e \times 45^2) $ and note the values $ n $ obtained

__Example:__ `[28,16,8],[8,1,0]` is converted to `[16948],[53]`

Convert each number to base 256 (so in bytes)

__Example:__ 16948 = 66 * 256 + 52 or `[66,52]` and 53 remains `[53]` in base 256

The decoded message is the set of bytes. It can be interpreted in ASCII code (or Unicode)

__Example:__ `[66,52,53]` for the 3 ASCII characters `B,4,5` (plaintext)

**Base-45** uses the 36 uppercase alphanumeric characters `0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ` completed with the characters ` ` (space)', `$` (dollar), `%` (percent), `*` (asterisk), `+` (plus), `-` (minus/dash), `.` (period), `/` (slash) and `:` (colon).

**Base-45** is optimized to transmit data with the alphanumeric mode of QR-codes.

It has been used in COVID-19 vaccines certificates and European Union green passes.

dCode retains ownership of the online "Base45 Encoding" source code. Except explicit open source licence (indicated CC / Creative Commons / free), the "Base45 Encoding" algorithm, the applet or snippet (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, translator), or the "Base45 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, copy-paste, or API access for "Base45 Encoding" are not public, same for offline use on PC, tablet, iPhone or Android ! Remainder : dCode is free to use.

Please, check our dCode Discord community for help requests!

NB: for encrypted messages, test our automatic cipher identifier!

base45,base,45,b45,encoding,code,qr,pass,covid,european

Source : https://www.dcode.fr/base45-encoding

© 2021 dCode — The ultimate 'toolkit' to solve every games / riddles / geocaching / CTF.

Feedback

▲
Thanks to your feedback and relevant comments, dCode has developed the best 'Base45 Encoding' tool, so feel free to write! Thank you!