home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 2002 November / CD 1 / APC0211D1.ISO / workshop / prog / files / ActivePerl-5.6.1.633-MSWin32.msi / _f655ac87f3d1e244a671a5cd24f1223e < prev    next >
Encoding:
Text File  |  2002-05-01  |  2.7 KB  |  123 lines

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