NAME

Template::Plugin::Digest::SHA3 - TT2 interface to the SHA3 Algorithm

SYNOPSIS

[% USE Digest.SHA3 -%]
[% checksum = content FILTER sha3 -%]
[% checksum = content FILTER sha3_hex -%]
[% checksum = content FILTER sha3_base64 -%]
[% checksum = content.sha3 -%]
[% checksum = content.sha3_hex -%]
[% checksum = content.sha3_base64 -%]

DESCRIPTION

The Digest.SHA3 Template Toolkit plugin provides access to the NIST SHA-1 algorithm via the Digest::SHA3 module. It is used like a plugin but installs filters and vmethods into the current context.

When you invoke

[% USE Digest.SHA3 %]

the following filters (and vmethods of the same name) are installed into the current context:

sha3

Calculate the SHA-2 digest of the input, and return it in binary form.

sha3_hex

Same as sha3, but will return the digest in hexadecimal form. The returned string will only contain characters from this set: '0'..'9' and 'a'..'f'.

sha3_base64

Same as sha3, but will return the digest as a base64 encoded string. The returned string will only contain characters from this set: 'A'..'Z', 'a'..'z', '0'..'9', '+' and '/'.

As the filters are also available as vmethods the following are all equivalent:

FILTER sha3_hex; content; END;
content FILTER sha3_hex;
content.sha3_base64;

Bit length

By default the checksum is produced with a 256 bit length string. The supported bit lengths are 224, 256, 384, and 512, which are set as follows:

[% USE Digest.SHA3(224) %]
[% USE Digest.SHA3(256) %]
[% USE Digest.SHA3(384) %]
[% USE Digest.SHA3(512) %]

SEE ALSO

Digest::SHA3, Template

AUTHOR

Barbie <barbie@cpan.org>

COPYRIGHT & LICENSE

Copyright (C) 2014 Barbie for Miss Barbell Productions.

This distribution is free software; you can redistribute it and/or modify it under the Artistic Licence v2.