Skip to content

Refactor: refactor base encodings for consistency, correctness, and deduplication#10

Merged
Xor-el merged 1 commit into
masterfrom
refactoring/enhancements
Mar 19, 2026
Merged

Refactor: refactor base encodings for consistency, correctness, and deduplication#10
Xor-el merged 1 commit into
masterfrom
refactoring/enhancements

Conversation

@Xor-el
Copy link
Copy Markdown
Owner

@Xor-el Xor-el commented Mar 19, 2026

Comprehensive refactoring of all base encoding implementations (Base2, Base8, Base16, Base32, Base45, Base64, Base85, MoneroBase58, DividingCoder, Multibase).

  • Made Base64 TryEncode/TryDecode allocation-free with two-layer architecture
  • Added static Internal safe-count methods to Base64, matching other bases
  • Replaced shr on signed types with TBitOperations.Asr32/Asr64 for cross-platform correctness
  • Abstracted reverse lookup access into shared TCodingAlphabet.TryLookup
  • Unified decode success path to System.Copy trim pattern across all bases
  • Added upfront buffer validation and empty-input guards to all Try* methods
  • Deduplicated TBits.PartialBigEndianBytesToUInt64 (MoneroBase58 now uses it)
  • Removed redundant Base16Alphabet.MapCounterparts and Multibase helper
  • Standardized error messages, exception types, and System-qualified calls
  • Various minor fixes: comment typos, bounds guards, empty-result guards

Comprehensive refactoring of all base encoding implementations (Base2, Base8,
Base16, Base32, Base45, Base64, Base85, MoneroBase58, DividingCoder, Multibase).

- Made Base64 TryEncode/TryDecode allocation-free with two-layer architecture
- Added static Internal safe-count methods to Base64, matching other bases
- Replaced shr on signed types with TBitOperations.Asr32/Asr64 for
  cross-platform correctness
- Abstracted reverse lookup access into shared TCodingAlphabet.TryLookup
- Unified decode success path to System.Copy trim pattern across all bases
- Added upfront buffer validation and empty-input guards to all Try* methods
- Deduplicated TBits.PartialBigEndianBytesToUInt64 (MoneroBase58 now uses it)
- Removed redundant Base16Alphabet.MapCounterparts and Multibase helper
- Standardized error messages, exception types, and System-qualified calls
- Various minor fixes: comment typos, bounds guards, empty-result guards
@Xor-el Xor-el merged commit 66650df into master Mar 19, 2026
@Xor-el Xor-el deleted the refactoring/enhancements branch March 28, 2026 19:54
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