Skip to content

Prepare 3.6.0: new APIs, small fixes, compacted changelog, version bump#12

Merged
dipu-bd merged 10 commits into
masterfrom
claude/isequal-and-docs
Jul 22, 2026
Merged

Prepare 3.6.0: new APIs, small fixes, compacted changelog, version bump#12
dipu-bd merged 10 commits into
masterfrom
claude/isequal-and-docs

Conversation

@dipu-bd

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

Copy link
Copy Markdown
Member

Completes the 3.6.0 release on top of master (after #11 merged). Verified: dart analyze --fatal-infos clean (incl. public_member_api_docs → 100% dartdoc), dart test green on vm and node (663 / 658), integration smoke test OK, 100% line coverage on lib/ (943/943).

New API (additive)

  • constantTimeEquals(a, b) — top-level constant-time byte compare, so hashlib/cipherlib can verify MACs on raw List<int> without wrapping in a ByteCollector.
  • toHexBytes / toBinaryBytes / toOctalBytes / toBase32Bytes / toBase64Bytes — return the encoded ASCII output as a Uint8List, skipping the String. The to<X> functions delegate to these, so their output is unchanged.
  • tryFromHex / tryFromBinary / tryFromOctal / tryFromBase32 / tryFromBase64 / tryFromUtf8 / tryFromBigInt — non-throwing decoders returning null on invalid input.

Fixes

  • ByteCollector.isEqual returns false for an invalid-hex String instead of throwing (contract violation on a security-sensitive path).
  • CryptData == treats a null and an empty params map as equal (they encode identically and already shared a hashCode).
  • Clarify the crypt decoder dartdoc on bcrypt / MCF field mapping.
  • Reword the decode error Invalid lengthInvalid length or non-zero trailing bits (also covers valid-length input with non-zero padding bits).
  • Document the target <= 8 limit on the exported BitEncoder/BitDecoder.

Release prep

  • Version → 3.6.0 (minor: adds exported base classes). pubspec.yaml bumped to match the changelog heading.
  • Two breaking changes flagged under **Breaking Changes**: CipherlibConverterBitConverter and the BigIntDecoder typedef narrowing.
  • Compacted changelog: dropped internal/tooling-only bullets.
  • AGENTS.md: PR bodies omit the "Generated with Claude Code" footer.

Not done here (your call): tagging v3.6.0 and publishing. Merge this, then tag master.

API-hygiene note (unchanged)

CipherlibConverter/BitConverter has now been renamed twice while exported — decide whether these converter base classes are public API or should stop being exported.

claude added 3 commits July 22, 2026 16:18
…hrowing

`isEqual` decodes a `String` argument as hexadecimal via `fromHex`, which throws
a `FormatException` on malformed input. The dartdoc promises `false` for
unsupported input and the method is meant to be safe for comparing digests and
MACs against untrusted data, so `isEqual("zz")` throwing was a contract
violation. Catch the `FormatException` and return `false`.

Adds a regression test covering non-hex, odd-length, and trailing-non-hex
strings.
Rename the unreleased section to `3.6.0` (a minor: it adds the exported
`ByteEncoder`/`ByteDecoder`/`AlphabetEncoder`/`AlphabetDecoder` base classes) and
flag the two incompatible changes under `**Breaking Changes**`: the
`CipherlibConverter` -> `BitConverter` rename and the `BigIntDecoder` typedef
narrowing. Drop internal/tooling-only bullets (benchmark files, harness tweak,
test additions, file moves, dartdoc, param-type tightening) that do not belong
in a user-facing changelog. Bump `pubspec.yaml` to 3.6.0 to match the heading.
@dipu-bd
dipu-bd force-pushed the claude/isequal-and-docs branch from 51d6c85 to d10e11b Compare July 22, 2026 16:18
@dipu-bd dipu-bd changed the title Return false from ByteCollector.isEqual on invalid hex; fold changelog; PR-footer convention Prepare 3.6.0: isEqual invalid-hex fix, compacted changelog, version bump Jul 22, 2026
@dipu-bd
dipu-bd changed the base branch from claude/last-2-commits-afvxbf to master July 22, 2026 16:18
claude added 4 commits July 22, 2026 16:42
Add `toHexBytes`, `toBinaryBytes`, `toOctalBytes`, `toBase32Bytes`, and
`toBase64Bytes` returning the encoded ASCII output as a `Uint8List` without the
intermediate `String`; the existing `to<X>` functions now delegate to them so
output is unchanged. Add `tryFromHex`, `tryFromBinary`, `tryFromOctal`,
`tryFromBase32`, `tryFromBase64`, `tryFromUtf8`, and `tryFromBigInt`, which
return `null` instead of throwing a `FormatException` on invalid input.
- `CryptData ==` now treats a null and an empty `params` map as equal (both
  encode to the same string and already share a hashCode).
- Clarify the crypt decoder dartdoc on how bcrypt / Modular Crypt Format strings
  map onto the PHC salt/hash fields.
- Reword the decode `FormatException` from `Invalid length` to
  `Invalid length or non-zero trailing bits`, which also covers a valid-length
  input whose trailing padding bits are non-zero.
- Document that the generic `BitEncoder`/`BitDecoder` require `target <= 8`
  because the regrouped words are returned in a byte list.
@dipu-bd dipu-bd changed the title Prepare 3.6.0: isEqual invalid-hex fix, compacted changelog, version bump Prepare 3.6.0: new APIs, small fixes, compacted changelog, version bump Jul 22, 2026
Comment thread lib/src/base16.dart Outdated
Comment thread lib/src/base2.dart Outdated
Comment thread lib/src/base32.dart Outdated
Comment thread lib/src/base64.dart Outdated
Comment thread lib/src/base8.dart Outdated
Comment thread lib/src/constant_time.dart
Comment thread lib/src/bytes_collector.dart Outdated
Comment thread lib/src/bytes_collector.dart
claude and others added 3 commits July 22, 2026 17:00
Per review: an extra function call on the hot encode path is costly in Dart.
The `to<X>Bytes` variants keep their own implementation; output is unchanged.
Per review: the String branch now decodes via `tryFromHex` (null on invalid),
and the `Iterable<int>` branch delegates to `constantTimeEquals`. Also drop the
`identical` shortcut in `constantTimeEquals` so the length check is its only
early return, which branches on the public length, not the contents.
Comment thread test/constant_time_test.dart
@dipu-bd
dipu-bd merged commit a6e28df into master Jul 22, 2026
18 checks passed
@dipu-bd
dipu-bd deleted the claude/isequal-and-docs branch July 22, 2026 17:32
@codecov-commenter

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/base2.dart 100.00% <100.00%> (ø)
lib/src/base32.dart 100.00% <100.00%> (ø)
lib/src/base64.dart 100.00% <100.00%> (ø)
lib/src/base8.dart 100.00% <100.00%> (ø)
lib/src/bigint.dart 100.00% <100.00%> (ø)
lib/src/bytes_collector.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/codecs/crypt/crypt_codec.dart 100.00% <ø> (ø)
... and 5 more

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.

3 participants