Can't you just define your own function called "get_random_string_entropy" that
calculates the length and then calls get_random_string?
What would be the benefit of doing that in Django directly?

Am 05.03.2016 um 00:15 schrieb Nick Timkovich:
> Rather than guess at the appropriate string length to get some level of
> security, I'd like to add a (minimum) bits of entropy argument to
> get_random_string, so I could say something like get_random_string(bits=256) 
> and
> have it do the math for me: math.ceil(bits / math.log2(len(allowed_chars))).
> 
> Not sure what should happen if both bits and length are specified, let bits
> override? ValueError? whichever is longer/more random/secure (maybe then call 
> it
> min_bits)?
> 
> I seem to recycle that snippet in many of my projects, and I hope it would be
> useful for others. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/56DA9E26.5090803%40googlemail.com.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: OpenPGP digital signature

  • A... Nick Timkovich
    • ... 'Moritz Sichert' via Django developers (Contributions to Django itself)
      • ... Nick Timkovich
        • ... Tim Graham
          • ... Nick Timkovich

Reply via email to