Skip to content

Add opt-in ignoreWhitespace flag for whitespace-tolerant decoding#24

Open
dipu-bd wants to merge 1 commit into
masterfrom
claude/issue-20-optimization-axb6r5
Open

Add opt-in ignoreWhitespace flag for whitespace-tolerant decoding#24
dipu-bd wants to merge 1 commit into
masterfrom
claude/issue-20-optimization-axb6r5

Conversation

@dipu-bd

@dipu-bd dipu-bd commented Jul 22, 2026

Copy link
Copy Markdown
Member

Real-world Base-64 (PEM, MIME) and hex dumps carry line feeds and
spaces, which the decoders reject. `AlphabetDecoder`, `Base32Decoder`,
and `Base64Decoder` now accept `ignoreWhitespace` (default false), and
`fromHex`, `fromBase32`, `fromBase64`, and their `tryFrom` counterparts
expose it as a parameter. Whitespace means tab, line feed, vertical tab,
form feed, carriage return, and space.

The strict path is unchanged and remains the default: the specialized
decoders compact the input into a typed buffer once before the existing
fast path, and the generic decoder tests for whitespace only inside its
invalid-character branches. Base-64 decode stays at ~2.8 Gbps (1MB)
before and after.

Closes #20

Co-Authored-By: Claude Fable 5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01UMYuGpP8mwt5yrCqqF68ET

@codecov-commenter

codecov-commenter commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

Files with missing lines Coverage Δ
lib/src/base16.dart 100.00% <100.00%> (ø)
lib/src/base32.dart 100.00% <100.00%> (ø)
lib/src/base64.dart 100.00% <100.00%> (ø)
lib/src/codecs/base32.dart 100.00% <100.00%> (ø)
lib/src/codecs/base64.dart 100.00% <100.00%> (ø)
lib/src/core/alphabet.dart 100.00% <100.00%> (ø)

Real-world Base-64 (PEM, MIME) and hex dumps carry line feeds and
spaces, which the decoders reject. `AlphabetDecoder`, `Base32Decoder`,
and `Base64Decoder` now accept `ignoreWhitespace` (default false), and
`fromHex`, `fromBase32`, `fromBase64`, and their `tryFrom` counterparts
expose it as a parameter. Whitespace means tab, line feed, vertical tab,
form feed, carriage return, and space.

The strict path is unchanged and remains the default: the specialized
decoders compact the input into a typed buffer once before the existing
fast path, and the generic decoder tests for whitespace only inside its
invalid-character branches. Base-64 decode stays at ~2.8 Gbps (1MB)
before and after.

Closes #20

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UMYuGpP8mwt5yrCqqF68ET
@dipu-bd
dipu-bd force-pushed the claude/issue-20-optimization-axb6r5 branch from c48f575 to aa0538b Compare July 22, 2026 22:32
@dipu-bd dipu-bd changed the title Add opt-in \ignoreWhitespace\ flag for whitespace-tolerant decoding Add opt-in ignoreWhitespace flag for whitespace-tolerant decoding Jul 23, 2026
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.

Whitespace-tolerant decode

3 participants