/docs/MyDocs

To get this branch, use:
bzr branch http://darksoft.org/webbzr/docs/MyDocs

« back to all changes in this revision

Viewing changes to Development/languages/C/Samples/md5/md5.h

  • Committer: Suren A. Chilingaryan
  • Date: 2009-04-09 03:21:08 UTC
  • Revision ID: csa@dside.dyndns.org-20090409032108-w4edamdh4adrgdu3
import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* From RFC-1321/Appendices A.1/A.2 */
 
2
/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
 
3
 * rights reserved.
 
4
 *
 
5
 * License to copy and use this software is granted provided that it
 
6
 * is identified as the "RSA Data Security, Inc. MD5 Message-Digest
 
7
 * Algorithm" in all material mentioning or referencing this software
 
8
 * or this function.
 
9
 *
 
10
 * License is also granted to make and use derivative works provided
 
11
 * that such works are identified as "derived from the RSA Data
 
12
 * Security, Inc. MD5 Message-Digest Algorithm" in all material
 
13
 * mentioning or referencing the derived work.
 
14
 *
 
15
 * RSA Data Security, Inc. makes no representations concerning either
 
16
 * the merchantability of this software or the suitability of this
 
17
 * software for any particular purpose. It is provided "as is"
 
18
 * without express or implied warranty of any kind.
 
19
 *
 
20
 * These notices must be retained in any copies of any part of this
 
21
 * documentation and/or software.
 
22
 */
 
23
#ifndef _MD5_H_
 
24
#define _MD5_H_
 
25
 
 
26
//#include "config.h"
 
27
 
 
28
/* 
 
29
 * PROTOTYPES should be set to one if and only if the compiler supports
 
30
 * function argument prototyping.
 
31
 * The following makes PROTOTYPES default to 0 if it has not already
 
32
 * been defined with C compiler flags.
 
33
 */
 
34
/*
 
35
  #ifndef PROTOTYPES
 
36
  #define PROTOTYPES 0
 
37
  #endif
 
38
*/
 
39
 
 
40
/* POINTER defines a generic pointer type */
 
41
typedef unsigned char *POINTER;
 
42
 
 
43
/* UINT2 defines a two byte word */
 
44
typedef unsigned short int UINT2;
 
45
 
 
46
/* UINT4 defines a four byte word */
 
47
#if (SIZEOF_UNSIGNED_LONG_INT != 4)
 
48
/* This should cover 64bit OS' */
 
49
typedef unsigned int UINT4;
 
50
#else
 
51
typedef unsigned long int UINT4;
 
52
#endif
 
53
 
 
54
/* PROTO_LIST is defined depending on how PROTOTYPES is defined above.
 
55
If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it
 
56
  returns an empty list.
 
57
 */
 
58
#if PROTOTYPES
 
59
#define PROTO_LIST(list) list
 
60
#else
 
61
#define PROTO_LIST(list) ()
 
62
#endif
 
63
 
 
64
 
 
65
/* MD5 context. */
 
66
typedef struct {
 
67
  UINT4 state[4];                                   /* state (ABCD) */
 
68
  UINT4 count[2];        /* number of bits, modulo 2^64 (lsb first) */
 
69
  unsigned char buffer[64];                         /* input buffer */
 
70
} MD5_CTX;
 
71
 
 
72
void MD5Init PROTO_LIST ((MD5_CTX *));
 
73
void MD5Update PROTO_LIST
 
74
  ((MD5_CTX *, unsigned char *, unsigned int));
 
75
void MD5Final PROTO_LIST ((unsigned char [16], MD5_CTX *));
 
76
 
 
77
#endif  /* _MD5_H_ */