OpenBSD::md5(3p) Perl Programmers Reference Guide OpenBSD::md5(3p)

OpenBSD::md5(3p) Perl Programmers Reference Guide OpenBSD::md5(3p) #

OpenBSD::md5(3p) Perl Programmers Reference Guide OpenBSD::md5(3p)

NNAAMMEE #

 OpenBSD::md5 - simple interface to sha256 digests

SSYYNNOOPPSSIISS #

     use OpenBSD::md5;

     my $sha = OpenBSD::sha->new($filename);
     $k->{$sha->key} = $filename;

     my $ck2 = $sha->new($filename2);

     if ($ck2->equals($sha)) {
          ...
     }

     print $sha->stringize # provides a base64 representation
     my $ck3 = $s->fromstring; # decodes both base64 and hex

DDEESSCCRRIIPPTTIIOONN #

 "OpenBSD::md5" provides an object-oriented interface to cryptographic
 hashing facilities for use in the ports tree.

 In particular, it provides an abstraction to build crypto hashes from
 files, convert from and to text, and compare two checksums while keeping
 the user from making low-level decisions.

 The module itself is called "OpenBSD::md5" for historical reasons, but
 the module only provides a "OpenBSD::sha"  class, that produces and
 writes sha256 digests.

 The "OpenBSD::md5" class itself was removed a few years ago.

 $o = $class->new($filename)
         create a new digest object from the contents of a file.

 $o = $class->fromstring($string)
         create a new digest object from a string representation.

 $o2 = $o->new($filename) / $o->fromstring($string)
         create a new digest object $o2 of the same type as $o.

 $o->equals($o2)
         compare two digest objects. Returns true only if they match.

 $h{$o->key} = ...
         return the actual digest as a binary string, for use as a key in
         hashing.

 $s = $o->stringize
         convert the digest into a suitable text representation.

 $o->write($fh)
         writes an appropriate digest annotation on a packing-list
         filehandle (see OOppeennBBSSDD::::PPaacckkiinnggLLiisstt(3p) and ppkkgg__ccrreeaattee(1)).

SSEEEE AALLSSOO #

 cckkssuumm(1) , DDiiggeesstt::::SSHHAA(3p) , MMiimmee::::BBaassee6644(3p)

perl v5.36.3 2023-05-16 OpenBSD::md5(3p)