F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
Hash.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title Hash.hpp
3 // \author dinkel
4 // \brief hpp file for Hash class
5 //
6 // \copyright
7 // Copyright 2009-2015, by the California Institute of Technology.
8 // ALL RIGHTS RESERVED. United States Government Sponsorship
9 // acknowledged.
10 //
11 // ======================================================================
12 
13 #ifndef UTILS_HASH_HPP
14 #define UTILS_HASH_HPP
15 
16 #include "Fw/Types/StringType.hpp"
18 
19 namespace Utils {
20 
24  class Hash {
25 
26  public:
27 
28  // ----------------------------------------------------------------------
29  // Construction and destruction
30  // ----------------------------------------------------------------------
31 
34  Hash();
35 
38  ~Hash();
39 
40  public:
41 
42  // ----------------------------------------------------------------------
43  // Public static methods
44  // ----------------------------------------------------------------------
45 
50  static void hash(
51  const void *data,
52  const NATIVE_INT_TYPE len,
53  HashBuffer& buffer
54  );
55 
56  public:
57 
58  // ----------------------------------------------------------------------
59  // Public instance methods
60  // ----------------------------------------------------------------------
61 
64  void init();
65 
68  void setHashValue(
69  HashBuffer &value
70  );
71 
75  void update(
76  const void *const data,
77  const NATIVE_INT_TYPE len
78  );
79 
82  void final(
83  HashBuffer& buffer
84  );
85 
88  void final(U32 &hashvalue);
89 
93  static const char* getFileExtensionString();
94 
97  static void addFileExtension(
98  const Fw::StringBase& baseName,
99  Fw::StringBase& extendedName
100  );
101 
105 
106  private:
107 
108  // ----------------------------------------------------------------------
109  // Private member variables
110  // ----------------------------------------------------------------------
111 
114  HASH_HANDLE_TYPE hash_handle;
115 
116  };
117 
118 }
119 
120 #endif
PlatformIntType NATIVE_INT_TYPE
Definition: BasicTypes.h:51
PlatformUIntType NATIVE_UINT_TYPE
Definition: BasicTypes.h:52
#define HASH_HANDLE_TYPE
Definition: CRC32.hpp:12
A container class for holding a hash buffer.
Definition: HashBuffer.hpp:26
A generic interface for creating and comparing hash values.
Definition: Hash.hpp:24
static void hash(const void *data, const NATIVE_INT_TYPE len, HashBuffer &buffer)
Definition: CRC32.cpp:29
static NATIVE_UINT_TYPE getFileExtensionLength()
Definition: HashCommon.cpp:20
static const char * getFileExtensionString()
Definition: HashCommon.cpp:6
static void addFileExtension(const Fw::StringBase &baseName, Fw::StringBase &extendedName)
Definition: HashCommon.cpp:12
void init()
Definition: CRC32.cpp:47
void update(const void *const data, const NATIVE_INT_TYPE len)
Definition: CRC32.cpp:53
void setHashValue(HashBuffer &value)
Definition: CRC32.cpp:82