A fast and modern .NET library to generate UUID/GUID that are either sequential and database friendly (versions 7), name based (versions 5) or random (version 4).
BSD Zero Clause License
240
stars
13
forks
source link
GuidHelper: Swap bytes regardless of the endianness #4
Current implementation makes an incorrect assumption that the Guid(ReadOnlySpan<byte>) constructor and Guid.TryWriteBytes(Span<byte>) produce different results on big-endian and little-endian systems.
Current implementation makes an incorrect assumption that the
Guid(ReadOnlySpan<byte>)
constructor andGuid.TryWriteBytes(Span<byte>)
produce different results on big-endian and little-endian systems.However, they always accept/return mixed-endian bytes. See the implementation: https://github.com/dotnet/runtime/blob/9129083c2fc6ef32479168f0555875b54aee4dfb/src/libraries/System.Private.CoreLib/src/System/Guid.cs#L56-L73
https://github.com/dotnet/runtime/blob/9129083c2fc6ef32479168f0555875b54aee4dfb/src/libraries/System.Private.CoreLib/src/System/Guid.cs#L838-L858