moonpyk / ncuid Goto Github PK
View Code? Open in Web Editor NEWCollision-resistant ids for .NET (port of https://github.com/dilvie/cuid)
License: MIT License
Collision-resistant ids for .NET (port of https://github.com/dilvie/cuid)
License: MIT License
Due to security concerns (which also exist in database auto-increment ids, uuid/guid, and most other id standards), the Cuid standard is now deprecated in favor of Cuid2.
There is a warning when referencing the NCuid package from a net core project:
NU1701 Package 'NCuid 1.0.0' was restored using
'.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8'
instead of the project target framework '.NETCoreApp,Version=v3.1'.
This package may not be fully compatible with your project.
A new version with netstandard support will be pretty welcome:)
For this line,
Line 127 in 9f5efe0
Should it be hostname.ToCharArray().Select(c=>c.ToString()) instead?
I tried the existing code and found that it just returned ["hostname"], where hostname is my hostname value.
var ts = DateTime.Now.ToUnixMilliTime().ToBase36();
It should use DateTime.UtcNow here as the Epoch time used is also Utc.
At https://github.com/moonpyk/ncuid/blob/master/NCuid/Cuid.cs#L104, you create a new instance of Random
every time the method is called. If I call it in a loop very quickly, then that part of the cuid won't be truly random, as CāÆ / .NET seeds Random
with the system's clock.
Consider making Random
a private static member of the class itself.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ššš
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ā¤ļø Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.