@@ -326,28 +326,29 @@ with open("vk.pem", "wb") as f:
326326## Entropy
327327
328328Creating a signing key with ` SigningKey.generate() ` requires some form of
329- entropy (as opposed to ` from_secret_exponent/from_string/from_der/from_pem ` ,
329+ entropy (as opposed to
330+ ` from_secret_exponent ` /` from_string ` /` from_der ` /` from_pem ` ,
330331which are deterministic and do not require an entropy source). The default
331332source is ` os.urandom() ` , but you can pass any other function that behaves
332- like os.urandom as the entropy= argument to do something different. This may
333- be useful in unit tests, where you want to achieve repeatable results. The
334- ecdsa.util.PRNG utility is handy here: it takes a seed and produces a strong
333+ like ` os.urandom ` as the ` entropy= ` argument to do something different. This
334+ may be useful in unit tests, where you want to achieve repeatable results. The
335+ ` ecdsa.util.PRNG ` utility is handy here: it takes a seed and produces a strong
335336pseudo-random stream from it:
336337
337338``` python
338339from ecdsa.util import PRNG
339340from ecdsa import SigningKey
340- rng1 = PRNG(" seed" )
341+ rng1 = PRNG(b " seed" )
341342sk1 = SigningKey.generate(entropy = rng1)
342- rng2 = PRNG(" seed" )
343+ rng2 = PRNG(b " seed" )
343344sk2 = SigningKey.generate(entropy = rng2)
344345# sk1 and sk2 are the same key
345346```
346347
347348Likewise, ECDSA signature generation requires a random number, and each
348349signature must use a different one (using the same number twice will
349350immediately reveal the private signing key). The ` sk.sign() ` method takes an
350- entropy= argument which behaves the same as ` SigningKey.generate(entropy=) ` .
351+ ` entropy= ` argument which behaves the same as ` SigningKey.generate(entropy=) ` .
351352
352353## Deterministic Signatures
353354
0 commit comments