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