Implementations of useful operations for the host CPU to perform.
This is mainly things like constructing a message correctly for hashing.
Summary
Functions
CheckMac operation on the host.
Generate hash using SHA-256.
MAC operation on the host.
Generate a random binary of the specified length.
Generate a nonce from a random input.
Functions
@spec checkmac(binary(), binary(), binary()) :: %{ msg: binary(), digest: binary(), other: binary() }
CheckMac operation on the host.
This is used for the ClientResp parameter when authorizing a key using CheckMac.
This implementation does not use the extra bytes of the serial number.
Returns a map of the constructed message, the digest and the OtherData used when building the message.
Generate hash using SHA-256.
@spec mac( key :: binary(), nonce :: binary(), opcode :: binary(), mode :: binary(), param2 :: binary(), serial_number :: binary() ) :: %{msg: binary(), digest: binary()}
MAC operation on the host.
This implementation does not use the extra bytes of the serial number.
Returns a map of the constructed message, the digest and the OtherData used when building the message.
@spec rand(bytes :: non_neg_integer()) :: binary()
Generate a random binary of the specified length.
Generate a nonce from a random input.
This matches the nonce implementation of the device.
It takes an input from the device RNG, the random input the host used to seed the RNG, and the nonce mode.
It returns a digest.