PageRenderTime 58ms CodeModel.GetById 11ms 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
Possible License(s): GPL-2.0, MPL-2.0-no-copyleft-exception, CPL-1.0, CC-BY-SA-3.0, BSD-3-Clause, ISC, AGPL-3.0, LGPL-2.1, Apache-2.0
  1. package SHA;
  2. use strict;
  3. use vars qw($VERSION @ISA @EXPORT_OK);
  4. $VERSION = '2.00'; # $Date: 1999/03/08 12:04:41 $
  5. require Digest::SHA1;
  6. @ISA=qw(Digest::SHA1);
  7. require Exporter;
  8. *import = *Exporter::imprt;
  9. @EXPORT_OK=qw(sha_version);
  10. sub hexdigest
  11. {
  12. my $self = shift;
  13. join(" ", unpack("A8 A8 A8 A8 A8", $self->SUPER::hexdigest(@_)));
  14. }
  15. sub hash { shift->new->add(@_)->digest; }
  16. sub hexhash { shift->new->add(@_)->hexdigest; }
  17. sub sha_version { "SHA-1"; }
  18. 1;
  19. __END__
  20. =head1 NAME
  21. SHA - Perl interface to the NIST Secure Hash Algorithm
  22. =head1 SYNOPSIS
  23. use SHA;
  24. $version = &SHA::sha_version;
  25. $context = new SHA;
  26. $context->reset();
  27. $context->add(LIST);
  28. $context->addfile(HANDLE);
  29. $digest = $context->digest();
  30. $string = $context->hexdigest();
  31. $digest = $context->hash($string);
  32. $string = $context->hexhash($string);
  33. =head1 DESCRIPTION
  34. The C<SHA> module is B<depreciated>. Use C<Digest::SHA1> instead.
  35. The current C<SHA> module is just a wrapper around the C<Digest::SHA1>
  36. module. It is provided so that legacy code that rely on the old
  37. interface still work. This wrapper does not support the old (and
  38. buggy) SHA-0 algorithm.
  39. In addition to the methods provided by C<Digest::SHA1> this module
  40. provide the class methods SHA->hash() and SHA->hexhash() that
  41. basically do the same as the sha1() and sha1_hex() functions provided
  42. C<Digest::SHA1>.
  43. The SHA->hex* methods will insert spaces between groups of 8 hex
  44. characters, while the Digest::SHA1 version of the same methods will not
  45. do this.
  46. =head1 SEE ALSO
  47. L<Digest::SHA1>
  48. =cut