PageRenderTime 25ms CodeModel.GetById 17ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/IronPython_Main/Runtime/Tests/LinqDlrTests/testenv/perl/site/lib/sha.pm

#
Perl | 73 lines | 48 code | 25 blank | 0 comment | 1 complexity | e770deb64cbb26c4ed64d923c4b7e631 MD5 | raw file
 1package SHA;
 2
 3use strict;
 4use vars qw($VERSION @ISA @EXPORT_OK);
 5
 6$VERSION = '2.00'; # $Date: 1999/03/08 12:04:41 $
 7
 8require Digest::SHA1;
 9@ISA=qw(Digest::SHA1);
10
11require Exporter;
12*import = *Exporter::imprt;
13@EXPORT_OK=qw(sha_version);
14
15sub hexdigest
16{
17    my $self = shift;
18    join(" ", unpack("A8 A8 A8 A8 A8", $self->SUPER::hexdigest(@_)));
19}
20
21sub hash        { shift->new->add(@_)->digest;    }
22sub hexhash     { shift->new->add(@_)->hexdigest; }
23sub sha_version { "SHA-1"; }
24
251;
26
27__END__
28
29=head1 NAME
30
31SHA - Perl interface to the NIST Secure Hash Algorithm
32
33=head1 SYNOPSIS
34
35    use SHA;
36
37    $version = &SHA::sha_version;
38
39    $context = new SHA;
40    $context->reset();
41
42    $context->add(LIST);
43    $context->addfile(HANDLE);
44
45    $digest = $context->digest();
46    $string = $context->hexdigest();
47
48    $digest = $context->hash($string);
49    $string = $context->hexhash($string);
50
51=head1 DESCRIPTION
52
53The C<SHA> module is B<depreciated>.  Use C<Digest::SHA1> instead.
54
55The current C<SHA> module is just a wrapper around the C<Digest::SHA1>
56module.  It is provided so that legacy code that rely on the old
57interface still work.  This wrapper does not support the old (and
58buggy) SHA-0 algorithm.
59
60In addition to the methods provided by C<Digest::SHA1> this module
61provide the class methods SHA->hash() and SHA->hexhash() that
62basically do the same as the sha1() and sha1_hex() functions provided
63C<Digest::SHA1>.
64
65The SHA->hex* methods will insert spaces between groups of 8 hex
66characters, while the Digest::SHA1 version of the same methods will not
67do this.
68
69=head1 SEE ALSO
70
71L<Digest::SHA1>
72
73=cut