sdk-world
v2026.11.05
PS2 SDK - world tier (copyleft-allowed, non-essential packages)
Toggle main menu visibility
Loading...
Searching...
No Matches
sha3.h
Go to the documentation of this file.
1
5
// //////////////////////////////////////////////////////////
6
// sha3.h
7
// Copyright (c) 2014,2015 Stephan Brumme. All rights reserved.
8
// see http://create.stephan-brumme.com/disclaimer.html
9
//
10
11
#pragma once
12
13
//#include "hash.h"
14
#include <string>
15
16
// define fixed size integer types
17
#ifdef _MSC_VER
18
// Windows
19
typedef
unsigned
__int8 uint8_t;
20
typedef
unsigned
__int64 uint64_t;
21
#else
22
// GCC
23
#include <stdint.h>
24
#endif
25
26
28
40
class
SHA3
//: public Hash
41
{
42
public
:
44
enum
Bits
{ Bits224 = 224, Bits256 = 256, Bits384 = 384, Bits512 = 512 };
45
47
explicit
SHA3
(
Bits
bits = Bits256);
48
50
std::string
operator()
(
const
void
* data,
size_t
numBytes);
52
std::string
operator()
(
const
std::string& text);
53
55
void
add(
const
void
* data,
size_t
numBytes);
56
58
std::string
getHash
();
59
61
void
reset
();
62
63
private
:
65
void
processBlock(
const
void
* data);
67
void
processBuffer();
68
70
enum
{ StateSize = 1600 / (8 * 8),
71
MaxBlockSize = 200 - 2 * (224 / 8) };
72
74
uint64_t m_hash[StateSize];
76
uint64_t m_numBytes;
78
size_t
m_blockSize;
80
size_t
m_bufferSize;
82
uint8_t m_buffer[MaxBlockSize];
84
Bits
m_bits;
85
};
SHA3::reset
void reset()
restart
Definition
sha3.cpp:29
SHA3::operator()
std::string operator()(const void *data, size_t numBytes)
compute hash of a memory block
Definition
sha3.cpp:288
SHA3::Bits
Bits
algorithm variants
Definition
sha3.h:44
SHA3::SHA3
SHA3(Bits bits=Bits256)
same as reset()
Definition
sha3.cpp:20
SHA3::getHash
std::string getHash()
return latest hash as hex characters
Definition
sha3.cpp:239
hash
include
sha3.h
Generated by
1.18.0