OpenCPN Partial API docs
FlexHash.h
1 
2 /******************************************************************************
3  *
4  * Project: OpenCPN
5  * Purpose: Hash of arbitrary length
6  * Author: Anton Samsonov
7  *
8  ***************************************************************************
9  * Copyright (C) 2010 by David S. Register *
10  * *
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. *
15  * *
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 *
23  * Free Software Foundation, Inc., *
24  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
25  ***************************************************************************
26  *
27  */
28 
29 #ifndef __FLEXHASH_H__
30 #define __FLEXHASH_H__
31 
32 #include <vector>
33 #include "ssl/sha1.h"
34 
35 class FlexHash {
36 public:
37  FlexHash(size_t output_octets);
38 
39  void Reset(void);
40  void Update(const void* input, size_t input_octets);
41  void Finish(void);
42  void Receive(void* output);
43 
44  void Compute(const void* input, size_t input_octets, void* output);
45  static void Compute(const void* input, size_t input_octets, void* output,
46  size_t output_octets);
47 
48  static bool Test(void);
49 
50 protected:
51  sha1_context m_Context;
52  std::vector<unsigned char> m_Output;
53 };
54 
55 #endif