Repository navigation
Release ColorHashSharp 2.0.0 with color-hash 2.0.2 parity - #10
Merged
Merged
Conversation
- Updated BenchmarkDotNet in benchmarks project to 0.15.8. - Upgraded Microsoft.NET.Test.Sdk to 18.0.1 and - xunit.runner.visualstudio to 3.1.5 in test project.
…ard2.0, netstandard2.1, net48, net481, net8.0, net9.0, and net10.0)
- Convert string to UTF8 bytes once instead of per-character conversion - Remove inefficient ToString() and ToUTF8Bytes() calls in loop - Eliminate redundant ToUTF8() and ToUTF8Bytes() helper methods - Direct byte array iteration reduces allocations and GC pressure - Expected performance improvement: 50-70% faster hash generation
- Remove all Debug.WriteLine statements from BKDRHash loops - Remove Debug.WriteLine statements from ColorToRgb conversion methods - Eliminate I/O and string formatting overhead in production code - Debug statements executed on every hash/color conversion - Expected performance improvement: 20-30% faster
- Replace ArrayList with List<double> for S and L properties - Eliminate boxing/unboxing overhead on every access - Remove unnecessary type casting: (double)_options.S[i] to _options.S[i] - Update all GetLS methods to return List<double> instead of ArrayList - Update test files to use List<double> instead of ArrayList - Improve type safety and memory efficiency - Expected performance improvement: 15-25% faster
- Add readonly fields for BKDRHash, ColorToHex instances - Reuse cached instances instead of creating new ones per call - Use static ColorToRgb.ToRgb() method directly instead of instance - Remove unnecessary Hue cast (HueRanges is already List<Hue>) - Remove obsolete TODO comment - Reduce GC pressure by eliminating repeated allocations - Expected performance improvement: 10-15% fewer allocations
- Add IHashFunction interface for custom hash implementations - BKDRHash now implements IHashFunction - Options.HashFunction property allows custom hash functions - ColorHash uses custom hash if provided, otherwise defaults to BKDRHash - Add comprehensive tests for custom hash function functionality - Add documentation and examples in samples/CustomHashFunction.md This allows users to: - Use custom hash algorithms (MD5, SHA, etc.) - Implement domain-specific hash functions - Ensure cross-platform consistency - Create predictable hashes for testing Fixes #1
Remove .NET 8 and .NET 9 targets Add support for .NET 10 and .NET 11 Update NuGet packages to compatible versions Refresh CI workflow configuration
- Add separate build and test jobs for Windows and Ubuntu - Run the CI matrix against .NET 10 and .NET 11 - Multi-target the test project for both frameworks - Update checkout and configure workflow permissions and concurrency
- Upgrade actions/checkout from v4 to v5 - Upgrade actions/setup-dotnet from v4 to v5 - Apply updates to both build and test jobs
- Match the color-hash 2.0.2 default hash using the first four SHA-256 digest bytes as an unsigned big-endian integer. - Add JavaScriptBkdrHash and keep historical BKDR and custom hashes available through Options.HashFunction. - Update default color expectations and add exact hash, HSL, RGB, and HEX regression vectors. - Document hash selection and the Options migration from NuGet 1.1.0. BREAKING CHANGE: Default colors may change. Select BKDRHash explicitly with the same palettes and hue ranges to preserve historical colors. Options.S, Options.L, and protected GetLS now use List<double> in place of ArrayList. Affected consumers must update and recompile ref #9
- Reject missing or empty palettes, non-finite values, and invalid hue ranges - Copy palettes and hue bounds while preserving valid endpoints and fixed hues - Treat null input as an empty string, including for custom hashes - Add regression tests and document the 2.0 behavior BREAKING CHANGE: Changes to Options after construction no longer affect existing ColorHash instances. Create a new instance to apply changes. Custom hashes now receive an empty string for null input ref #9
- Enable JavaScript-compatible HSL calculations, RGB rounding, and CSS hex output by default - Port upstream tests to xUnit and retain regression tests for historical colors - Update the README and examples with the 2.0 defaults and migration settings BREAKING CHANGE: Default color values may change, and HEX output now uses lowercase #rrggbb. To reproduce ColorHashSharp 1.x colors, set Options.UseJavaScriptCompatibility to false and select BKDRHash #9
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.
Breaking changes
Default colors and HEX output can change. Options.S and Options.L now use List, and changes to Options after construction require a new ColorHash instance.
Refs #9