sha.pod 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. =pod
  2. =head1 NAME
  3. SHA1, SHA1_Init, SHA1_Update, SHA1_Final - Secure Hash Algorithm
  4. =head1 SYNOPSIS
  5. #include <openssl/sha.h>
  6. unsigned char *SHA1(const unsigned char *d, unsigned long n,
  7. unsigned char *md);
  8. int SHA1_Init(SHA_CTX *c);
  9. int SHA1_Update(SHA_CTX *c, const void *data,
  10. unsigned long len);
  11. int SHA1_Final(unsigned char *md, SHA_CTX *c);
  12. =head1 DESCRIPTION
  13. SHA-1 (Secure Hash Algorithm) is a cryptographic hash function with a
  14. 160 bit output.
  15. SHA1() computes the SHA-1 message digest of the B<n>
  16. bytes at B<d> and places it in B<md> (which must have space for
  17. SHA_DIGEST_LENGTH == 20 bytes of output). If B<md> is NULL, the digest
  18. is placed in a static array.
  19. The following functions may be used if the message is not completely
  20. stored in memory:
  21. SHA1_Init() initializes a B<SHA_CTX> structure.
  22. SHA1_Update() can be called repeatedly with chunks of the message to
  23. be hashed (B<len> bytes at B<data>).
  24. SHA1_Final() places the message digest in B<md>, which must have space
  25. for SHA_DIGEST_LENGTH == 20 bytes of output, and erases the B<SHA_CTX>.
  26. Applications should use the higher level functions
  27. L<EVP_DigestInit(3)|EVP_DigestInit(3)>
  28. etc. instead of calling the hash functions directly.
  29. The predecessor of SHA-1, SHA, is also implemented, but it should be
  30. used only when backward compatibility is required.
  31. =head1 RETURN VALUES
  32. SHA1() returns a pointer to the hash value.
  33. SHA1_Init(), SHA1_Update() and SHA1_Final() return 1 for success, 0 otherwise.
  34. =head1 CONFORMING TO
  35. SHA: US Federal Information Processing Standard FIPS PUB 180 (Secure Hash
  36. Standard),
  37. SHA-1: US Federal Information Processing Standard FIPS PUB 180-1 (Secure Hash
  38. Standard),
  39. ANSI X9.30
  40. =head1 SEE ALSO
  41. L<ripemd(3)|ripemd(3)>, L<hmac(3)|hmac(3)>, L<EVP_DigestInit(3)|EVP_DigestInit(3)>
  42. =head1 HISTORY
  43. SHA1(), SHA1_Init(), SHA1_Update() and SHA1_Final() are available in all
  44. versions of SSLeay and OpenSSL.
  45. =cut