Kannel: Open Source WAP and SMS gateway  $Revision: 5037 $
md5.h File Reference

Go to the source code of this file.

Data Structures

struct  md5_ctx
 

Functions

Octstrmd5 (Octstr *data)
 
Octstrmd5digest (Octstr *data)
 

Function Documentation

Octstr* md5 ( Octstr data)

Definition at line 387 of file md5.c.

References md5_final(), md5_init(), md5_update(), octstr_create_from_data, octstr_get_cstr, and octstr_len().

Referenced by cfg_get_group_checksum(), main(), md5digest(), and radius_authenticate_pdu().

388 {
390  unsigned char digest[16];
391  Octstr *enc;
392 
393  if (data == NULL)
394  return NULL;
395 
396  md5_init(&context);
397  md5_update(&context, octstr_get_cstr(data), octstr_len(data));
398  md5_final(digest, &context);
399 
400  enc = octstr_create_from_data(digest, 16);
401 
402  return enc;
403 }
Definition: parse.c:65
static void md5_final(unsigned char[16], md5_ctx *)
Definition: md5.c:233
static void md5_update(md5_ctx *, const unsigned char *, unsigned int)
Definition: md5.c:195
#define octstr_get_cstr(ostr)
Definition: octstr.h:233
static void md5_init(md5_ctx *)
Definition: md5.c:180
long octstr_len(const Octstr *ostr)
Definition: octstr.c:340
Definition: octstr.c:118
#define octstr_create_from_data(data, len)
Definition: octstr.h:134
Definition: md5.h:87
Octstr* md5digest ( Octstr data)

Definition at line 406 of file md5.c.

References md5(), md5_digest(), octstr_create, octstr_destroy(), and octstr_get_cstr.

Referenced by main(), and our_hash_func().

407 {
408  char md5str[33];
409  Octstr *digest;
410 
411  if (data == NULL)
412  return NULL;
413 
414  md5str[0] = '\0';
415  digest = md5(data);
416  md5_digest(md5str, octstr_get_cstr(digest));
417  octstr_destroy(digest);
418 
419  digest = octstr_create(md5str);
420 
421  return digest;
422 }
Octstr * md5(Octstr *data)
Definition: md5.c:387
static void md5_digest(char *md5str, unsigned char *digest)
Definition: md5.c:102
#define octstr_get_cstr(ostr)
Definition: octstr.h:233
void octstr_destroy(Octstr *ostr)
Definition: octstr.c:322
#define octstr_create(cstr)
Definition: octstr.h:125
Definition: octstr.c:118
See file LICENSE for details about the license agreement for using, modifying, copying or deriving work from this software.