Fixed some build warnings in release mode
[amule.git] / src / SHA.h
blob9712410aebcc4755d50ad56690efeb46b7f2379e
1 //
2 // This file is part of the aMule Project.
3 //
4 // Copyright (c) 2004-2011 Angel Vidal ( kry@amule.org )
5 // Copyright (c) 2003-2011 aMule Team ( admin@amule.org / http://www.amule.org )
6 //
7 // Any parts of this program derived from the xMule, lMule or eMule project,
8 // or contributed by third-party developers are copyrighted by their
9 // respective authors.
11 // This program is free software; you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation; either version 2 of the License, or
14 // (at your option) any later version.
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program; if not, write to the Free Software
23 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
25 // Kry - Modified version of the original SHA.cpp to work on linux and
26 // use wxWidgets. Original license follows.
30 ---------------------------------------------------------------------------
31 Copyright (c) 2002-2011 Dr Brian Gladman ( brg@gladman.me.uk )
32 All rights reserved.
34 LICENSE TERMS
36 The free distribution and use of this software in both source and binary
37 form is allowed (with or without changes) provided that:
39 1. distributions of this source code include the above copyright
40 notice, this list of conditions and the following disclaimer;
42 2. distributions in binary form include the above copyright
43 notice, this list of conditions and the following disclaimer
44 in the documentation and/or other associated materials;
46 3. the copyright holder's name is not used to endorse products
47 built using this software without specific written permission.
49 ALTERNATIVELY, provided that this notice is retained in full, this product
50 may be distributed under the terms of the GNU General Public License (GPL),
51 in which case the provisions of the GPL apply INSTEAD OF those given above.
53 DISCLAIMER
55 This software is provided 'as is' with no explicit or implied warranties
56 in respect of its properties, including, but not limited to, correctness
57 and/or fitness for purpose.
58 ---------------------------------------------------------------------------
59 Issue Date: 30/11/2002
61 This is a byte oriented version of SHA1 that operates on arrays of bytes
62 stored in memory. It runs at 22 cycles per byte on a Pentium P4 processor
65 #ifndef __SHA_H__
66 #define __SHA_H__
68 #include "SHAHashSet.h"
70 class CSHA : public CAICHHashAlgo
72 // Construction
73 public:
74 CSHA();
75 virtual ~CSHA() {};
76 // Operations
77 public:
78 virtual void Reset();
79 virtual void Add(const void* pData, uint32 nLength);
80 virtual void Finish(CAICHHash& Hash);
81 virtual void GetHash(CAICHHash& Hash);
82 protected:
83 void Compile();
84 private:
85 uint32 m_nCount[2];
86 uint32 m_nHash[5];
87 uint32 m_nBuffer[16];
90 #define SHA1_BLOCK_SIZE 64
91 #define SHA1_DIGEST_SIZE 20
93 #endif // __SHA_H__
94 // File_checked_for_headers