sha1#

Compute the SHA-1 digest of the concatenated arguments in one call.

Also available as Digest::SHA1::sha1_base64, Digest::SHA1::sha1_hex.

sha1 returns the 20 raw bytes, sha1_hex 40 lowercase hex digits, sha1_base64 27 Base64 characters without the = padding. No argument hashes the empty string.

Synopsis#

use Digest::SHA1 qw(sha1 sha1_hex sha1_base64);
my $hex = sha1_hex($data);
my $raw = sha1(@chunks);       # the same as sha1(join '', @chunks)

Edge cases#

  • Under -w ($^W), a call that looks like a method call warns: sha1_hex($ctx) “probably called as method”, Digest::SHA1->sha1_hex($data) “probably called as class method”, and any other single reference “called with reference argument”.

  • A character above U+00FF dies “Wide character in subroutine entry”.