Coda Distributed File System
lib-src
base
coda_hash.h
Go to the documentation of this file.
1
/* BLURB lgpl
2
3
Coda File System
4
Release 6
5
6
Copyright (c) 1987-2003 Carnegie Mellon University
7
Additional copyrights listed below
8
9
This code is distributed "AS IS" without warranty of any kind under
10
the terms of the GNU Library General Public Licence Version 2, as
11
shown in the file LICENSE. The technical and financial contributors to
12
Coda are listed in the file CREDITS.
13
14
Additional copyrights
15
none currently
16
17
#*/
18
19
#ifndef _CODA_HASH_H_
20
#define _CODA_HASH_H_ 1
21
22
#ifdef __cplusplus
23
extern
"C"
{
24
#endif
25
26
#ifdef HAVE_CONFIG_H
27
#include <config.h>
28
#endif
29
30
#include <sys/types.h>
31
#include <stdint.h>
32
33
#if defined(HAVE_MD5_H)
34
#include <md5.h>
35
#else
36
37
/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
38
rights reserved.
39
40
License to copy and use this software is granted provided that it
41
is identified as the "RSA Data Security, Inc. MD5 Message-Digest
42
Algorithm" in all material mentioning or referencing this software
43
or this function.
44
45
License is also granted to make and use derivative works provided
46
that such works are identified as "derived from the RSA Data
47
Security, Inc. MD5 Message-Digest Algorithm" in all material
48
mentioning or referencing the derived work.
49
50
RSA Data Security, Inc. makes no representations concerning either
51
the merchantability of this software or the suitability of this
52
software for any particular purpose. It is provided "as is"
53
without express or implied warranty of any kind.
54
55
These notices must be retained in any copies of any part of this
56
documentation and/or software.
57
*/
58
59
typedef
struct
MD5Context
{
60
uint32_t
state
[4];
/* state (ABCD) */
61
uint32_t
count
[2];
/* number of bits, modulo 2^64 (lsb first) */
62
unsigned
char
buffer
[64];
/* input buffer */
63
}
MD5_CTX
;
64
65
void
MD5_Init
(
MD5_CTX
*);
66
void
MD5_Update
(
MD5_CTX
*,
const
unsigned
char
*,
unsigned
int
);
67
void
MD5_Final
(
unsigned
char
[16],
MD5_CTX
*);
68
69
#endif
70
71
#define SHA_DIGEST_LENGTH 20
72
73
typedef
struct
SHAContext
{
74
uint32_t
count
;
75
uint32_t
state
[5];
76
unsigned
char
buffer
[64];
77
}
SHA_CTX
;
78
79
void
SHA1_Init
(
SHA_CTX
*ctx);
80
void
SHA1_Update
(
SHA_CTX
*ctx,
const
unsigned
char
*buf,
unsigned
int
len);
81
void
SHA1_Final
(
unsigned
char
sha[
SHA_DIGEST_LENGTH
],
SHA_CTX
*ctx);
82
83
#ifdef __cplusplus
84
}
85
#endif
86
87
#endif
/* _CODA_HASH_H_ */
uint32_t
unsigned int uint32_t
Definition:
coda.h:105
SHA_DIGEST_LENGTH
#define SHA_DIGEST_LENGTH
Definition:
coda_hash.h:71
MD5_Final
void MD5_Final(unsigned char[16], MD5_CTX *)
Definition:
md5c.c:183
MD5_Update
void MD5_Update(MD5_CTX *, const unsigned char *, unsigned int)
Definition:
md5c.c:146
SHA1_Init
void SHA1_Init(SHA_CTX *ctx)
Definition:
sha1.c:110
SHA_CTX
struct SHAContext SHA_CTX
MD5_Init
void MD5_Init(MD5_CTX *)
Definition:
md5c.c:128
SHA1_Update
void SHA1_Update(SHA_CTX *ctx, const unsigned char *buf, unsigned int len)
Definition:
sha1.c:121
MD5_CTX
struct MD5Context MD5_CTX
SHA1_Final
void SHA1_Final(unsigned char sha[SHA_DIGEST_LENGTH], SHA_CTX *ctx)
Definition:
sha1.c:142
MD5Context
Definition:
coda_hash.h:59
MD5Context::state
uint32_t state[4]
Definition:
coda_hash.h:60
MD5Context::count
uint32_t count[2]
Definition:
coda_hash.h:61
SHAContext
Definition:
coda_hash.h:73
SHAContext::count
uint32_t count
Definition:
coda_hash.h:74
SHAContext::state
uint32_t state[5]
Definition:
coda_hash.h:75
buffer
Definition:
coda_dir.h:58
Generated by
1.9.4