Z
Z
zlodiak2018-07-10 00:09:35
Django
zlodiak, 2018-07-10 00:09:35

How does Django's csrf token encode?

If there is a django backend, then the first time you visit any page, django generates a csrf token in the cookie. It is not clear to me how this token is generated and on the basis of what.
My thoughts:
there is a SECRET_KEY value in settings.py. On first contact between django and the browser, django encodes this SECRET_KEY using an md5 encryption algorithm. I tried to encode SECRET_KEY with several popular algorithms (there are many online services like sha1-online.com on the Internet), but I did not get a value equal to the csrf token that is stored in my cookies Please help me
understand on the basis of what the csrf token is encoded and how exactly algorithm

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Burov, 2018-07-10
@zlodiak

https://github.com/django/django/blob/10b44e45256d...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question