.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" 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 .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . 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 .\" ======================================================================== .\" .IX Title "Digest::Perl::MD5 3pm" .TH Digest::Perl::MD5 3pm "2022-10-13" "perl v5.34.0" "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" Digest::MD5::Perl \- Perl implementation of Ron Rivests MD5 Algorithm .SH "DISCLAIMER" .IX Header "DISCLAIMER" This is \fBnot\fR an interface (like \f(CW\*(C`Digest::MD5\*(C'\fR) but a Perl implementation of \s-1MD5.\s0 It is written in perl only and because of this it is slow but it works without C\-Code. You should use \f(CW\*(C`Digest::MD5\*(C'\fR instead of this module if it is available. This module is only useful for .IP "\(bu" 4 computers where you cannot install \f(CW\*(C`Digest::MD5\*(C'\fR (e.g. lack of a C\-Compiler) .IP "\(bu" 4 encrypting only small amounts of data (less than one million bytes). I use it to hash passwords. .IP "\(bu" 4 educational purposes .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& # Functional style \& use Digest::MD5 qw(md5 md5_hex md5_base64); \& \& $hash = md5 $data; \& $hash = md5_hex $data; \& $hash = md5_base64 $data; \& \& \& # OO style \& use Digest::MD5; \& \& $ctx = Digest::MD5\->new; \& \& $ctx\->add($data); \& $ctx\->addfile(*FILE); \& \& $digest = $ctx\->digest; \& $digest = $ctx\->hexdigest; \& $digest = $ctx\->b64digest; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This modules has the same interface as the much faster \f(CW\*(C`Digest::MD5\*(C'\fR. So you can easily exchange them, e.g. .PP .Vb 10 \& BEGIN { \& eval { \& require Digest::MD5; \& import Digest::MD5 \*(Aqmd5_hex\*(Aq \& }; \& if ($@) { # ups, no Digest::MD5 \& require Digest::Perl::MD5; \& import Digest::Perl::MD5 \*(Aqmd5_hex\*(Aq \& } \& } .Ve .PP If the \f(CW\*(C`Digest::MD5\*(C'\fR module is available it is used and if not you take \&\f(CW\*(C`Digest::Perl::MD5\*(C'\fR. .PP You can also install the Perl part of Digest::MD5 together with Digest::Perl::MD5 and use Digest::MD5 as normal, it falls back to Digest::Perl::MD5 if it cannot load its object files. .PP For a detailed Documentation see the \f(CW\*(C`Digest::MD5\*(C'\fR module. .SH "EXAMPLES" .IX Header "EXAMPLES" The simplest way to use this library is to import the \fBmd5_hex()\fR function (or one of its cousins): .PP .Vb 2 \& use Digest::Perl::MD5 \*(Aqmd5_hex\*(Aq; \& print \*(AqDigest is \*(Aq, md5_hex(\*(Aqfoobarbaz\*(Aq), "\en"; .Ve .PP The above example would print out the message .PP .Vb 1 \& Digest is 6df23dc03f9b54cc38a0fc1483df6e21 .Ve .PP provided that the implementation is working correctly. The same checksum can also be calculated in \s-1OO\s0 style: .PP .Vb 1 \& use Digest::MD5; \& \& $md5 = Digest::MD5\->new; \& $md5\->add(\*(Aqfoo\*(Aq, \*(Aqbar\*(Aq); \& $md5\->add(\*(Aqbaz\*(Aq); \& $digest = $md5\->hexdigest; \& \& print "Digest is $digest\en"; .Ve .PP The digest methods are destructive. That means you can only call them once and the \f(CW$md5\fR objects is reset after use. You can make a copy with clone: .PP .Vb 1 \& $md5\->clone\->hexdigest .Ve .SH "LIMITATIONS" .IX Header "LIMITATIONS" This implementation of the \s-1MD5\s0 algorithm has some limitations: .IP "\(bu" 4 It's slow, very slow. I've done my very best but Digest::MD5 is still about 100 times faster. You can only encrypt Data up to one million bytes in an acceptable time. But it's very useful for encrypting small amounts of data like passwords. .IP "\(bu" 4 You can only encrypt up to 2^32 bits = 512 \s-1MB\s0 on 32bit archs. But You should use \f(CW\*(C`Digest::MD5\*(C'\fR for those amounts of data anyway. .SH "SEE ALSO" .IX Header "SEE ALSO" Digest::MD5 .PP \&\fBmd5\fR\|(1) .PP \&\s-1RFC 1321\s0 .PP tools/md5: a small \s-1BSD\s0 compatible md5 tool written in pure perl. .SH "COPYRIGHT" .IX Header "COPYRIGHT" This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .PP .Vb 4 \& Copyright 2000 Christian Lackas, Imperia Software Solutions \& Copyright 1998\-1999 Gisle Aas. \& Copyright 1995\-1996 Neil Winton. \& Copyright 1991\-1992 RSA Data Security, Inc. .Ve .PP The \s-1MD5\s0 algorithm is defined in \s-1RFC 1321.\s0 The basic C code implementing the algorithm is derived from that in the \s-1RFC\s0 and is covered by the following copyright: .IP "\(bu" 4 Copyright (C) 1991\-1992, \s-1RSA\s0 Data Security, Inc. Created 1991. All rights reserved. .Sp License to copy and use this software is granted provided that it is identified as the \*(L"\s-1RSA\s0 Data Security, Inc. \s-1MD5\s0 Message-Digest Algorithm\*(R" in all material mentioning or referencing this software or this function. .Sp License is also granted to make and use derivative works provided that such works are identified as \*(L"derived from the \s-1RSA\s0 Data Security, Inc. \s-1MD5\s0 Message-Digest Algorithm\*(R" in all material mentioning or referencing the derived work. .Sp \&\s-1RSA\s0 Data Security, Inc. makes no representations concerning either the merchantability of this software or the suitability of this software for any particular purpose. It is provided \*(L"as is\*(R" without express or implied warranty of any kind. .Sp These notices must be retained in any copies of any part of this documentation and/or software. .PP This copyright does not prohibit distribution of any version of Perl containing this extension under the terms of the \s-1GNU\s0 or Artistic licenses. .SH "AUTHORS" .IX Header "AUTHORS" The original \s-1MD5\s0 interface was written by Neil Winton (). .PP \&\f(CW\*(C`Digest::MD5\*(C'\fR was made by Gisle Aas (I took his Interface and part of the documentation). .PP Thanks to Guido Flohr for his 'use integer'-hint. .PP This release was made by Christian Lackas .