refactor crypto tests

This commit is contained in:
Livio Amstutz
2020-03-30 11:26:02 +02:00
parent 106a6ec143
commit e04c0116f5
4 changed files with 328 additions and 58 deletions

View File

@@ -99,5 +99,8 @@ func Hash(value []byte, alg HashAlgorithm) (*CryptoValue, error) {
}
func CompareHash(value *CryptoValue, comparer []byte, alg HashAlgorithm) error {
if value.Algorithm != alg.Algorithm() {
return errors.ThrowInvalidArgument(nil, "CRYPT-HF32f", "value was hash with a different algorithm")
}
return alg.CompareHash(value.Crypted, comparer)
}