See Would Like Recommendation for an SHA256 module

If you need real protection of things, you have to encrypt them, not digest them.

If your security needs are minimal, try this old code from Perl4 days.... its fairly fast as needs no compiler to install.

#!/usr/bin/perl use strict; use warnings; my $shasum= &SHA("squeamish ossifrage\n"); print "Should be 82055066 4cf29679 2b38d164 7a4d8c0e 1966af57\n"; print "Returned: $shasum\n"; sub SHA { ### This algorithm is based on the implementation of SHA ### written by: John Allen (allen@grumman.com). ### &SHA("squeamish ossifrage\n"); ### Should return 82055066 4cf29679 2b38d164 7a4d8c0e 1966af57 my ($msg, $p, $l) = @_; #$p=0; $l=0 no strict 'refs'; no strict 'vars'; no warnings; local $_; $temp = 'D9T4C`>_-JXF8NMS^$#)4=L/2X?!:@GF9;MGKH8\;O-S*8L\'6'; $m =4294967296; @A=unpack"N*",unpack 'u',$temp; @K=splice@A,5,4; sub M{($x=pop)-($m)*int$x/$m}; sub L{$n=pop;($x=pop)<<$n|2**$n-1&$x>>32-$n} @F=(sub{$b&($c^$d)^$d},$S=sub{$b^$c^$d},sub{($b|$c)&$d|$b&$c},$S); do{ $msg=~s/.{0,64}//s;$_=$&; $l+=$r=length; $r++,$_.="\x80"if$r<64&&!$p++;@W=unpack 'N16',$_."\0"x7;$W[15]=$l*8 if$r<57; for(16..79){push@W,L$W[$_ -3]^$W[$_-8]^$W[$_-14]^$W[$_-16],1}($a,$b,$c,$d,$e)=@A; for(0..79){$t=M&{$F[$_/ 20]}+$e+$W[$_]+$K[$_/20]+L$a,5; $e=$d; $d=$c; $c=L$b,30; $b=$a; $a=$t}$v='a'; @A=map{ M$_+${$v++}}@A }while$r>56; return sprintf'%8x 'x4 . '%8x',@A; }

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku

In reply to Re: Digest::SHA options by zentara
in thread Digest::SHA options by my600080

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.