Open kosprov opened 5 years ago
Hi @kosprov. Thank you for bringing this to my attention. I'll take a deeper look at this. Cheers!
Hi @kosprov. What is the epoch time set to in your Go implementation? Something to keep in mind is that there is a subtract operation performed on the generated timestamp prior to Base62 conversion. Another point to note is that the Base62 conversion in the Go implementation have the ASCII characters in a different order. Just some thoughts. Thank you.
I used the original Go implementation from Segment and a JavaScript implementation. Those two are interoperable. Both use the epoch mentioned in the blog post (14e8 seconds / 14e11 millis)
Thank you for the solution references. While interoperability with other implementations was not an original goal, I can see its value. As time permits, I'll work towards making this library compatible with other implementations starting with the ones you have referenced. Cheers!
Hi @kosprov. I've published a version of this library to Maven Central that should generate identifiers that are portable. Since this is a breaking change, I am incrementing the version number to a 2.x.x release.
I'd like your feedback. When possible, can you please test the new version and compare your results to the Go and Node.js implementations then report back if the changes are acceptable?
In Maven Central, you can find the build as version 2.0.0-RC1
.
In GitHub, you can find the code under the branch feature/portable-ksuid
.
Thank you.
I'm not the one who asked for it originally but I can confirm that with 2.0.0-RC1
version I get UIDs that look close enough to the ones from Go implementation.
Hi,
I just used the original Go implementation to create a KSUID and I got:
The Java implementation gave me:
The timestamp part is clearly not similar even though they were generated seconds apart.
When I try to parse
1GZvgyPvVmuiQMTuzkEtKSogs2V
with the Java implementation I get:Similarly, when I parse
COH2CXgKpgJ9Bvn8SF1xUa9CeTt
with the Go implementation I get:This library must be interoperable with other implementations.