My objective is to perform “Hash signing” using smart card in Python. There are hashlib
s used, but there are no specific SHA1 or SHA256 functions in python.
My Work:
hash_object = hashlib.sha1(b'HelWorld')
pbHash = hash_object.hexdigest()
But the length of the hash object I get is 28. Rather, I should get 14 or 20 so that I can switch on condition as:[1]
switch ( dwHashLen )
{
case 0x14: // SHA1 hash
// call scard transmit
case 0x20: // SHA256 hash
// ...
}
Any help is appreciated. Thank you in advance.
[1] This is a portion of the C code I'm currently porting to Python.
switch
andcase
that is surely not python... – Caty.digest()
not.hexdigest()
to get the binary hash not the hex encoded one. – Phenylalanine