NAME
Crypt::Bear::Hash - hash implementations in BearSSL
VERSION
version 0.002
SYNOPSIS
my $digester = Crypt::Bear::Hash->new('sha226');
while(<>) {
$digester->update($_);
}
say unpack 'H*', $digester->out;
DESCRIPTION
This represents a streaming implementation of common hash functions.
METHODS
new($digest)
This creates a new hasher. The digest name must be one of the following.
'md5'
'sha1'
'sha224'
'sha256'
'sha384'
'sha512'
update(data)
Add some more bytes to the hash computation represented by the provided context.
out()
This returns the hash based on the current state. The context is NOT modified by this operation, so this function can be used to get a "partial hash" while still keeping the possibility of adding more bytes to the input.
state()
Get a copy of the "current state" for the computation so far. For MD functions (MD5, SHA-1, SHA-2 family), this is the running state resulting from the processing of the last complete input block.
set_state($state)
Set the internal state to the provided values. $state
shall match that which was obtained from state()
. This restores the hash state only if the state values were at an appropriate block boundary.
output_size()
The size of the output of this hash.
digest()
Returns the digest name for this hash.
AUTHOR
Leon Timmermans <fawaka@gmail.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2024 by Leon Timmermans.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.