Annotation of parser3/src/lib/md5/pa_md5.h, revision 1.20

1.1       paf         1: /** @file
1.19      moko        2:        taken from libmd, added pa_ prefixes, Parser 3 includes,
1.20    ! moko        3:        Copyright (c) 2001-2026 Art. Lebedev Studio (https://www.artlebedev.com)
1.1       paf         4: */
                      5: 
1.19      moko        6: /*     $OpenBSD: md5.h,v 1.15 2004/05/03 17:30:14 millert Exp $        */
                      7: 
1.1       paf         8: /*
1.19      moko        9:  * This code implements the MD5 message-digest algorithm.
                     10:  * The algorithm is due to Ron Rivest. This code was
                     11:  * written by Colin Plumb in 1993, no copyright is claimed.
                     12:  * This code is in the public domain; do with it what you wish.
                     13:  *
                     14:  * Equivalent code is available from RSA Data Security, Inc.
                     15:  * This code has been tested against that, and is equivalent,
                     16:  * except that you don't need to include two pages of legalese
                     17:  * with every copy.
1.1       paf        18:  */
                     19: 
1.2       paf        20: #ifndef PA_MD5_H
                     21: #define PA_MD5_H
1.3       paf        22: 
1.20    ! moko       23: #define IDENT_PA_MD5_H "$Id: pa_md5.h,v 1.19 2025/01/06 18:22:23 moko Exp $"
1.1       paf        24: 
                     25: #ifdef __cplusplus
                     26: extern "C" {
                     27: #endif
                     28: 
1.13      moko       29: #include "pa_config_includes.h"
1.1       paf        30: 
1.19      moko       31: #define        MD5_BLOCK_LENGTH                64
                     32: #define        MD5_DIGEST_LENGTH               16
                     33: #define        MD5_DIGEST_STRING_LENGTH        (MD5_DIGEST_LENGTH * 2 + 1)
                     34: 
                     35: typedef struct MD5Context {
                     36:        uint32_t state[4];                      /* state */
                     37:        uint64_t count;                         /* number of bits, mod 2^64 */
                     38:        uint8_t buffer[MD5_BLOCK_LENGTH];       /* input buffer */
                     39: } PA_MD5_CTX;
1.1       paf        40: 
1.19      moko       41: void pa_MD5Init(PA_MD5_CTX *);
                     42: void pa_MD5Update(PA_MD5_CTX *, const uint8_t *, size_t);
                     43: void pa_MD5Final(uint8_t [MD5_DIGEST_LENGTH], PA_MD5_CTX *);
                     44: void pa_MD5Transform(uint32_t [4], const uint8_t [MD5_BLOCK_LENGTH]);
                     45: void pa_MD5Encode(const unsigned char *password, const unsigned char *salt, char *result, size_t nbytes);
                     46: void pa_to64(char *s, unsigned long v, int n);
1.2       paf        47: 
1.1       paf        48: #define PA_MD5PW_ID "$apr1$"
                     49: #define PA_MD5PW_IDLEN 6
                     50: 
                     51: #ifdef __cplusplus
                     52: }
                     53: #endif
                     54: 
1.2       paf        55: #endif /* !PA_MD5_H */

E-mail: