1
0
mirror of https://github.com/bitcoinbook/bitcoinbook synced 2024-11-21 23:58:09 +00:00

Update hash_example.py

As input and hash are inbuilt functions, so I'd suggest using other names for variables.
here is output from python interpreter.

>>> hash
<built-in function hash>
>>> input
<built-in function input>
This commit is contained in:
Manjeet Singh Bhatia 2017-12-09 22:05:50 -08:00 committed by GitHub
parent 6354bb99d3
commit 22e17ffd3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,10 +9,10 @@ text = "I am Satoshi Nakamoto"
for nonce in xrange(20):
# add the nonce to the end of the text
input = text + str(nonce)
input_data = text + str(nonce)
# calculate the SHA-256 hash of the input (text+nonce)
hash = hashlib.sha256(input).hexdigest()
hash_data = hashlib.sha256(input_data).hexdigest()
# show the input and hash result
print input, '=>', hash
print input_data, '=>', hash_data