TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
SHA1.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
3  * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published by the
7  * Free Software Foundation; either version 2 of the License, or (at your
8  * option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef _AUTH_SHA1_H
20 #define _AUTH_SHA1_H
21 
22 #include "Define.h"
23 #include <string>
24 #include <type_traits>
25 #include <openssl/sha.h>
26 
27 class BigNumber;
28 
30 {
31  public:
32  typedef std::integral_constant<uint32, SHA_DIGEST_LENGTH> DigestLength;
33 
34  SHA1Hash();
35  ~SHA1Hash();
36 
37  void UpdateBigNumbers(BigNumber* bn0, ...);
38 
39  void UpdateData(const uint8 *dta, int len);
40  void UpdateData(const std::string &str);
41 
42  void Initialize();
43  void Finalize();
44 
45  uint8 *GetDigest(void) { return mDigest; }
46  int GetLength(void) const { return SHA_DIGEST_LENGTH; }
47 
48  private:
49  SHA_CTX mC;
50  uint8 mDigest[SHA_DIGEST_LENGTH];
51 };
52 #endif
53 
Definition: BigNumber.h:28
Definition: UpdateData.h:59
int GetLength(void) const
Definition: SHA1.h:46
SHA_CTX mC
Definition: SHA1.h:49
static void Initialize(PCASC_SALSA20 pState, LPBYTE pbKey, DWORD cbKeyLength, LPBYTE pbVector)
Definition: CascDecrypt.cpp:81
#define TC_COMMON_API
Definition: Define.h:116
Definition: SHA1.h:29
uint8_t uint8
Definition: Define.h:152
std::integral_constant< uint32, SHA_DIGEST_LENGTH > DigestLength
Definition: SHA1.h:32
uint8 * GetDigest(void)
Definition: SHA1.h:45