This repository has been archived by the owner on Aug 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
MD4.h
60 lines (51 loc) · 1.45 KB
/
MD4.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
57
58
59
60
//
// MD4.h
//
// Copyright (c) Shareaza Development Team, 2002-2014.
// This file is part of SHAREAZA (shareaza.sourceforge.net)
//
// Shareaza is free software; you can redistribute it
// and/or modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2 of
// the License, or (at your option) any later version.
//
// Shareaza is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Shareaza; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
#pragma once
#include "Utility.h"
#include "interop.h"
class CMD4
{
public:
CMD4();
~CMD4() {}
void Reset();
void Add(const void* pData, size_t nLength);
void Finish();
struct Digest // 128 bit
{
uint32& operator[](size_t i) { return data[i]; }
const uint32& operator[](size_t i) const { return data[i]; }
uint32 data[4];
};
void GetHash(__in_bcount(16) uchar* pHash) const;
struct MD4State
{
static const size_t blockSize = 64;
uint64 m_nCount;
uint32 m_nState[4];
uchar m_oBuffer[blockSize];
};
private:
MD4State m_State;
#ifndef HASHLIB_USE_ASM
__forceinline void Transform(const uint32* data);
#endif
};