Thank you.
SwapOrder is just converting big to little endian and you don't use it in the python code, because you already specify it as converted to little endian.
The issue is PHP code from example comes either with SwapOrder and LittleEndian
$rootHash = SwapOrder('2b12fcf1b09288fcaff797d71e950e71ae42b91e8bdb2304758dfcffc2b620e3');
$time = littleEndian(1305998791);
I have implemented SwapOrder (BytesSwap) in Javascript
Hex string 2 bits string
but I am not sure what makes the difference between SwapOrder and LittleEndian
since input data (6 parameters) for each example in Python, PHP is parsed from block header the other way
I don't need any parsing in example in plain C
http://pastebin.com/bW3fQA2aYou are exactly right, there is a number of sha256 implementations in Javascript
but what I was looking for was Bitcoin block header hash implementation in Javascript ( still missing)
I need the way (API, database, datafile (csv) as 6 input parameters to run Block header hash off-line
to verify every block (nonce) from the past.
How to download and parse Bitcoin block header 6 input parameters and save to file as csv , any source, web link to such file ?
Ok, Javascript is slow but is nice for education or presentation on how Bitcoin block header hash works
step-by-step.
I tried to download Bitcoin block header 6 input parameters from Blockchain.info
unfortunately format is not smart ( a lot of parsing required)
and time is not in Unix epoch format
btw
I don't see block header parsing (string made of 6 input parameters + BytesSwap, LittleEndian in plain C example from
http://pastebin.com/bW3fQA2aI am really grateful for your help.