sdk-world v2026.11.05
PS2 SDK - world tier (copyleft-allowed, non-essential packages)
Loading...
Searching...
No Matches
MD5 Class Reference

compute MD5 hash More...

#include <md5.h>

Public Types

enum  { BlockSize = 512 / 8 , HashBytes = 16 }
 split into 64 byte blocks (=> 512 bits), hash is 16 bytes long More...

Public Member Functions

 MD5 ()
 same as reset()
std::string operator() (const void *data, size_t numBytes)
 compute MD5 of a memory block
std::string operator() (const std::string &text)
 compute MD5 of a string, excluding final zero
void add (const void *data, size_t numBytes)
 add arbitrary number of bytes
std::string getHash ()
 return latest hash as 32 hex characters
void getHash (unsigned char buffer[HashBytes])
 return latest hash as bytes
void reset ()
 restart

Detailed Description

compute MD5 hash

Usage: MD5 md5; std::string myHash = md5("Hello World"); // std::string std::string myHash2 = md5("How are you", 11); // arbitrary data, 11 bytes

or in a streaming fashion:

MD5 md5;
while (more data available)
  md5.add(pointer to fresh data, number of new bytes);
std::string myHash3 = md5.getHash();

Definition at line 41 of file md5.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

split into 64 byte blocks (=> 512 bits), hash is 16 bytes long

Definition at line 45 of file md5.h.

Constructor & Destructor Documentation

◆ MD5()

MD5::MD5 ( )

same as reset()

Definition at line 17 of file md5.cpp.

Member Function Documentation

◆ add()

void MD5::add ( const void * data,
size_t numBytes )

add arbitrary number of bytes

Definition at line 212 of file md5.cpp.

◆ getHash()

std::string MD5::getHash ( )

return latest hash as 32 hex characters

Definition at line 322 of file md5.cpp.

◆ operator()() [1/2]

std::string MD5::operator() ( const std::string & text)

compute MD5 of a string, excluding final zero

Definition at line 377 of file md5.cpp.

◆ operator()() [2/2]

std::string MD5::operator() ( const void * data,
size_t numBytes )

compute MD5 of a memory block

Definition at line 368 of file md5.cpp.

◆ reset()

void MD5::reset ( )

restart

Definition at line 24 of file md5.cpp.


The documentation for this class was generated from the following files: