-
-
03 Sep 2014 02:05:22 UTC
- Distribution: Template-Plugin-Digest-SHA2
- Module version: 0.01
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Repository
- Issues (1)
- Testers (225 / 0 / 0)
- Kwalitee
Bus factor: 0- 100.00% Coverage
- License: artistic_2
- Perl: v5.6.0
- Activity
24 month- Tools
- Download (5.62KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
NAME
Template::Plugin::Digest::SHA2 - TT2 interface to the SHA2 Algorithm
SYNOPSIS
[% USE Digest.SHA2 -%] [% checksum = content FILTER sha2 -%] [% checksum = content FILTER sha2_hex -%] [% checksum = content FILTER sha2_base64 -%] [% checksum = content.sha2 -%] [% checksum = content.sha2_hex -%] [% checksum = content.sha2_base64 -%]
DESCRIPTION
The Digest.SHA2 Template Toolkit plugin provides access to the NIST SHA-1 algorithm via the
Digest::SHA2
module. It is used like a plugin but installs filters and vmethods into the current context.When you invoke
[% USE Digest.SHA2 %]
the following filters (and vmethods of the same name) are installed into the current context:
sha2
-
Calculate the SHA-2 digest of the input, and return it in binary form.
sha2_hex
-
Same as
sha2
, but will return the digest in hexadecimal form. The returned string will only contain characters from this set: '0'..'9' and 'a'..'f'. sha2_base64
-
Same as
sha2
, 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 sha2_hex; content; END; content FILTER sha2_hex; content.sha2_base64;
Bit length
By default the checksum is produced with a 256 bit length string. The supported bit lengths are 256, 384 and 512, which are set as follows:
[% USE Digest.SHA2(256) %] [% USE Digest.SHA2(384) %] [% USE Digest.SHA2(512) %]
SEE ALSO
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.
Module Install Instructions
To install Template::Plugin::Digest::SHA2, copy and paste the appropriate command in to your terminal.
cpanm Template::Plugin::Digest::SHA2
perl -MCPAN -e shell install Template::Plugin::Digest::SHA2
For more information on module installation, please visit the detailed CPAN module installation guide.