Currently I have this code written in nodejs.
const sha256 = require('js-sha256').sha256;
var stringl = "8d12a197cb00d4747a1fe03395095ce2a5cc68198f3470a7388c05ee4e7af3d01d8c722b0ff5237400000000000000000000000000000000000000000000000000000000000000b40000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003600000000000000000000000000000000000000000000000000000000004c4b40000000000000000000000000000000000000000000000000000000000001e240"
console.log(sha256(new Buffer(stringl, 'hex')));
it returns
2c0a99a5727be633e440dd8ce2090a0ab7d5a84ccafc9385ea9812db4d715df1
I want to convert the code from nodejs to python (3.5) .
I thought I could just do it with this code.
import hashlib
string21 = "8d12a197cb00d4747a1fe03395095ce2a5cc68198f3470a7388c05ee4e7af3d01d8c722b0ff5237400000000000000000000000000000000000000000000000000000000000000b40000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003600000000000000000000000000000000000000000000000000000000004c4b40000000000000000000000000000000000000000000000000000000000001e240"
print(hashlib.sha256(str(int(string21,16)).encode('utf-8')).hexdigest())
but that returns
346c61765546d4ff12fdbea997f40bdb5216b8df2b5402a6b45893df723132f6
any ideas?
str(int(string21,16))returns.