Device Functions#

In the following function descriptions, HASH is used as a placeholder for the cuPQC-Hash descriptor object that is instantiated with a specific hash algorithm.

reset#

__device__ void HASH::reset()#

Reset the hash state to the initial state. This should be called before the first call to update().

update#

__device__ void HASH::update(
const uint8_t *message,
const size_t message_length
)#

Append a message into the hash state. This may be called multiple times to incrementally update a single message. This is for non-Poseidon2 hash functions.

Parameters:
  • message – Buffer containing the message.

  • message_length – Length of the message buffer.

__device__ void HASH::update(
const uint32_t *message,
const size_t message_length
)#

Append a message into the hash state. This may be called multiple times to incrementally update a single message. This is only available for Poseidon2 hash functions.

Parameters:
  • message – Buffer containing the message.

  • message_length – Length of the message buffer.

finalize#

__device__ void HASH::finalize()#

Finalizes the hash state. This should be called after the last call to update(), and before the first call to digest().

digest#

__device__ void HASH::digest(
uint8_t *digest,
const size_t digest_length
)#

Extract the hash state into a digest. This may be called multiple times to incrementally digest a single message.

Parameters:
  • digest – Buffer to which the digest will be written. Must be of length digest_length, and 8-byte aligned.

  • digest_length – Length of the digest buffer.

__device__ void HASH::digest(
uint32_t *digest,
const size_t digest_length
)#

Extract the hash state into a digest. This may be called multiple times to incrementally digest a single message. This is only available for Poseidon2 hash functions.

Parameters:
  • digest – Buffer to which the digest will be written. Must be of length digest_length, and 8-byte aligned.

  • digest_length – Length of the digest buffer.