crypto_data_hash(Cs, Hs, Options)
is true iff Hs
is
a list of characters '0','1',...'9',a,b,c,d,e,f denoting the Base16-encoding of
a cryptographic hash of the characters Cs
, taking into account
the list Options
of crypto_data_hash-options. Direct
unification of Hs
with a computed result may leak information about
the expected hash or HMAC.
Options
:
algorithm(A)
A
, either
a variable or one of sha256
, sha384
,
or sha512
. If A
is a variable, then an
implementation-dependent algorithm I
is used,
and A
is unified with I
.
encoding(E)
E
to use for
interpreting each character of Cs
as a sequence of bytes,
either utf8
for UTF-8 encoding,
or octet
to use the character code of each
character as byte value.
hmac(Bs)
Hs
is a hash-based message
authentication code (HMAC) of Cs
, using the list
of bytes Bs
as key. The construction is
specified in RFC 2104.
crypto_data_hash(+character_list, -character_list, +crypto_data_hash_options_list)
Cs
is a partial list or a list with an element E
which is a variable
instantiation_error.
Options
is a partial list or has a list prefix with an element
E
which is a variable
instantiation_error.
Cs
is neither a list nor a partial list.
type_error(list, Cs).
Cs
is a ground list with an element E
which is not a character
type_error(character, E).
Options
is neither a partial list nor a list
type_error(list, Options).
Options
is a list with an element E
which is neither a variable nor a valid option
domain_error(crypto_data_hash_option, E).
Hs
is neither a list nor a partial list.
type_error(list, Hs).
Hs
has a list prefix with an element E
which is not a character
type_error(character, E).
?- crypto_data_hash("test", Hs, [algorithm(sha256)]). Hs = "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08".
hmac/1
option as later addition
encoding/1
and hmac/1
options as later additions