Apache2
apr_sha1.h File Reference

APR-UTIL SHA1 library. More...

#include "apu.h"
#include "apr_general.h"
Include dependency graph for apr_sha1.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  apr_sha1_ctx_t
 

Macros

#define APR_SHA1_DIGESTSIZE   20
 
#define APR_SHA1PW_ID   "{SHA}"
 
#define APR_SHA1PW_IDLEN   5
 

Typedefs

typedef struct apr_sha1_ctx_t apr_sha1_ctx_t
 

Functions

void apr_sha1_base64 (const char *clear, int len, char *out)
 
void apr_sha1_init (apr_sha1_ctx_t *context)
 
void apr_sha1_update (apr_sha1_ctx_t *context, const char *input, unsigned int inputLen)
 
void apr_sha1_update_binary (apr_sha1_ctx_t *context, const unsigned char *input, unsigned int inputLen)
 
void apr_sha1_final (unsigned char digest[APR_SHA1_DIGESTSIZE], apr_sha1_ctx_t *context)
 

Detailed Description

APR-UTIL SHA1 library.

Macro Definition Documentation

◆ APR_SHA1_DIGESTSIZE

#define APR_SHA1_DIGESTSIZE   20

size of the SHA1 DIGEST

◆ APR_SHA1PW_ID

#define APR_SHA1PW_ID   "{SHA}"

Define the Magic String prefix that identifies a password as being hashed using our algorithm.

◆ APR_SHA1PW_IDLEN

#define APR_SHA1PW_IDLEN   5

length of the SHA Password

Typedef Documentation

◆ apr_sha1_ctx_t

Function Documentation

◆ apr_sha1_base64()

void apr_sha1_base64 ( const char *  clear,
int  len,
char *  out 
)

Provide a means to SHA1 crypt/encode a plaintext password in a way which makes password file compatible with those commonly use in netscape web and ldap installations.

Parameters
clearThe plaintext password
lenThe length of the plaintext password
outThe encrypted/encoded password
Note
SHA1 support is useful for migration purposes, but is less secure than Apache's password format, since Apache's (MD5) password format uses a random eight character salt to generate one of many possible hashes for the same password. Netscape uses plain SHA1 without a salt, so the same password will always generate the same hash, making it easier to break since the search space is smaller.

◆ apr_sha1_final()

void apr_sha1_final ( unsigned char  digest[APR_SHA1_DIGESTSIZE],
apr_sha1_ctx_t context 
)

Finish computing the SHA digest

Parameters
digestthe output buffer in which to store the digest
contextThe context to finalize

◆ apr_sha1_init()

void apr_sha1_init ( apr_sha1_ctx_t context)

Initialize the SHA digest

Parameters
contextThe SHA context to initialize

◆ apr_sha1_update()

void apr_sha1_update ( apr_sha1_ctx_t context,
const char *  input,
unsigned int  inputLen 
)

Update the SHA digest

Parameters
contextThe SHA1 context to update
inputThe buffer to add to the SHA digest
inputLenThe length of the input buffer

◆ apr_sha1_update_binary()

void apr_sha1_update_binary ( apr_sha1_ctx_t context,
const unsigned char *  input,
unsigned int  inputLen 
)

Update the SHA digest with binary data

Parameters
contextThe SHA1 context to update
inputThe buffer to add to the SHA digest
inputLenThe length of the input buffer