X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDigest.pm;h=eb7469a7d71aa0be96b80ff796166cea976adfe6;hb=002b9267a385cf8ff0e7534241cdf3798da8636c;hp=f901fdbe9ab57fddd463f2bc7f8363fade838996;hpb=ace9070d7d5593e1e5c2e54d138251cb9a931f90;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/Digest.pm b/lib/Digest.pm index f901fdb..eb7469a 100644 --- a/lib/Digest.pm +++ b/lib/Digest.pm @@ -3,7 +3,7 @@ package Digest; use strict; use vars qw($VERSION %MMAP $AUTOLOAD); -$VERSION = "1.13"; +$VERSION = "1.14"; %MMAP = ( "SHA-1" => ["Digest::SHA1", ["Digest::SHA", 1], ["Digest::SHA2", 1]], @@ -80,11 +80,18 @@ bytes or bits. An important property of the digest algorithms is that the digest is I to change if the message change in some way. Another -property is that digest functions are one-way functions, i.e. it +property is that digest functions are one-way functions, that is it should be I to find a message that correspond to some given digest. Algorithms differ in how "likely" and how "hard", as well as how efficient they are to compute. +Note that the properties of the algorithms change over time, as the +algorithms are analyzed and machines grow faster. If your application +for instance depends on it being "impossible" to generate the same +digest for a different message it is wise to make it easy to plug in +stronger algorithms as the one used grow weaker. Using the interface +documented here should make it easy to change algorithms later. + All C modules provide the same programming interface. A functional interface for simple use, as well as an object oriented interface that can handle messages of arbitrary length and which can @@ -182,7 +189,7 @@ The two argument form of add_bits() will add the first $nbits bits from data. For the last potentially partial byte only the high order C<< $nbits % 8 >> bits are used. If $nbits is greater than C<< length($data) * 8 >>, then this method would do the same as C<< -$ctx->add($data) >>, i.e. $nbits is silently ignored. +$ctx->add($data) >>, that is $nbits is silently ignored. The one argument form of add_bits() takes a $bitstring of "1" and "0" chars as argument. It's a shorthand for C<< $ctx->add_bits(pack("B*",