Closed inebritov closed 3 weeks ago
Reproduced in Docker on Linux
I’ve checked the code with the debugger, and it looks like the library has a slight difference from the original. Here, in the machine ID generation, we calculate the sum of the hash, but in the original library, the hash bytes are used raw. So I made a pull request to fix that: https://github.com/Yortw/Xid.Net/pull/2
I'm not sure about performance, as the last build shows the Error Message: Test 'Xid_New_Performance' exceeded execution timeout period. I can't figure out what's wrong and I need assistance with that.
I have published a 2.0.1-beta version of the package to nuget, if you'd like to try it and let me know if it works. The tests all pass, benchmarks run and the generated values look good to me.
Yep, tested it, works well:
using XidNet;
Console.WriteLine(Xid.NewXid());
Console.WriteLine(Xid.NewXid());
Console.WriteLine(Xid.NewXid());
Console.WriteLine(Xid.NewXid());
Output:
cs1titrb3p24shn4h8qg
cs1titrb3p24shn4h8r0
cs1titrb3p24shn4h8rg
cs1titrb3p24shn4h8s0
Thanks for the PR and your assistance with testing. New, non-beta, package published now.
I use the
Xid.NewXid()
generation method and it gives me result with zeros in the middle. I was curious and checked internals of the library, so it seems that function generating for Machine ID (B5-B7) return small number. Also, Process ID (B8-B9) in Docker is less than 255, so I have noticeable amount of zeros in the middle of the Xid:On the host machine (.net installed in the system) it looks better, but it still has zero-bytes:
Environment: