.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man v6.0.2 (Pod::Simple 3.45) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Required to disable full justification in groff 1.23.0. .if n .ds AD l .\" ======================================================================== .\" .IX Title "Crypt::Digest::MD4 3" .TH Crypt::Digest::MD4 3 2026-05-12 "perl v5.42.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Crypt::Digest::MD4 \- Hash function MD4 [size: 128 bits] .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 3 \& ### Functional interface: \& use Crypt::Digest::MD4 qw( md4 md4_hex md4_b64 md4_b64u \& md4_file md4_file_hex md4_file_b64 md4_file_b64u ); \& \& # calculate digest from string/buffer \& my $data = \*(Aqdata string\*(Aq; \& my $md4_raw = md4($data); \& my $md4_hex = md4_hex($data); \& my $md4_b64 = md4_b64($data); \& my $md4_b64u = md4_b64u($data); \& # or from file \& my $md4_file_raw = md4_file(\*(Aqfilename.dat\*(Aq); \& my $md4_file_hex = md4_file_hex(\*(Aqfilename.dat\*(Aq); \& my $md4_file_b64 = md4_file_b64(\*(Aqfilename.dat\*(Aq); \& my $md4_file_b64u = md4_file_b64u(\*(Aqfilename.dat\*(Aq); \& # or from filehandle \& my $filehandle = ...; # existing binary\-mode filehandle \& my $md4_fh_raw = md4_file($filehandle); \& my $md4_fh_hex = md4_file_hex($filehandle); \& my $md4_fh_b64 = md4_file_b64($filehandle); \& my $md4_fh_b64u = md4_file_b64u($filehandle); \& \& ### OO interface: \& use Crypt::Digest::MD4; \& \& my $d = Crypt::Digest::MD4\->new; \& $d\->add(\*(Aqany data\*(Aq); \& my $result_raw = $d\->digest; # raw bytes \& my $result_hex = $d\->hexdigest; # hexadecimal form \& my $result_b64 = $d\->b64digest; # Base64 form \& my $result_b64u = $d\->b64udigest; # Base64 URL\-safe form \& \& # or hash a file instead \& my $file_result_raw = Crypt::Digest::MD4\->new\->addfile(\*(Aqfilename.dat\*(Aq)\->digest; .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" Provides an interface to the MD4 digest algorithm. .SH EXPORT .IX Header "EXPORT" Nothing is exported by default. .PP You can export selected functions: .PP .Vb 2 \& use Crypt::Digest::MD4 qw(md4 md4_hex md4_b64 md4_b64u \& md4_file md4_file_hex md4_file_b64 md4_file_b64u); .Ve .PP Or all of them at once: .PP .Vb 1 \& use Crypt::Digest::MD4 \*(Aq:all\*(Aq; .Ve .SH FUNCTIONS .IX Header "FUNCTIONS" .SS md4 .IX Subsection "md4" Joins all arguments into a single string and returns its MD4 digest encoded as a binary string. .PP Data arguments for the functional helpers are converted to byte strings using Perl\*(Aqs usual scalar stringification. Defined scalars, including numbers and string\-overloaded objects, are accepted. \f(CW\*(C`undef\*(C'\fR is treated as an empty string and may emit Perl\*(Aqs usual "uninitialized value" warning. The same rules apply to \f(CW\*(C`md4_hex\*(C'\fR, \f(CW\*(C`md4_b64\*(C'\fR, and \&\f(CW\*(C`md4_b64u\*(C'\fR. .PP .Vb 3 \& my $md4_raw = md4(\*(Aqdata string\*(Aq); \& #or \& my $md4_raw = md4(\*(Aqany data\*(Aq, \*(Aqmore data\*(Aq, \*(Aqeven more data\*(Aq); .Ve .SS md4_hex .IX Subsection "md4_hex" Joins all arguments into a single string and returns its MD4 digest encoded as a hexadecimal string. .PP .Vb 3 \& my $md4_hex = md4_hex(\*(Aqdata string\*(Aq); \& #or \& my $md4_hex = md4_hex(\*(Aqany data\*(Aq, \*(Aqmore data\*(Aq, \*(Aqeven more data\*(Aq); .Ve .SS md4_b64 .IX Subsection "md4_b64" Joins all arguments into a single string and returns its MD4 digest encoded as a Base64 string, \fBwith\fR trailing \*(Aq=\*(Aq padding. .PP .Vb 3 \& my $md4_b64 = md4_b64(\*(Aqdata string\*(Aq); \& #or \& my $md4_b64 = md4_b64(\*(Aqany data\*(Aq, \*(Aqmore data\*(Aq, \*(Aqeven more data\*(Aq); .Ve .SS md4_b64u .IX Subsection "md4_b64u" Joins all arguments into a single string and returns its MD4 digest encoded as a Base64 URL\-safe string (see RFC 4648 section 5). .PP .Vb 3 \& my $md4_b64url = md4_b64u(\*(Aqdata string\*(Aq); \& #or \& my $md4_b64url = md4_b64u(\*(Aqany data\*(Aq, \*(Aqmore data\*(Aq, \*(Aqeven more data\*(Aq); .Ve .SS md4_file .IX Subsection "md4_file" Reads a file given by a filename or filehandle and returns its MD4 digest encoded as a binary string. .PP .Vb 4 \& my $md4_raw = md4_file(\*(Aqfilename.dat\*(Aq); \& #or \& my $filehandle = ...; # existing binary\-mode filehandle \& my $md4_raw = md4_file($filehandle); .Ve .SS md4_file_hex .IX Subsection "md4_file_hex" Reads a file given by a filename or filehandle and returns its MD4 digest encoded as a hexadecimal string. .PP .Vb 4 \& my $md4_hex = md4_file_hex(\*(Aqfilename.dat\*(Aq); \& #or \& my $filehandle = ...; # existing binary\-mode filehandle \& my $md4_hex = md4_file_hex($filehandle); .Ve .PP \&\fBNote:\fR The filehandle must be in binary mode before you pass it to \f(CWaddfile()\fR. .SS md4_file_b64 .IX Subsection "md4_file_b64" Reads a file given by a filename or filehandle and returns its MD4 digest encoded as a Base64 string, \fBwith\fR trailing \*(Aq=\*(Aq padding. .PP .Vb 4 \& my $md4_b64 = md4_file_b64(\*(Aqfilename.dat\*(Aq); \& #or \& my $filehandle = ...; # existing binary\-mode filehandle \& my $md4_b64 = md4_file_b64($filehandle); .Ve .SS md4_file_b64u .IX Subsection "md4_file_b64u" Reads a file given by a filename or filehandle and returns its MD4 digest encoded as a Base64 URL\-safe string (see RFC 4648 section 5). .PP .Vb 4 \& my $md4_b64url = md4_file_b64u(\*(Aqfilename.dat\*(Aq); \& #or \& my $filehandle = ...; # existing binary\-mode filehandle \& my $md4_b64url = md4_file_b64u($filehandle); .Ve .SH METHODS .IX Header "METHODS" The OO interface provides the same set of functions as Crypt::Digest. Unless noted otherwise, assume \f(CW$d\fR is an existing digest object created via \&\f(CW\*(C`new\*(C'\fR, for example: .PP .Vb 1 \& my $d = Crypt::Digest::MD4\->new(); .Ve .SS new .IX Subsection "new" .Vb 1 \& my $d = Crypt::Digest::MD4\->new(); .Ve .SS clone .IX Subsection "clone" .Vb 1 \& $d\->clone(); .Ve .SS reset .IX Subsection "reset" .Vb 1 \& $d\->reset(); .Ve .SS add .IX Subsection "add" Appends data to the message. Returns the object itself (for chaining). .PP Each argument is converted to bytes using Perl\*(Aqs usual scalar stringification. Defined scalars, including numbers and string\-overloaded objects, are accepted. \f(CW\*(C`undef\*(C'\fR is treated as an empty string and may emit Perl\*(Aqs usual "uninitialized value" warning. .PP .Vb 3 \& $d\->add(\*(Aqany data\*(Aq); \& #or \& $d\->add(\*(Aqany data\*(Aq, \*(Aqmore data\*(Aq, \*(Aqeven more data\*(Aq); .Ve .SS addfile .IX Subsection "addfile" Reads the file content and appends it to the message. Returns the object itself (for chaining). .PP .Vb 4 \& $d\->addfile(\*(Aqfilename.dat\*(Aq); \& #or \& my $filehandle = ...; # existing binary\-mode filehandle \& $d\->addfile($filehandle); .Ve .SS hashsize .IX Subsection "hashsize" .Vb 5 \& $d\->hashsize; \& #or \& Crypt::Digest::MD4\->hashsize(); \& #or \& Crypt::Digest::MD4::hashsize(); .Ve .SS digest .IX Subsection "digest" Returns the binary digest (raw bytes). The first call finalizes the digest object. Any later \f(CWadd()\fR, \&\f(CWaddfile()\fR, \f(CWdigest()\fR, \f(CWhexdigest()\fR, \f(CWb64digest()\fR, or \&\f(CWb64udigest()\fR call will fail until you call \f(CWreset()\fR. .PP .Vb 1 \& my $result_raw = $d\->digest(); .Ve .SS hexdigest .IX Subsection "hexdigest" Returns the digest encoded as a lowercase hexadecimal string. Like \f(CWdigest()\fR, the first call finalizes the digest object. .PP .Vb 1 \& my $result_hex = $d\->hexdigest(); .Ve .SS b64digest .IX Subsection "b64digest" Returns the digest encoded as a Base64 string with trailing \f(CW\*(C`=\*(C'\fR padding. Like \f(CWdigest()\fR, the first call finalizes the digest object. .PP .Vb 1 \& my $result_b64 = $d\->b64digest(); .Ve .SS b64udigest .IX Subsection "b64udigest" Returns the digest encoded as a Base64 URL\-safe string (no trailing \f(CW\*(C`=\*(C'\fR). Like \f(CWdigest()\fR, the first call finalizes the digest object. .PP .Vb 1 \& my $result_b64url = $d\->b64udigest(); .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" .IP \(bu 4 CryptX, Crypt::Digest .IP \(bu 4