Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add method to create hash String from byte[] and long/long #9

Open
l0rinc opened this issue Sep 19, 2019 · 3 comments
Open

Add method to create hash String from byte[] and long/long #9

l0rinc opened this issue Sep 19, 2019 · 3 comments

Comments

@l0rinc
Copy link

l0rinc commented Sep 19, 2019

Hey, thanks for sharing this little library!

Since UUIDs are sometimes the result of hashing calculations (e.g. MessageDigest.getInstance("md5")#digest), it may make sense to extend the lib with FastUUID.toString(byte[] uuid) and FastUUID.toString(long mostSignificantBits, long leastSignificantBits).

I would gladly contribute this change, if you think it makes sense.

@jchambers
Copy link
Owner

Interesting. I think that makes sense, but will have to page this back into my head. Let me get back to you shortly!

@jchambers
Copy link
Owner

With apologies for the long delay, I'm finally getting back to this. I get that you're talking about version 3 and 5 UUIDs, but don't quiiiiiite follow the use case for going straight from byte[] to String (as opposed to, say, UUID FastUUID#fromBytes(byte[])). I'm not necessarily opposed (and suspect you're just trying to save some overhead in a case where you just want to dump something straight to text), but can you say more?

@l0rinc
Copy link
Author

l0rinc commented Jan 2, 2020

We're storing it in the db and getting back a byte array - would be great to be able to avoid the intermediary UUID object and convert from byte[] to String and vice versa (i.e. md5 produces the array and postgres requires a formatted String (with or without dashes)).
I've already implemented this for our case so - I can share the code already, if you think it would be useful for others as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants