~ubuntu-branches/ubuntu/precise/openssl098/precise

« back to all changes in this revision

Viewing changes to doc/crypto/sha.pod

  • Committer: Bazaar Package Importer
  • Author(s): Kurt Roeckx
  • Date: 2011-03-23 19:50:31 UTC
  • Revision ID: james.westby@ubuntu.com-20110323195031-6h9crj4bymhhr8b8
Tags: upstream-0.9.8o
ImportĀ upstreamĀ versionĀ 0.9.8o

Show diffs side-by-side

added added

removed removed

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