For the latest stable version, please use Botan 1.1!

botan.hash_function

local hash_function = require "botan".hash_function

Functions

create(algo_spec: string[, provider: string]) → hash_function|nil

Return a newly allocated hash function object, or nil if algo_spec is not recognized.

create_or_throw(algo_spec: string[, provider: string]) → hash_function

Like create except that it will throw an exception instead of returning nil.

providers(algo_spec: string) → string[]

Returns the list of available providers for this algorithm, empty if not available.

update(self, input: byte_span|string)

Updates the computation with input.

final(self)

function final(self, out: byte_span)     (1)
function final(self) -> secure_byte_span (2)
1 Place the result into out. Exactly output_length bytes will be written.
2 Returns the result in a newly allocated secure_byte_span.

Finalize the calculation. After you call final, the algorithm is reset to its initial state, so it may be reused immediately.

process(self, input: byte_span|string) → secure_byte_span

Equivalent to calling update followed by final.

new_object(self) → hash_function

Return a newly allocated HashFunction object of the same type as this one.

copy_state(self) → hash_function

Return a newly allocated HashFunction object of the same type as this one, whose internal state matches the current state of this.

clear(self)

Reset the state.

Properties

output_length: integer

The size (in bytes) of the output of this function.

name: string

The hash function name.

provider: string

Provider information about this implementation. Default is "base", might also return "sse2", "avx2", "openssl", or some other arbitrary string.

hash_block_size: integer

Hash block size as defined for this algorithm.