All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
2.0.1 - 2025-06-22
- Moved
ToUnsignedIntegerDigitmethod fromLuhnDotNetCoretoCharExtensionsclass. - Optimized
IsDigitsmethod inReadOnlySpanExtensionsclass. - Optimized
ComputeNumberWithCheckDigitmethod inReadOnlySpanExtensionsclass. - Renamed
CreateNumberWithCheckDigitmethod toCreateNumberWithCheckDigitAndValidateinReadOnlySpanExtensionsclass.
- Fixed StackOverflowException in validation methods when the input is too long.
- Fixed .NET Standard 2.0 issues with Damm algorithm and Mod11 Ascending Weights algorithm implementations.
2.0.0 - 2025-06-19
- Added internal
LuhnAlgorithmclass to encapsulate Luhn algorithm related methods. - Added public
LuhnCalculatorclass to encapsulate Luhn calculation methods. - Added public
LuhnValidatorclass to encapsulate Luhn validation methods. - Added
StringExtensionsandReadOnlySpanExtensionsclasses to encapsulate string and ReadOnlySpan related methods. - Added
LuhnAlgorithm.ComputeLuhnCheckDigitmethod to compute the Luhn check digit. - Added
LuhnAlgorithm.ComputeLuhnNumbermethod to compute the Luhn number. - Added
LuhnValidator.IsValidLuhnCheckDigitmethod to validate a check digit with Luhn algorithm. - Added
LuhnValidator.IsValidLuhnNumbermethod to validate a number with Luhn algorithm. - Added overloads of
LuhnValidator.IsValidLuhnCheckDigitandLuhnValidator.IsValidLuhnNumbermethods to accept aReadOnlySpan<char>as input. - Added internal
Mod11AscendingWeightsAlgorithmclass to encapsulate Mod11 algorithm related methods. - Added public
Mod11AscendingWeightsCalculatorclass to encapsulate Mod11 calculation methods. - Added public
Mod11AscendingWeightsValidatorclass to encapsulate Mod11 validation methods. - Added
Mod11AscendingWeightsCalculator.ComputeMod11CheckDigitmethod to compute the Mod11 check digit. - Added
Mod11AscendingWeightsCalculator.ComputeMod11Numbermethod to compute the Mod11 number. - Added overloads of
Mod11AscendingWeightsCalculator.ComputeMod11CheckDigitandMod11AscendingWeightsCalculator.ComputeMod11Numbermethods to accept aReadOnlySpan<char>as input. - Added
Mod11AscendingWeightsValidator.IsValidMod11CheckDigitmethod to validate a check digit with Mod11 algorithm. - Added
Mod11AscendingWeightsValidator.IsValidMod11Numbermethod to validate a number with Mod11 algorithm. - Added overloads of
Mod11AscendingWeightsValidator.IsValidMod11CheckDigitandMod11AscendingWeightsValidator.IsValidMod11Numbermethods to accept aReadOnlySpan<char>as input. - Added
StringExtensions.RemoveSeparatorsmethod to remove all separators from a string. - Added
ReadOnlySpanExtensions.RemoveSeparatorsmethod to remove all separators from a ReadOnlySpan. - Added
InvalidCharacterExceptionto throw an exception if the input string contains invalid characters. - Added
RemoveSeparatorsmethods to remove all separators from a string or ReadOnlySpan. Use it, for example, with credit card numbers. - Added internal
LuhnDotNetCoreclass to encapsulate functionality related to the Luhn, Modulus 11, and other algorithms. - Added Damm algorithm implementation with
DammAlgorithm,DammCalculator, andDammValidatorclasses. - Added
CharExtensionsclass withThrowIfNotDigitto throw an exception if a character is not a digit.
- Changed return type of
LuhnAlgorithm.ComputeLuhnCheckDigittocharinstead ofbyte. - Moved Luhn algorithm related methods from the
Luhnclass to the newLuhnAlgorithm,LuhnCalculator, andLuhnValidatorclasses. - Changed namespace for Luhn algorithm-related classes from
LuhnDotNettoLuhnDotNet.Algorithm.Luhn. - Changed
Luhn.IsValidmethods toLuhnValidator.IsValidLuhnCheckDigitandLuhnValidator.IsValidLuhnNumber. - Renamed
ConvertAlphaNumericToNumerictoAlphaNumericToNumeric - Moved
AlphaNumericToNumericmethod to theStringExtensionsand its overloaded version toReadOnlySpanExtensionsclass. - Moved
ComputeCheckDigitandComputeLuhnNumbermethods to theLuhnCalculatorclass. - Moved
IsValidNumberandIsValidCheckDigitmethods to theLuhnValidatorclass. - Renamed
Luhnclass toLuhnAlgorithm.
- Removed
Luhn.IsValidmethods
1.3.0 - 2024-12-27
- Added project icon
- Added project social preview image
- Added
Luhn.IsValidNumber - Added
Luhn.IsValidCheckDigit
Luhn.IsValidmethods are deprecated. UseLuhn.IsValidNumberorLuhn.IsValidCheckDigitinstead.
1.2.0 - 2024-12-26
- Added API documentation
- Added .NET 9 support
- Removed .NET 7 support
- Removed .NET 6 support
- Removed
Luhn.Compute()method
1.1.0 - 2024-03-30
- Added
ConvertAlphaNumericToNumericmethod to convert a string containing alphanumeric characters to a string containing only numeric characters (use case: converting an ISIN to a numeric string for Luhn validation).
1.0.1 - 2024-03-19
- Fixed a bug in
Luhn.ComputeLuhnNumberandLuhn.ComputeLuhnCheckDigitmethods that sometimes returned an incorrect result.
1.0.0 - 2024-02-19
- Added .NET 8 support
- Added support for SourceLink (GitHub)
- Enable deterministic builds
- Changed parameter type of
Luhn.IsValid,Luhn.ComputeLuhnNumberandLuhn.ComputeCheckDigitmethods fromstringtoReadOnlySpan<char>.
Luhn.Compute()method is EOL and will be deleted in the next version. UseLuhn.ComputeCheckDigit()orLuhn.ComputeLuhanNumber()instead.
0.2.0 - 2022-12-18
- Added .NET 7 support
- Added feature to remove all leading and trailing white-space characters from the String object representing a number w/ and w/o Luhn check digit.
- Added an overload of the
Luhn.IsValidmethod to accept a String object representing a number w/o Luhn check digit. The check digit is separated from the number as single byte parameter. - Added
Luhn.ComputeCheckDigitmethod to compute the Luhn check digit. - Added
Luhn.ComputeLuhnNumbermethod to compute the Luhn number.
- Updated Microsoft.NETFramework.ReferenceAssemblies to v1.0.3
Luhn.Compute()method is deprecated. UseLuhn.ComputeCheckDigit()orLuhn.ComputeLuhanNumber() instead.
- Removed LINQ dependency
- Removed .NET Core 3.1 support
0.1.0 - 2022-06-05
- Added initial version of LuhnDotNet