Skip to content

[CODEC-343] Fix Base32 hex decode table builder#435

Open
OldTruckDriver wants to merge 1 commit into
apache:masterfrom
OldTruckDriver:fix/CODEC-343_base32_hex_decode_table
Open

[CODEC-343] Fix Base32 hex decode table builder#435
OldTruckDriver wants to merge 1 commit into
apache:masterfrom
OldTruckDriver:fix/CODEC-343_base32_hex_decode_table

Conversation

@OldTruckDriver

Copy link
Copy Markdown

Summary

Fix Base32.Builder#setHexDecodeTable(boolean) so it configures the matching Base32/Base32-Hex encode table instead of passing a decode lookup table to setEncodeTable(byte...).

Details

The previous implementation passed decodeTable(useHex) into setEncodeTable(...). Used on its own, this made the codec encode with a decode lookup table and emit invalid bytes.

This change updates setHexDecodeTable(boolean) to use encodeTable(useHex) and adds a regression test proving the configured codec encodes with the Base32-Hex alphabet and decodes its own output.

Tests

  • mvn -q -Dtest=org.apache.commons.codec.binary.Base32Test test
  • mvn -q javadoc:javadoc
  • mvn -q

Configure setHexDecodeTable(boolean) with the matching encode table instead of passing a decode lookup table to setEncodeTable(byte...).

Add a regression test showing the configured codec encodes with the Base32-Hex alphabet and decodes its own output.

Reviewed-by: OpenAI Codex
Reviewed-by: Anthropic Claude Code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant