sdk-world
v2026.11.05
PS2 SDK - world tier (copyleft-allowed, non-essential packages)
Toggle main menu visibility
Loading...
Searching...
No Matches
keccak.h
Go to the documentation of this file.
1
5
// //////////////////////////////////////////////////////////
6
// keccak.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
Keccak
//: public Hash
41
{
42
public
:
44
enum
Bits
{ Keccak224 = 224, Keccak256 = 256, Keccak384 = 384, Keccak512 = 512 };
45
47
explicit
Keccak
(
Bits
bits = Keccak256);
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
};
Keccak::Bits
Bits
algorithm variants
Definition
keccak.h:44
Keccak::operator()
std::string operator()(const void *data, size_t numBytes)
compute hash of a memory block
Definition
keccak.cpp:286
Keccak::Keccak
Keccak(Bits bits=Keccak256)
same as reset()
Definition
keccak.cpp:18
Keccak::getHash
std::string getHash()
return latest hash as hex characters
Definition
keccak.cpp:238
Keccak::reset
void reset()
restart
Definition
keccak.cpp:27
hash
include
keccak.h
Generated by
1.18.0