質問

Is this a good csrf token? Does it have enough entropy, or are there parts that are easily guessable and could reduce the entropy, like the time of the request?

An example python implementation would b

token = hashlib.sha256(str(uuid.uuid4())).hexdigest()
役に立ちましたか?

解決

uuid v4 has 122 random bits (of a possible 128) so, yes, it should be fine as a CSRF token.

(BTW, does hashing this accomplish anything? It's not really doing much other than shuffling random bits around.)

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top