|
|
|
|
|
by p4bl0
1608 days ago
|
|
I'm sorry, it seems you really don't understand neither what I'm saying nor the citation you used. Collision and proof of work are really not the same thing. Here are some Python code that compares the two. If you're not convinced, I suggest you try using it to time what is actually harder and what makes a blockchain immutable. Then come back here when you found a collision :). import hashlib
def h (d): return hashlib.sha256(d).hexdigest()
def mine_for_PoW (d):
nonce = 0
while True:
blk = f"{d}{nonce}".encode()
sha = h(blk)
if sha[0:6] == '000000': ## PoW
return sha, nonce
nonce += 1
def find_collision (d, original):
nonce = 0
while True:
blk = f"{d}{nonce}".encode()
sha = h(blk)
if sha == original: ## collision
return nonce
nonce += 1
|
|