Skip to content

Commit 4ffc6ea

Browse files
committed
dotnet format, readme update, version 1.6.0 release
1 parent 480cabe commit 4ffc6ea

4 files changed

Lines changed: 16 additions & 10 deletions

File tree

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,12 @@ var hex = hashids.DecodeHex("kRNrpKlJ");
283283

284284
## Changelog
285285

286+
**v.1.6.0**
287+
288+
- PR [#66](https://github.com/ullmark/hashids.net/pull/66) - Fixed invalid constant bug.
289+
- PR [#67](https://github.com/ullmark/hashids.net/pull/67) and PR [#73](https://github.com/ullmark/hashids.net/pull/73) - Update and cleanup tests and constants.
290+
- PR [#65](https://github.com/ullmark/hashids.net/pull/65) - Improved performance and reduced allocations for single number decode.
291+
286292
**v1.5.0**
287293

288294
- PR [#59](https://github.com/ullmark/hashids.net/pull/59) and PR [#61](https://github.com/ullmark/hashids.net/pull/61) - Project clean up and removal of `net461` target.

src/Hashids.net/Hashids.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -521,11 +521,11 @@ private long GetNumberFrom(string hash)
521521

522522
var guardedHash = hash.AsSpan();
523523
var (count, ranges) = Split(guardedHash, _guards);
524-
524+
525525
var unguardedIndex = count is 3 or 2 ? 1 : 0;
526526
var (start, offset) = ranges[unguardedIndex];
527527
var hashBreakdown = guardedHash.Slice(start, offset);
528-
528+
529529
ArrayPool<(int, int)>.Shared.Return(ranges);
530530

531531
var lottery = hashBreakdown[0];
@@ -540,10 +540,10 @@ private long GetNumberFrom(string hash)
540540
Span<char> buffer = _alphabet.Length < 512 ? stackalloc char[_alphabet.Length] : new char[_alphabet.Length];
541541
buffer[0] = lottery;
542542
_salt.AsSpan().Slice(0, Math.Min(_salt.Length, _alphabet.Length - 1)).CopyTo(buffer.Slice(1));
543-
543+
544544
var startIndex = 1 + _salt.Length;
545545
var length = _alphabet.Length - startIndex;
546-
546+
547547
if (length > 0)
548548
alphabet.Slice(0, length).CopyTo(buffer.Slice(startIndex));
549549

@@ -665,13 +665,13 @@ private static (int count, (int, int)[] ranges) Split(ReadOnlySpan<char> line, R
665665
indexStart++;
666666
nextSeparatorIndex = line.Slice(indexStart).IndexOfAny(separators);
667667
}
668-
668+
669669
isLastLoop = nextSeparatorIndex == -1;
670670
if (isLastLoop)
671671
{
672672
nextSeparatorIndex = line.Length - indexStart;
673673
}
674-
674+
675675
var slice = line.Slice(indexStart, nextSeparatorIndex);
676676
if (slice.IsEmpty)
677677
{

src/Hashids.net/Hashids.net.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
<PropertyGroup>
44
<Title>Hashids.net</Title>
55
<Authors>Markus Ullmark</Authors>
6-
<Version>1.5.0</Version>
7-
<PackageVersion>1.5.0</PackageVersion>
6+
<Version>1.6.0</Version>
7+
<PackageVersion>1.6.0</PackageVersion>
88
<Description>Generate YouTube-like hashes from one or many numbers. Use hashids when you do not want to expose your database ids to the user.</Description>
99
<PackageIconUrl>https://raw.githubusercontent.com/ullmark/hashids.net/master/hashids.png</PackageIconUrl>
1010
<PackageIcon>hashids.png</PackageIcon>

test/Hashids.net.benchmark/HashBenchmarks.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public void SingleNumber()
5151
var encoded = _hashids.Encode(5);
5252
var encodeLong = _hashids.EncodeLong(5);
5353
}
54-
54+
5555
[Benchmark]
5656
public long[] DecodeNumbers()
5757
{
@@ -63,7 +63,7 @@ public long DecodeSingleNumber()
6363
{
6464
return _hashids.DecodeSingleLong(fiveEncoded);
6565
}
66-
66+
6767
[Benchmark]
6868
public void RoundtripSingle()
6969
{

0 commit comments

Comments
 (0)