forked from coronalabs/corona
-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathRtt_MCrypto.h
56 lines (43 loc) · 1.47 KB
/
Rtt_MCrypto.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
//////////////////////////////////////////////////////////////////////////////
//
// This file is part of the Corona game engine.
// For overview and more information on licensing please refer to README.md
// Home page: https://github.com/coronalabs/corona
// Contact: [email protected]
//
//////////////////////////////////////////////////////////////////////////////
#ifndef _Rtt_MCrypto_H__
#define _Rtt_MCrypto_H__
#include "Core/Rtt_Data.h"
// ----------------------------------------------------------------------------
namespace Rtt
{
// ----------------------------------------------------------------------------
class MCrypto
{
public:
typedef enum _Algorithm
{
kMD4Algorithm = 0, // HMAC not available for MD4
kMD5Algorithm,
kSHA1Algorithm,
kSHA224Algorithm,
kSHA256Algorithm,
kSHA384Algorithm,
kSHA512Algorithm,
kNumAlgorithms
}
Algorithm;
enum
{
kMaxDigestSize = 64 // longest known SHA512
};
public:
virtual size_t GetDigestLength( Algorithm algorithm ) const = 0;
virtual void CalculateDigest( Algorithm algorithm, const Rtt::Data<const char> & data, U8 *md ) const = 0;
virtual void CalculateHMAC( Algorithm algorithm, const Rtt::Data<const char> & key, const Rtt::Data<const char> & data, U8 *outMac ) const = 0;
};
// ----------------------------------------------------------------------------
} // namespace Rtt
// ----------------------------------------------------------------------------
#endif // _Rtt_MCrypto_H__