Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
1.6 KiB

  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