/
jmd5.h
56 lines (40 loc) · 1.03 KB
/
jmd5.h
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
/*
* Copyright (c) 2002-2014 J Smith <dark.panda@gmail.com>
* Crypto++ copyright (c) 1995-2013 Wei Dai
* See MIT-LICENSE for the extact license
*/
#ifndef __JMD5_H__
#define __JMD5_H__
#include "jconfig.h"
#if ENABLED_MD5_HASH || ENABLED_MD5_HMAC
#ifndef CRYPTOPP_ENABLE_NAMESPACE_WEAK
#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1
#endif
#if ENABLED_MD5_HASH
#include "jhash_t.h"
#endif
#if ENABLED_MD5_HMAC
#include "jhmac_t.h"
#endif
// Crypto++ headers...
#include "md5.h"
using namespace CryptoPP;
#if ENABLED_MD5_HASH
class JMD5 : public JHash_Template<Weak::MD5, MD5_HASH>
{
public:
JMD5(string plaintext = "") : JHash_Template<Weak::MD5, MD5_HASH>(plaintext) { }
static string getHashName() { return "MD5"; }
};
#endif
#if ENABLED_MD5_HMAC
class JMD5_HMAC : public JHMAC_Template<Weak::MD5, MD5_HMAC>
{
public:
JMD5_HMAC(string plaintext = "") : JHMAC_Template<Weak::MD5, MD5_HMAC>(plaintext) { }
static string getHashName() { return "MD5-HMAC"; }
};
#endif
#undef CRYPTOPP_ENABLE_NAMESPACE_WEAK
#endif
#endif