I've seen several implentations of CSRF tokens:
- The first one uses randomly generated CSRF tokens which uses a cryptographic strong random generator to generate the token.
- The second implementation I found uses HMAC which encrypts the session id with secret key stored in the server side config.
- The third implentation I saw uses a combination of both, a secret key stored in the server side config is used to HMAC a random generated value
The second one does not require state to be stored server side (which is ideal in case of clustering).
I'm wondering what the benefit is between the first and third implementation.