import hashlib
header_hex = ("01000000" +
      "81cd02ab7e569e8bcd9317e2fe99f2de44d49ab2b8851ba4a308000000000000" +
      "e320b6c2fffc8d750423db8b1eb942ae710e951ed797f7affc8892b0f1fc122b" +
      "c7f5d74d" +
      "f2b9441a" +
      "42a14695")
header_bin = header_hex.decode('hex')
print header_bin.encode('hex_codec')
header_bin_temp = hashlib.sha256(header_bin).digest()
print header_bin_temp.encode('hex_codec')
hash = hashlib.sha256(header_bin_temp).digest()
print hash.encode('hex_codec')
print hash[::-1].encode('hex_codec')

print ""

header_hex = ("02000000" +
    "7ef055e1674d2e6551dba41cd214debbee34aeb544c7ec670000000000000000" +
    "d3998963f80c5bab43fe8c26228e98d030edf4dcbe48a666f5c39e2d7a885c91" +
    "02c86d53" +
    "6c890019" +
    "593a470d")
header_bin = header_hex.decode('hex')
print header_bin.encode('hex_codec')
header_bin_temp = hashlib.sha256(header_bin).digest()
print header_bin_temp.encode('hex_codec')
hash = hashlib.sha256(header_bin_temp).digest()
print hash.encode('hex_codec')
print hash[::-1].encode('hex_codec')


