sha 3 2007-03-06 0.9.9-dev OpenSSL

NAME

SHA1, SHA1_Init, SHA1_Update, SHA1_Final - Secure Hash Algorithm

LIBRARY

libcrypto, -lcrypto

SYNOPSIS


 #include 


 unsigned char *SHA1(const unsigned char *d, unsigned long n,
                  unsigned char *md);


 int SHA1_Init(SHA_CTX *c);
 int SHA1_Update(SHA_CTX *c, const void *data,
                  unsigned long len);
 int SHA1_Final(unsigned char *md, SHA_CTX *c);

DESCRIPTION

SHA-1 (Secure Hash Algorithm) is a cryptographic hash function with a 160 bit output.

_S_H_A_1_(_) computes the SHA-1 message digest of the nn bytes at dd and places it in mmdd (which must have space for SHA_DIGEST_LENGTH == 20 bytes of output). If mmdd is NULL, the digest is placed in a static array.

The following functions may be used if the message is not completely stored in memory:

_S_H_A_1___I_n_i_t_(_) initializes a SSHHAA__CCTTXX structure.

_S_H_A_1___U_p_d_a_t_e_(_) can be called repeatedly with chunks of the message to be hashed (lleenn bytes at ddaattaa).

_S_H_A_1___F_i_n_a_l_(_) places the message digest in mmdd, which must have space for SHA_DIGEST_LENGTH == 20 bytes of output, and erases the SSHHAA__CCTTXX.

Applications should use the higher level functions _E_V_P___D_i_g_e_s_t_I_n_i_t(3) etc. instead of calling the hash functions directly.

The predecessor of SHA-1, SHA, is also implemented, but it should be used only when backward compatibility is required.

RETURN VALUES

_S_H_A_1_(_) returns a pointer to the hash value.

_S_H_A_1___I_n_i_t_(_), _S_H_A_1___U_p_d_a_t_e_(_) and _S_H_A_1___F_i_n_a_l_(_) return 1 for success, 0 otherwise.

CONFORMING TO

SHA: US Federal Information Processing Standard FIPS PUB 180 (Secure Hash Standard), SHA-1: US Federal Information Processing Standard FIPS PUB 180-1 (Secure Hash Standard), ANSI X9.30

SEE ALSO

_o_p_e_n_s_s_l___r_i_p_e_m_d(3), _o_p_e_n_s_s_l___h_m_a_c(3), _E_V_P___D_i_g_e_s_t_I_n_i_t(3)

HISTORY

_S_H_A_1_(_), _S_H_A_1___I_n_i_t_(_), _S_H_A_1___U_p_d_a_t_e_(_) and _S_H_A_1___F_i_n_a_l_(_) are available in all versions of SSLeay and OpenSSL.