Reputation: 65
Hi I am making a simple program using python2.7 in which the first input is hex (32bytes) that will be hashed and increment by 1. The new value will be hashed again and increment again. The process will repeat until it satisfy the specified range.
However I'm getting an error with int()
TypeError: int() can't convert non-string with explicit base
Below is my program code
from coinkit.address import Address
import hashlib
h = hashlib.new('ripemd160') # <-- Create the hash
a = Address.from_secret('0000000000000000000000000000000000000000000000000000000000000001') #where the input will be hash
for i in range (0, 10): # should have 10 outputs
intVal = int(a, 16) # convert to hex
intVal += 1 # increment by 1
h.update(hex(intVal)) # <-- Update the hash with the new incremented integer
a = Address.from_secret(h.hexdigest()) # <-- Get the digest and feed it back into from_secret
print a.pub, a.priv # <-- print new 'a' values
I did try to remove 16 it throws an error:
TypeError : int() argument must be a string or a number, not 'Address'
Please enlighten me. Thank you.
Upvotes: 0
Views: 2290