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;
}
|