gchq / CyberChef

The Cyber Swiss Army Knife - a web app for encryption, encoding, compression and data analysis
https://gchq.github.io/CyberChef
Apache License 2.0
28.48k stars 3.2k forks source link

Bug report: "From Base45" cannot decode some result of "To Base45" #1351

Closed mikecat closed 2 years ago

mikecat commented 2 years ago

Describe the bug

There is some input that "From Base45" cannot convert back to the original input after encoding via "To Base45".

Instead of successfully decoding, message "Triplet too large" appears.

To Reproduce

From Hex, To Base45, From Base45, To Hex - CyberChef

Example input (first part of deflated data I dealed with):

8d 54 cb 6e c2 30 10 bc fb 2b 72 0c 12 92 b3 4e 02 c1 37 3b 54

Result of "To Base45":

0*HDWPWOO952*XV IETF22UMUF9:6*1

Message from "From Base45":

Triplet too large: '*6:'

Expected behaviour

Results of "To Base45" for any input should be converted back to the original input via "From Base45" with the same Alphabet.

Screenshots

cyberchef-error-20220513

Desktop (if relevant, please complete the following information):

Additional context

Information on "REPORT A BUG":

mikecat commented 2 years ago
8d 54 cb 6e c2 30 10 bc fb 2b 72 0c 12 92 b3 4e 02 c1 37 3b 54

is encoded to

0*HDWPWOO952*XV IETF22UMUF09:6*1

on

Base45 Encoding - Online Decoder, Encoder, Solver, Translator

This result of encoding is successfully decoded on CyberChef.

It looks like an error in "To Base45": F09:6 in the correct encoding becomes F9:6 (0 is missing) in the CyberChef result.

mikecat commented 2 years ago

Simpler example:

00 00

is encoded to 000 on dCode, but encoded to 00 on CyberChef.