repl.it
@UFO/SHA256Bitcoinornek
Python

No description

main.py

#https://btc.com/00000000000000001e8d6829a8a21adc5d38d0a473b144b6765798e61f98bd1d
                #0x3a30c00000000000000000000000000000000000000000000L
#Height 125,552
#Bits 0x1a44b9f2
#Nonce 0x9546a142

import hashlib, struct
import datetime
import time

#Hedef = 0x03a30c * 2(0x08*(0x19-0x03))

 #https://en.bitcoin.it/wiki/Block_hashing_algorithm
 # Zaman 2011-05-21 20:26:31

d = datetime.date(2011,01,01)


#d.strftime("%s")  # <-- THIS IS THE CODE YOU WANT '1293832800'

print (d)

# 2011-05-21 20:26:31

dt = datetime.datetime(2011,05,21,20,26,31)

dene= time.mktime(dt.timetuple())

print hex(int(dene))
#0xc7f5d74d

kabul=0x4dd7f5c7

print "kabul", kabul

#saat 20 değil 23 olacak yerel saat 

time_tuple = (2011, 05, 21, 20, 26, 31, 2, 317, 0)

timestamp = time.mktime(time_tuple)

print "mevcut", timestamp

print timestamp-kabul

timetuple   = time.gmtime(2*timestamp-kabul)

# print timetuple


print hex(int(timestamp-kabul))

tarih_= hex(int(timestamp))

print tarih_
 
header_hex = ("01000000" +
 "81cd02ab7e569e8bcd9317e2fe99f2de44d49ab2b8851ba4a308000000000000" +
 "e320b6c2fffc8d750423db8b1eb942ae710e951ed797f7affc8892b0f1fc122b" +
 "c7f5d74d" +
 "f2b9441a" +
 "42a14695")
 
header_bin = header_hex.decode('hex')

#header_bin = header_hex

#hash = hashlib.sha256(hashlib.sha256(header_bin).digest()).digest()

hash = hashlib.sha256(header_bin).digest()
#hash = hashlib.sha256(hash).digest()


print hash.encode('hex_codec') 

hash = hashlib.sha256(hash).digest()

print hash.encode('hex_codec') 

hash.encode('hex_codec')
'1dbd981fe6985776b644b173a4d0385ddc1aa2a829688d1e0000000000000000'

hash[::-1].encode('hex_codec')
'00000000000000001e8d6829a8a21adc5d38d0a473b144b6765798e61f98bd1d'

print hash[::-1].encode('hex_codec') 




Python 2.7.10 (default, Jul 14 2015, 19:46:27) [GCC 4.8.2] on linux