I am trying to generate random bitcoin Private_Keys in HEX format (32bit) but I want the randomness to have a value within a specific HEX range, say between
18909BDE11F67C97A53C62F45E632EAB58EA0D73A5FAC9EB50295FAD40A57EB5
and
DD10559E1285B3EE0303B159B8D6D8D0B88E6168D1C1D6000000000000000000
The following piece of code in Python 3
is a start but it simply generates random keys for the curve's entire field which is up to
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141
This is the code:
generate_private_key():
return binascii.hexlify(os.urandom(32)).decode('utf-8').upper()
How to specify the desired search range expanding on the above code?
Thanks.