
Sept. 22, 2015
2:51 p.m.
On Tue, Sep 22, 2015, at 08:03, Nick Coghlan wrote:
Building a password from an alphabet is different, as that involves repeated applications of secrets.choice() to the given alphabet, so you need to specify the result length directly.
Well, in principle, the length could be calculated from the number of bytes of entropy desired by using ceil(nbytes*log(256)/log(len(alphabet))), if all that matters is to "fail safe" [i.e. longer] rather than to not be surprising. Being calculated by repeated application of choice rather than some other algorithm is an implementation detail.