Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not generate the same image with the same key problem. #223

Open
zencore-dobetter opened this issue Oct 9, 2023 · 1 comment
Open

Not generate the same image with the same key problem. #223

zencore-dobetter opened this issue Oct 9, 2023 · 1 comment

Comments

@zencore-dobetter
Copy link

captcha/views.py:50

random.seed(key) # Do not generate different images for the same key

This random.seed(key) can NOT ensure to generate the same images at high concurrent requests scenario.
Suggest to use private_random_generator = random.Random(key) to create a function private random generator, and use private_random_generator.choices and private_random_generator.randrange in the image generate function.

@zencore-dobetter
Copy link
Author

And needs to pass the private_random_generator to the noise_functions and maybe also filter_functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant