HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_SHA256.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: UT_SHA256.h (UT Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __UT_SHA256_H__
12 #define __UT_SHA256_H__
13 
14 #include "UT_API.h"
15 
16 #include "UT_String.h"
17 #include "UT_WorkBuffer.h"
18 
20 {
21 public:
22  UT_SHA256() { init(); }
23  // Produce a SHA256 hash
24  static void hash(const UT_WorkBuffer& input, UT_String& output);
25  static UT_StringHolder hash(const UT_StringView &input)
26  {
27  return hash({input});
28  }
29  static void hash(
30  const std::initializer_list<UT_StringView>& inputs,
31  UT_StringHolder& output);
32  static UT_StringHolder hash(
33  const std::initializer_list<UT_StringView>& inputs);
34 
35 protected:
36  void init();
37  void update(const unsigned char* message, unsigned int len);
38  void finalize(unsigned char* digest);
39  void transform(const unsigned char* message, unsigned int block_nb);
40 
41  static const unsigned int SHA256_BLOCK_SIZE = 64;
42  static const unsigned int DIGEST_SIZE = 32;
43 
44  unsigned int myTotalLength;
45  unsigned int myLength;
46  unsigned char myBlock[SHA256_BLOCK_SIZE * 2];
47  uint32 myH[8];
48 };
49 
50 #endif // __UT_SHA256_H__
GLuint GLsizei const GLchar * message
Definition: glcorearb.h:2543
#define UT_API
Definition: UT_API.h:14
unsigned int myTotalLength
Definition: UT_SHA256.h:44
A utility class to do read-only operations on a subset of an existing string.
Definition: UT_StringView.h:39
UT_SHA256()
Definition: UT_SHA256.h:22
unsigned int myLength
Definition: UT_SHA256.h:45
static UT_StringHolder hash(const UT_StringView &input)
Definition: UT_SHA256.h:25
GA_API const UT_StringHolder transform
unsigned int uint32
Definition: SYS_Types.h:40