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.

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.