1
0
mirror of https://github.com/bitcoinbook/bitcoinbook synced 2025-01-11 00:01:03 +00:00

Merge pull request #430 from manjeetbhatia/patch-1

Update hash_example.py
This commit is contained in:
Andreas M. Antonopoulos 2018-02-02 12:30:52 -08:00 committed by GitHub
commit 225cb58c09
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