su 1.12.11devel
Loading...
Searching...
No Matches
su_md5.h
Go to the documentation of this file.
1/*
2 * This file is part of the Sofia-SIP package
3 *
4 * Copyright (C) 2005 Nokia Corporation.
5 *
6 * Contact: Pekka Pessi <pekka.pessi@nokia-email.address.hidden>
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; either version 2.1 of
11 * the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21 * 02110-1301 USA
22 *
23 */
24
25#ifndef SU_MD5_H
26#define SU_MD5_H
27
45#ifndef SU_TYPES_H
46#include "sofia-sip/su_types.h"
47#endif
48
49SOFIA_BEGIN_DECLS
50
52typedef struct su_md5_t {
53 uint32_t buf[4];
54 uint32_t bits[2];
55 uint8_t in[64];
57
58#define SU_MD5_DIGEST_SIZE 16
59
60SOFIAPUBFUN void su_md5_init(su_md5_t *context);
63 void const *buf, usize_t len);
64SOFIAPUBFUN void su_md5_strupdate(su_md5_t *ctx, char const *s);
65SOFIAPUBFUN void su_md5_str0update(su_md5_t *ctx, char const *s);
66
68 void const *buf, usize_t len);
69SOFIAPUBFUN void su_md5_striupdate(su_md5_t *ctx, char const *s);
70SOFIAPUBFUN void su_md5_stri0update(su_md5_t *ctx, char const *s);
71
72SOFIAPUBFUN void su_md5_digest(su_md5_t const *ctx,
73 uint8_t digest[SU_MD5_DIGEST_SIZE]);
74SOFIAPUBFUN void su_md5_hexdigest(su_md5_t const *ctx,
75 char digest[2 * SU_MD5_DIGEST_SIZE + 1]);
76
77#define SU_MD5_STRUPDATE(ctx, s) \
78 ((s) ? su_md5_update(ctx, (s), strlen(s)) : (void)0)
79#define SU_MD5_STR0UPDATE(ctx, s) \
80 su_md5_update(ctx, (s) ? (s) : "", (s) ? strlen(s) + 1 : 1)
81#define SU_MD5_STRIUPDATE(ctx, s) \
82 ((s) ? su_md5_iupdate(ctx, (s), strlen(s)) : (void)0)
83#define SU_MD5_STRI0UPDATE(ctx, s) \
84 su_md5_iupdate(ctx, (s) ? (s) : "", (s) ? strlen(s) : 1)
85
86SOFIA_END_DECLS
87
88#endif /* !defined(MD5_H) */
MD5 context.
Definition su_md5.h:52
#define SOFIAPUBFUN
SOFIAPUBFUN declares an exported function.
Definition su_config.h:66
void su_md5_str0update(su_md5_t *ctx, char const *s)
Update MD5 context with contents of string, including final NUL.
Definition su_md5.c:268
void su_md5_update(su_md5_t *context, void const *buf, usize_t len)
Update MD5 context.
Definition su_md5.c:132
void su_md5_strupdate(su_md5_t *ctx, char const *s)
Update MD5 context with contents of string.
Definition su_md5.c:254
void su_md5_striupdate(su_md5_t *ctx, char const *s)
Update MD5 context with contents of case-independent string.
Definition su_md5.c:284
void su_md5_init(su_md5_t *context)
Initialize MD5 context.
Definition su_md5.c:100
void su_md5_deinit(su_md5_t *context)
Clear MD5 context.
Definition su_md5.c:117
void su_md5_iupdate(su_md5_t *context, void const *buf, usize_t len)
Update MD5 context.
Definition su_md5.c:201
void su_md5_stri0update(su_md5_t *ctx, char const *s)
Update MD5 context with contents of case-independent string, including final NUL.
Definition su_md5.c:299
Basic integer types for su library.
SU_U32_T uint32_t
32-bit unsigned integer
Definition su_types.h:87
SU_U8_T uint8_t
8-bit unsigned integer
Definition su_types.h:95

Sofia-SIP 1.12.11devel - Copyright (C) 2006 Nokia Corporation. All rights reserved. Licensed under the terms of the GNU Lesser General Public License.