https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
v

Vishnu Shrikar

10/21/2023, 9:43 AM
Any libraries for UUID? I am using https://github.com/benasher44/uuid and finding that it is nothing but a steaming pile of garbage. The library limits strings to certain lengths for uuid generation, it seems you must already have a UUID generated or generate one randomly, unacceptable
👎🏼 1
sad panda 1
👎🏻 1
🤦‍♂️ 2
👎 17
k

kevin.cianfarini

10/21/2023, 9:45 AM
You should check your tone when talking about other people's libraries in public like this. Ben is a good engineer. I doubt you will receive help the way you're asking. I certainly won't help you and hopefully neither will he.
22
e

Edoardo Luppi

10/21/2023, 10:09 AM
Well, unacceptable is relative to the goal of the library author. You're free to implement your own, or fork it if the license permits it. That's certainly not the way to go around open source software.
2
t

todd.ginsberg

10/21/2023, 11:55 AM
Calling an open source library a "steaming pile of garbage" is a great way to not get the response you want. Be kind. Our community deserves better, Vishnu.
3
v

Vishnu Shrikar

10/22/2023, 6:31 AM
I have nothing against the developer at all, I do not consider myself a bad developer yet I have made very bad things and published them. I love this community and all the people in it but I have only so much time to work on my projects, and when something does not make the cut I have to call it out. I may have been a bit upset and I realize maybe I should be a bit kinder but I have tried for hours to find this functionality only to find it does not exist. Furthermore there is next to no documentation, so I hope my fellow developers understand where I am coming from. I really should not have to read through library source to understand the libraries functions.
👎 3
👎🏻 1
So it seems no one is willing to help here, in case anyone ends up searching this and would like to know how to fix this. The library does not implement a hasher, but does know how to use one if you provide it. Considering hashing is an integral part of how UUID's work, this is a problem. the
Copy code
nameBasedUuidOf
function is what you need to use for this. You will need to pick a UUID namspace, i picked x500 and call uuidFrom on that, and you will need to implement the UUIDHasher interface. A easy way to do this is to bridge this library https://github.com/KotlinCrypto/hash this should be a dependancy and implmented but it seems that users of the library must learn the entirety of the UUID algorithm if they want to use this. I used uuid5 with SHA1 but you can pick and choose really. I believe this should help anyone who stumbles across this
6 Views