1Digest::Perl::MD5(3)  User Contributed Perl Documentation Digest::Perl::MD5(3)
2
3
4

NAME

6       Digest::MD5::Perl - Perl implementation of Ron Rivests MD5 Algorithm
7

DISCLAIMER

9       This is not an interface (like "Digest::MD5") but a Perl implementation
10       of MD5.  It is written in perl only and because of this it is slow but
11       it works without C-Code.  You should use "Digest::MD5" instead of this
12       module if it is available.  This module is only useful for
13
14       •   computers where you cannot install "Digest::MD5" (e.g. lack of a
15           C-Compiler)
16
17       •   encrypting only small amounts of data (less than one million
18           bytes). I use it to hash passwords.
19
20       •   educational purposes
21

SYNOPSIS

23        # Functional style
24        use Digest::MD5  qw(md5 md5_hex md5_base64);
25
26        $hash = md5 $data;
27        $hash = md5_hex $data;
28        $hash = md5_base64 $data;
29
30
31        # OO style
32        use Digest::MD5;
33
34        $ctx = Digest::MD5->new;
35
36        $ctx->add($data);
37        $ctx->addfile(*FILE);
38
39        $digest = $ctx->digest;
40        $digest = $ctx->hexdigest;
41        $digest = $ctx->b64digest;
42

DESCRIPTION

44       This modules has the same interface as the much faster "Digest::MD5".
45       So you can easily exchange them, e.g.
46
47               BEGIN {
48                 eval {
49                   require Digest::MD5;
50                   import Digest::MD5 'md5_hex'
51                 };
52                 if ($@) { # ups, no Digest::MD5
53                   require Digest::Perl::MD5;
54                   import Digest::Perl::MD5 'md5_hex'
55                 }
56               }
57
58       If the "Digest::MD5" module is available it is used and if not you take
59       "Digest::Perl::MD5".
60
61       You can also install the Perl part of Digest::MD5 together with
62       Digest::Perl::MD5 and use Digest::MD5 as normal, it falls back to
63       Digest::Perl::MD5 if it cannot load its object files.
64
65       For a detailed Documentation see the "Digest::MD5" module.
66

EXAMPLES

68       The simplest way to use this library is to import the md5_hex()
69       function (or one of its cousins):
70
71           use Digest::Perl::MD5 'md5_hex';
72           print 'Digest is ', md5_hex('foobarbaz'), "\n";
73
74       The above example would print out the message
75
76           Digest is 6df23dc03f9b54cc38a0fc1483df6e21
77
78       provided that the implementation is working correctly.  The same
79       checksum can also be calculated in OO style:
80
81           use Digest::MD5;
82
83           $md5 = Digest::MD5->new;
84           $md5->add('foo', 'bar');
85           $md5->add('baz');
86           $digest = $md5->hexdigest;
87
88           print "Digest is $digest\n";
89
90       The digest methods are destructive. That means you can only call them
91       once and the $md5 objects is reset after use. You can make a copy with
92       clone:
93
94               $md5->clone->hexdigest
95

LIMITATIONS

97       This implementation of the MD5 algorithm has some limitations:
98
99       •   It's slow, very slow. I've done my very best but Digest::MD5 is
100           still about 100 times faster.  You can only encrypt Data up to one
101           million bytes in an acceptable time. But it's very useful for
102           encrypting small amounts of data like passwords.
103
104       •   You can only encrypt up to 2^32 bits = 512 MB on 32bit archs. But
105           You should use "Digest::MD5" for those amounts of data anyway.
106

SEE ALSO

108       Digest::MD5
109
110       md5(1)
111
112       RFC 1321
113
114       tools/md5: a small BSD compatible md5 tool written in pure perl.
115
117       This library is free software; you can redistribute it and/or modify it
118       under the same terms as Perl itself.
119
120        Copyright 2000 Christian Lackas, Imperia Software Solutions
121        Copyright 1998-1999 Gisle Aas.
122        Copyright 1995-1996 Neil Winton.
123        Copyright 1991-1992 RSA Data Security, Inc.
124
125       The MD5 algorithm is defined in RFC 1321. The basic C code implementing
126       the algorithm is derived from that in the RFC and is covered by the
127       following copyright:
128
129       •   Copyright (C) 1991-1992, RSA Data Security, Inc. Created 1991. All
130           rights reserved.
131
132           License to copy and use this software is granted provided that it
133           is identified as the "RSA Data Security, Inc. MD5 Message-Digest
134           Algorithm" in all material mentioning or referencing this software
135           or this function.
136
137           License is also granted to make and use derivative works provided
138           that such works are identified as "derived from the RSA Data
139           Security, Inc. MD5 Message-Digest Algorithm" in all material
140           mentioning or referencing the derived work.
141
142           RSA Data Security, Inc. makes no representations concerning either
143           the merchantability of this software or the suitability of this
144           software for any particular purpose. It is provided "as is" without
145           express or implied warranty of any kind.
146
147           These notices must be retained in any copies of any part of this
148           documentation and/or software.
149
150       This copyright does not prohibit distribution of any version of Perl
151       containing this extension under the terms of the GNU or Artistic
152       licenses.
153

AUTHORS

155       The original MD5 interface was written by Neil Winton (<N.Winton (at)
156       axion.bt.co.uk>).
157
158       "Digest::MD5" was made by Gisle Aas <gisle (at) aas.no> (I took his
159       Interface and part of the documentation).
160
161       Thanks to Guido Flohr for his 'use integer'-hint.
162
163       This release was made by Christian Lackas <delta (at) lackas.net>.
164
165
166
167perl v5.38.0                      2023-07-20              Digest::Perl::MD5(3)
Impressum