March 06, 2004
We need more entropy, Scotty! There was one small problem with the JEP-25 code for producing key sequences: the mechanism for producing the seed is pathetically weak. The length for the sequence is typically 256 in other clients such as Exodus. So if all the sequences were only 256 in length, you would only have to enumerate 256 * 2 ^ 15 hash values to be able to crack the sequence if you're using random.randint(1,2**15) to generate the seed. A better solution would be to use this function for generating the seed.
def generateCNONCE(): """http://www.faqs.org/rfcs/rfc2831.html requires at least 64bits of entropy for the cnonce.""" # Each character [A-Za-z0-9] character has ~5.95 bits # (log(2) 62) of entropy and so we need a string of at # least 11 characters to have 64bits of entropy. We're # using 128bits of entropy. cnonceLength = 22 cnonceList = [None] * cnonceLength for i in xrange(cnonceLength): randValue = random.randint(0,61) if randValue < 26: cnonceList[i] = chr(ord('A') + randValue) elif randValue < 52: cnonceList[i] = chr(ord('a') + randValue - 26) else: cnonceList[i] = chr(ord('0') + randValue - 52) return "".join(cnonceList)
Dudley at 08:31 PM Rants