From Digest1:
This is the most compact form, but it is not well suited for printing or embedding in places that can't handle arbitrary data.
- binary
Consider using sha256_base64, or stick with sha256_hex:
#! perl use strict; use warnings; use Digest::SHA qw(sha256_hex sha256_base64); my $data1 = '0123456789ABCDEF'; my $data2 = 'FEDCBA9876543210'; my $digest1 = sha256_hex ($data1 . $data2); my $digest3 = sha256_base64($data1 . $data2); print "This is a hexdigest->" . $digest1, "\n"; print "This is a base64digest->" . $digest3, "\n";
Output:
This is a hexdigest->b4a5e0ad9fce13bf90bcb09147ba9200431389e28fa40eaa2 +a0dcd41d6544470 This is a base64digest->tKXgrZ/OE7+QvLCRR7qSAEMTieKPpA6qKg3NQdZURHA
What output format do you need?
1 Referencing Digest, because SHA says: “The programming interface is easy to use: it’s the same one found in CPAN’s Digest module.”
Athanasius <°(((>< contra mundum
In reply to Re: Digest sha256 returns gibberish
by Athanasius
in thread Digest sha256 returns gibberish
by invalid_logic
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |