Crypt-Rhash

 view release on metacpan or  search on metacpan

Rhash.pm  view on Meta::CPAN

85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# destructor
sub DESTROY($)
{
        my $self = shift;
        # the 'if' added as workaround for perl 'global destruction' bug
        # ($self->{context} can disappear on global destruction)
        rhash_free($self->{context}) if $self->{context};
}
 
sub update($$)
{
        my $self = shift;
        my $message = shift;
        rhash_update($self->{context}, $message);
        return $self;
}
 
sub update_fd($$;$$)
{
        my ($self, $fd, $start, $size) = @_;
        my $res = 0;
        my $num = 0;
 
        binmode($fd);
        if(defined($start)) {
                seek($fd, scalar($start), 0) or return undef;
        }

Rhash.pm  view on Meta::CPAN

122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
        } else {
                while( ($res = read($fd, $data, 8192)) ) {
                        rhash_update($self->{context}, $data);
                        $num += $res;
                }
        }
 
        return (defined($res) ? $num : undef); # return undef on read error
}
 
sub update_file($$;$$)
{
        my ($self, $file, $start, $size) = @_;
        open(my $fd, "<", $file) or return undef;
        my $res = $self->update_fd($fd, $start, $size);
        close($fd);
        return $res;
}
 
sub final($)
{



( run in 0.246 second using v1.01-cache-2.11-cpan-e9199f4ba4c )