To calculate hash of hex string in python:
In [1]: import hashlib
In [2]: import binascii
In [3]: hex_string = '3082010a0282010100c3dfee03290fb01e3a4887c5ce0630dcdd8495bfb568b1f61cb8fa8294545b74f06facd215933c53babdd4d066dcb2a713740b9a018c8e0d5fbe1c2a7c793d317c69590c6a34cb1758fd1ff00f36d757c97371d08e9e9efcad1bf6fc8a0c03972296870ad825fa81000fee7aa79c2bcfab0e92d67d3d429d9a25cd6087e3139b17ce1809a6bf83d5ef40ff8e4532412adc15c63eff4eadd264860cb61b381e4f0e8a9e19cf7e39fefdfe9904b1aafe54f12289b930e341dd12b5a41eca1ae9d3556e6c7860a162652a31e256a7fa5720b4cbeb32fa65b67eb0610c6857dfe775d71de5aeb041d7ea0a7c5f335d678280b30dd014e16b37290c4c56d20df737850203010001'
In [4]: hashlib.md5(binascii.unhexlify(hex_string)).hexdigest()
Out[4]: '0c6f3dd3d5d896e0f3f49dfae0437ba1'
In [6]: hashlib.sha1(binascii.unhexlify(hex_string)).hexdigest()
Out[6]: 'fc6d7e7925e18c5bed6314ea112a230948cfde75'
In [7]: hashlib.sha256(binascii.unhexlify(hex_string)).hexdigest()
Out[7]: '73a1b42ca158112e233cd42b0352355ca1ab8cafc2475c2e888285275dbf4ab1'
In [8]: hashlib.sha512(binascii.unhexlify(hex_string)).hexdigest()
Out[8]: '500228880eb22d53cd4cc1c7b42930fef37a4034299b49198bb52cb3ab4bdca3643d952aba662b1b60df723a273af6903bf2bebe9327b0cd53548e3d9a4348f5'
Comments
Post a Comment