llHMAC: Make more elaborate tests and allow running them

This commit is contained in:
Sei Lisa 2023-03-08 19:32:49 +01:00
parent 500a8bb751
commit e4c9627772
4 changed files with 26 additions and 3 deletions

View file

@ -1325,7 +1325,7 @@ def llHMAC(pwd, data, alg):
elif alg == u'sha512':
hash = hashlib.sha512()
if hash is None:
raise ELSLCantCompute # we don't have info on how it behaves yet
raise ELSLCantCompute # spews error
# Calculate the HMAC here, to avoid requiring yet another module
if len(pwd) > hash.block_size:
tmp = hash.copy()

View file

@ -1,4 +1,16 @@
[ llHMAC("a", "b", "sha1")
[ llHMAC("", "", "md5")
, llHMAC("", "", "sha1")
, llHMAC("", "", "sha224")
, llHMAC("", "", "sha256")
, llHMAC("", "", "sha384")
, llHMAC("", "", "sha512")
, llHMAC("a", "b", "md5")
, llHMAC("a", "b", "sha1")
, llHMAC("a", "b", "sha224")
, llHMAC("a", "b", "sha256")
, llHMAC("a", "b", "sha384")
, llHMAC("a", "b", "sha512")
// example from the wiki (?)
, llHMAC("-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEAqxXSIhFHzYO9UNEUvMMXwhB4vf32fPirCxxV/w4m88jKPmFH
QQe9DOwj7illmvg+81vzBNGt+uNYy/2zFegUtwvxKCEioeoanRpPcvn9r/d/kXad

View file

@ -1,3 +1,14 @@
[ "ZleFVoaCOYbIdDYnMROXUgFMtgs="
[ "dOb3KYqcLRaJNfWMAButiA=="
, "+9sdGxiqbAgyS31ktx+3Y3BpDh0="
, "XOFPcolGYiE+J0jSprojS3QmORDO3eL1qScVJA=="
, "thNnmggU2ex3L5XXeMNfxf8Wl8STcVZTxscSFEKSxa0="
, "bB8u6Tj60uJL2RKYR0OCyiGMdds9g+EUs9Q2d3bRTTVRKJ516CCc1LeSMChAI0rc"
, "uTbO6Gyfh6pdPG8uhMtaQjml/lBICm7Ga3CrWx9KxnMMbFFUIbMn7B1pQC5T37Sa1zgesGezOP17DLIiRyJdRw=="
, "5jDnum4zM2HVxialQtChxg=="
, "ZleFVoaCOYbIdDYnMROXUgFMtgs="
, "K6UDpxjSoOO8Ciu7RB22U2tcHSSvyTOgKM1bbg=="
, "CN4ymTHilWg3dqqaQ1Kb0LJ1KG3zFgMAxJuk6EGDMBM="
, "spNXIbhwG93+hStMAWU+44zMRJg+DspwqqSoVl2RJZEvZVZK9Z4s7Hg6y8mXPxR7"
, "2YlC1pp1xhoI0rxitjrtqcj+bjRJO6EFFRAjQKMkdLBhgBPBLnm2mmWQjie0VZLDm7SgO1qE41sBDvyQMO2N+A=="
, "xK/3hcR1IVpVK9vftoztuVRGZFE="
]