blob: 026fd411c6659089faac90e64c3ab51a00785120 (
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
|
// Md5Reg.cpp
#include "StdAfx.h"
#include "../../C/Md5.h"
#include "../Common/MyBuffer2.h"
#include "../Common/MyCom.h"
#include "../7zip/Common/RegisterCodec.h"
Z7_CLASS_IMP_COM_1(
CMd5Hasher
, IHasher
)
CAlignedBuffer1 _buf;
public:
Byte _mtDummy[1 << 7];
CMd5 *Md5() { return (CMd5 *)(void *)(Byte *)_buf; }
public:
CMd5Hasher():
_buf(sizeof(CMd5))
{
Md5_Init(Md5());
}
};
Z7_COM7F_IMF2(void, CMd5Hasher::Init())
{
Md5_Init(Md5());
}
Z7_COM7F_IMF2(void, CMd5Hasher::Update(const void *data, UInt32 size))
{
Md5_Update(Md5(), (const Byte *)data, size);
}
Z7_COM7F_IMF2(void, CMd5Hasher::Final(Byte *digest))
{
Md5_Final(Md5(), digest);
}
REGISTER_HASHER(CMd5Hasher, 0x208, "MD5", MD5_DIGEST_SIZE)
|