Key of HMAC should be only a string
dinosaure opened this issue · comments
Calascibetta Romain commented
Currently, digestif
provides:
val hmac_string : key:string -> ?off:int -> ?len:int -> string -> t
val hmac_bytes : key:bytes -> ?off:int -> ?len:int -> bytes -> t
val hmac_bigstring : key:bigstring -> ?off:int -> ?len:int -> bigstring -> t
A look into GitHub repositories which use digestif
(which is not relevant) shows me that nobody uses hmac_{bytes,bigstring}
. The purpose of the key
is to be hidden and constant. So we probably should enforce the fact that the key
must be a string
for all of these functions.
This is a proposal of @hannesm and I agree with that. If someone has some regards about this breaking-changes, this issue exists for that 👍. I will let this issue open for 1 week, then, I will propose a pull-request according this issue.
Calascibetta Romain commented
So, I think it's time to propose a PR about this new API.