doyaaaaaaken
06/25/2020, 8:29 AMAs I said, I use SessionStorage.
<https://ktor.io/servers/features/sessions/storages.html>
And I find the responded cookie value is in below format.
`78a095a61d3e58a2`
This value is generated by `generateNonce` function.
<https://github.com/ktorio/ktor/blob/master/ktor-server/ktor-server-core/jvm/src/io/ktor/sessions/SessionsBuilder.kt#L271>
(The concrete implementation is in Nonce.kt <https://github.com/ktorio/ktor/blob/master/ktor-utils/jvm/src/io/ktor/util/Nonce.kt> )
I understand the cookie value is hard to guess because the SecureRandom is used, but I'm worried about collision.
The cookie value is 64bit. (`78a095a61d3e58a2`)
So, the expected number of cookie values that can be generated before getting a collision is 2^(64/2) = 4,294,967,296.
> The birthday problem in this more generic sense applies to hash functions: the expected number of N-bit hashes that can be generated before getting a collision is not 2N, but rather only 2N⁄2.
<https://en.wikipedia.org/wiki/Birthday_problem>
I wonder if 4,294,967,296 is enough to protect birthday attack.
Does anyone know about this?
spand
06/25/2020, 8:35 AM