Skip to content
Advertisement

Tag: hashlib

Constructing Bech32 addresses

I’m trying to follow the steps here https://en.bitcoin.it/wiki/Bech32 to generate a valid bech32 address. I am getting stuck on the first step: Having a compressed public key (0x02 or 0x03 followed by 32 byte X coordinate): 0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 Perform SHA-256 hashing on the public key: 0f715baf5d4c2ed329785cef29e562f73488c8a2bb9dbc5700b361d54b9b0554 Here is one of the things I tried: Note: I’m limited to python 2.7.18 I’m

HMAC SHA-512 hashing function equivalent in node.js

I currently have this snippet in Python – I am trying to replicate it in Node.js, but having difficulty getting the correct hash. Test case: Key: ‘7pgj8Dm6’ Message: ‘TestMessage’ With the python snippet, the hash is With the js snippet, the hash is Am I going wrong with the base64 encoding? Answer In the NodeJS code, the key is first

Generating an MD5 checksum of a file

Is there any simple way of generating (and checking) MD5 checksums of a list of files in Python? (I have a small program I’m working on, and I’d like to confirm the checksums of the files). Answer You can use hashlib.md5() Note that sometimes you won’t be able to fit the whole file in memory. In that case, you’ll have

Advertisement