Closed
Description
There are 2122 possible random (v4) UUIDs. Data.UUID.V4.nextRandom
uses randomIO
to generate them, which uses StdGen
. StdGen
has 64 bits of internal state (two Int32
s), so there can only be at the most 264 different UUIDs generated by nextRandom
, which is a lot less than 2122.
Additionally, StdGen
is not cryptographically secure: observing one UUID is enough to compute all the next ones. I know they are not required to be (by the RFC), but I can find many examples of people using UUIDs as session tokens in cookies, where being able to compute the next UUID could allow someone to take over another account. Most other UUID libraries I've seen to use a CSPRNG to generate v4 UUIDs.
Metadata
Metadata
Assignees
Labels
No labels