summaryrefslogtreecommitdiff
path: root/cpan/Digest-SHA/src/hmac.h
blob: 99d6502ff6e052533a2390871b02923eaa621c0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
 * hmac.h: header file for HMAC-SHA-1/224/256/384/512 routines
 *
 * Ref: FIPS PUB 198 The Keyed-Hash Message Authentication Code
 *
 * Copyright (C) 2003-2012 Mark Shelor, All Rights Reserved
 *
 * Version: 5.73
 * Wed Oct 31 04:32:44 MST 2012
 *
 */

#ifndef _INCLUDE_HMAC_H_
#define _INCLUDE_HMAC_H_

#include "sha.h"

typedef struct {
	SHA *ksha;
	SHA *isha;
	SHA *osha;
	unsigned char key[SHA_MAX_BLOCK_BITS/8];
} HMAC;

#define _HMAC_STATE	HMAC *h
#define _HMAC_ALG	int alg
#define _HMAC_DATA	unsigned char *bitstr, unsigned long bitcnt
#define _HMAC_KEY	unsigned char *key, unsigned int keylen

HMAC		*hmacopen 	(_HMAC_ALG, _HMAC_KEY);
unsigned long	 hmacwrite	(_HMAC_DATA, _HMAC_STATE);
void		 hmacfinish	(_HMAC_STATE);
unsigned char	*hmacdigest	(_HMAC_STATE);
char		*hmachex	(_HMAC_STATE);
char		*hmacbase64	(_HMAC_STATE);
int		 hmacclose	(_HMAC_STATE);

#ifndef SHA_PERL_MODULE

unsigned char	*hmac1digest		(_HMAC_DATA, _HMAC_KEY);
char		*hmac1hex		(_HMAC_DATA, _HMAC_KEY);
char		*hmac1base64		(_HMAC_DATA, _HMAC_KEY);
unsigned char	*hmac224digest		(_HMAC_DATA, _HMAC_KEY);
char		*hmac224hex		(_HMAC_DATA, _HMAC_KEY);
char		*hmac224base64		(_HMAC_DATA, _HMAC_KEY);
unsigned char	*hmac256digest		(_HMAC_DATA, _HMAC_KEY);
char		*hmac256hex		(_HMAC_DATA, _HMAC_KEY);
char		*hmac256base64		(_HMAC_DATA, _HMAC_KEY);
unsigned char	*hmac384digest		(_HMAC_DATA, _HMAC_KEY);
char		*hmac384hex		(_HMAC_DATA, _HMAC_KEY);
char		*hmac384base64		(_HMAC_DATA, _HMAC_KEY);
unsigned char	*hmac512digest		(_HMAC_DATA, _HMAC_KEY);
char		*hmac512hex		(_HMAC_DATA, _HMAC_KEY);
char		*hmac512base64		(_HMAC_DATA, _HMAC_KEY);
unsigned char	*hmac512224digest	(_HMAC_DATA, _HMAC_KEY);
char		*hmac512224hex		(_HMAC_DATA, _HMAC_KEY);
char		*hmac512224base64	(_HMAC_DATA, _HMAC_KEY);
unsigned char	*hmac512256digest	(_HMAC_DATA, _HMAC_KEY);
char		*hmac512256hex		(_HMAC_DATA, _HMAC_KEY);
char		*hmac512256base64	(_HMAC_DATA, _HMAC_KEY);

#endif

#endif	/* _INCLUDE_HMAC_H_ */