7 # subclass is supposed to implement at least these
15 $self->new(@_); # ugly
19 my ($self, $handle) = @_;
24 while (($n = read($handle, $buf, 4*1024))) {
29 Carp::croak("Read failed: $!");
41 $bits = pack("B*", $arg);
42 $nbits = length($arg);
47 if (($nbits % 8) != 0) {
49 Carp::croak("Number of bits must be multiple of 8 for this algorithm");
51 return $self->add(substr($bits, 0, $nbits/8));
56 return unpack("H*", $self->digest(@_));
62 my $b64 = MIME::Base64::encode($self->digest(@_), "");
73 Digest::base - Digest base class
78 use base 'Digest::base';
82 The C<Digest::base> class provide implementations of the methods
83 C<addfile> and C<add_bits> in terms of C<add>, and of the methods
84 C<hexdigest> and C<b64digest> in terms of C<digest>.
86 Digest implementations might want to inherit from this class to get
87 this implementations of the alternative I<add> and I<digest> methods.
88 A minimal subclass needs to implement the following methods by itself:
95 The arguments and expected behaviour of these methods are described in