sdk-world v2026.11.05
PS2 SDK - world tier (copyleft-allowed, non-essential packages)
Loading...
Searching...
No Matches
crc32.h
Go to the documentation of this file.
1
5// //////////////////////////////////////////////////////////
6// crc32.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
19typedef unsigned __int8 uint8_t;
20typedef unsigned __int32 uint32_t;
21#else
22// GCC
23#include <stdint.h>
24#endif
25
26
28
45class CRC32 //: public Hash
46{
47public:
49 enum { HashBytes = 4 };
50
52 CRC32();
53
55 std::string operator()(const void* data, size_t numBytes);
57 std::string operator()(const std::string& text);
58
60 void add(const void* data, size_t numBytes);
61
63 std::string getHash();
65 void getHash(unsigned char buffer[HashBytes]);
66
68 void reset();
69
70private:
72 uint32_t m_hash;
73};
void getHash(unsigned char buffer[HashBytes])
return latest hash as bytes
CRC32()
same as reset()
Definition crc32.cpp:18
void reset()
restart
Definition crc32.cpp:25
std::string operator()(const void *data, size_t numBytes)
compute CRC32 of a memory block
Definition crc32.cpp:419
void add(const void *data, size_t numBytes)
add arbitrary number of bytes
Definition crc32.cpp:341
std::string getHash()
return latest hash as 8 hex characters
Definition crc32.cpp:385