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.

122 lines
2.7 KiB

  1. package Digest::SHA1;
  2. use strict;
  3. use vars qw($VERSION @ISA @EXPORT_OK);
  4. $VERSION = '1.02'; # $Date: 1999/08/05 22:58:42 $
  5. require Exporter;
  6. *import = \&Exporter::import;
  7. @EXPORT_OK = qw(sha1 sha1_hex sha1_base64);
  8. require DynaLoader;
  9. @ISA=qw(DynaLoader);
  10. Digest::SHA1->bootstrap($VERSION);
  11. *reset = \&new;
  12. 1;
  13. __END__
  14. =head1 NAME
  15. Digest::SHA1 - Perl interface to the SHA-1 Algorithm
  16. =head1 SYNOPSIS
  17. # Functional style
  18. use Digest::SHA1 qw(sha1 sha1_hex sha1_base64);
  19. $digest = sha1($data);
  20. $digest = sha1_hex($data);
  21. $digest = sha1_base64($data);
  22. # OO style
  23. use Digest::SHA1;
  24. $ctx = Digest::SHA1->new;
  25. $ctx->add($data);
  26. $ctx->addfile(*FILE);
  27. $digest = $ctx->digest;
  28. $digest = $ctx->hexdigest;
  29. $digest = $ctx->b64digest;
  30. =head1 DESCRIPTION
  31. The C<Digest::SHA1> module allows you to use the NIST SHA-1 message
  32. digest algorithm from within Perl programs. The algorithm takes as
  33. input a message of arbitrary length and produces as output a 160-bit
  34. "fingerprint" or "message digest" of the input.
  35. The C<Digest::SHA1> module provide a procedural interface for simple
  36. use, as well as an object oriented interface that can handle messages
  37. of arbitrary length and which can read files directly.
  38. A binary digest will be 20 bytes long. A hex digest will be 40
  39. characters long. A base64 digest will be 27 characters long.
  40. =head1 FUNCTIONS
  41. The following functions can be exported from the C<Digest::SHA1>
  42. module. No functions are exported by default.
  43. =over 4
  44. =item sha1($data,...)
  45. This function will concatenate all arguments, calculate the SHA-1
  46. digest of this "message", and return it in binary form.
  47. =item sha1_hex($data,...)
  48. Same as sha1(), but will return the digest in hexadecimal form.
  49. =item sha1_base64($data,...)
  50. Same as sha1(), but will return the digest as a base64 encoded string.
  51. =back
  52. =head1 METHODS
  53. The C<Digest::SHA1> module provide the standard C<Digest> OO-interface.
  54. The constructor looks like this:
  55. =over 4
  56. =item $sha1 = Digest->new('SHA-1')
  57. =item $sha1 = Digest::SHA1->new
  58. The constructor returns a new C<Digest::SHA1> object which encapsulate
  59. the state of the SHA-1 message-digest algorithm. You can add data to
  60. the object and finally ask for the digest using the methods described
  61. in L<Digest>.
  62. =back
  63. =head1 SEE ALSO
  64. L<Digest>, L<Digest::HMAC_SHA1>, L<Digest::MD5>
  65. http://www.itl.nist.gov/fipspubs/fip180-1.htm
  66. =head1 COPYRIGHT
  67. This library is free software; you can redistribute it and/or
  68. modify it under the same terms as Perl itself.
  69. Copyright 1999 Gisle Aas.
  70. Copyright 1997 Uwe Hollerbach.
  71. =head1 AUTHORS
  72. Peter C. Gutmann,
  73. Uwe Hollerbach <[email protected]>,
  74. Gisle Aas <[email protected]>
  75. =cut