feat: Replace external crock32 dependency with standard library implementation#6
Merged
jackspirou merged 1 commit intomasterfrom Jul 6, 2025
Merged
Conversation
Codecov ReportAttention: Patch coverage is
🚀 New features to boost your workflow:
|
…mentation - Implement Crockford Base32 encoding using Go's standard library - Remove dependency on github.com/richardlehane/crock32 - Add optimized encoding/decoding with fixed-size buffers and lookup tables - Update golang.org/x/crypto to v0.35.0 (fixes CVE-2025-22869) - Improve test coverage to 95.8% - Add constant-time behavior tests - Update documentation and benchmarks Performance results: - BenchmarkEncode: 136.5 ns/op (vs 817.5 ns/op initial) - BenchmarkDecode: 282.4 ns/op (vs 471.5 ns/op initial) - Comparable to original external library performance Closes #5 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
073042b to
e569b7b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
encoding/base32packagegithub.com/richardlehane/crock32Motivation
Addresses #5 - The suggestion to use the standard library for Base32 encoding reduces external dependencies and provides a more maintainable solution.
Changes
Added custom crock32 implementation (
crockford.go):crock32Encode/crock32Decodefunctions that maintain backward compatibilityUpdated encoding/decoding logic:
key.goto use the new implementationapikey.goto use standard library for entropy generationgithub.com/richardlehane/crock32from dependenciesAdded tests and documentation:
crockford_test.go)Performance
The new implementation shows comparable performance to the original:
While slightly slower, the performance is still excellent and the benefits of using only standard library dependencies outweigh the minor performance difference.
Test plan
🤖 Generated with Claude Code