Skip to content

Commit

Permalink
use os.urandom()
Browse files Browse the repository at this point in the history
  • Loading branch information
russhousley committed Jul 14, 2020
1 parent ca10938 commit 3a73b83
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
12 changes: 12 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@


Revision 1.0.0, released 4-May-2020
-----------------------------------

- Initial release.


Revision 1.0.1, released 14-Jul-2020
------------------------------------

- Use os.urandom instead of secrets, which is not available until Python3.6.
2 changes: 1 addition & 1 deletion pyhsslms/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# https://www.python.org/dev/peps/pep-0396/
__version__ = '1.0.0'
__version__ = '1.0.1'

from .pyhsslms import lmots_sha256_n32_w1
from .pyhsslms import lmots_sha256_n32_w2
Expand Down
7 changes: 5 additions & 2 deletions pyhsslms/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,18 @@
FoundFileError = IOError

else:
from secrets import token_bytes as random_bytes
# secrets is not available until Python3.6.
# from secrets import token_bytes as random_bytes
import os

u32 = lambda i: i.to_bytes(4, byteorder='big', signed=False)
u16 = lambda i: i.to_bytes(2, byteorder='big', signed=False)
u8 = lambda i: i.to_bytes(1, byteorder='big', signed=False)
fromHex = bytes.fromhex
toHex = lambda x: x.hex()
toBytes = lambda x: x.encode()
randBytes = random_bytes
# randBytes = random_bytes
randBytes = os.urandom
int32 = lambda x: int.from_bytes(x, byteorder='big')
charNum = lambda x: x
NoFileError = FileNotFoundError
Expand Down

0 comments on commit 3a73b83

Please sign in to comment.