gchq / gchq/CyberChef

Bug report: Unpadded Base32 Decode Fails

Open
#2,079 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
35.8k
Forks
4.1k
Avg merge
2d 26m
Merged PRs (30d)
33

Description

**Describe the bug**
When decoding unpadded base32, if the base32 decode alphabet does not have a padding character decoding will return a "Data is not a valid byteArray" error.

**To Reproduce**

https://gchq.github.io/CyberChef/#recipe=To_Base32('0-9A-V')From_Base32('0-9A-V',true)&input=MQ

**Expected behaviour**
Decode output will contain 1

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

* Version: 10.19.4
* Compile time: 16/07/2025 07:23:08 UTC
* User-Agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:140.0) Gecko/20100101 Firefox/140.0
* [Link to reproduce](https://gchq.github.io/CyberChef/#recipe=To_Base32('0-9A-V')From_Base32('0-9A-V',true)&input=MQ)

**Additional context**
Decoding works if an `=` is appended to the decode alphabet, it doesn't seem to work for other characters on an unpadded base32 output.

Contributor guide

Open the contributing guide

Research direction

Start by running the linked CyberChef recipe with the `0-9A-V` alphabet and unpadded input `MQ` to reproduce the invalid byteArray error. Compare this with the documented expected output of `1` and the case where `=` is included in the alphabet; done means unpadded Base32 decoding produces the expected output without requiring a padding character.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.