sptk2 logo
SPTK Home Page
Public Types | Public Member Functions | Friends | List of all members
sptk::MD5 Class Reference

#include <md5.h>

Public Types

using size_type = unsigned int
 

Public Member Functions

 MD5 ()
 
 MD5 (const Buffer &data)
 
void update (const unsigned char *buffer, size_type length)
 
void update (const char *buffer, size_type length)
 
MD5finalize ()
 
String hexdigest () const
 

Friends

std::ostream & operator<< (std::ostream &, MD5 md5)
 

Detailed Description

Calculates MD5 hashes of strings or byte arrays

usage: 1) feed it blocks of uchars with update() 2) finalize() 3) get hexdigest() string or MD5(std::string).hexdigest()

assumes that char is 8 bit and int is 32 bit

Member Typedef Documentation

◆ size_type

using sptk::MD5::size_type = unsigned int

Defines integer type

Constructor & Destructor Documentation

◆ MD5() [1/2]

sptk::MD5::MD5 ( )

Default constructor

◆ MD5() [2/2]

sptk::MD5::MD5 ( const Buffer data)
explicit

Shortcut constructor

Immediately processes text. The result can be read with hexdigest().

Parameters
dataText to MD5

Member Function Documentation

◆ finalize()

MD5 & sptk::MD5::finalize ( )

Finalizes MD5 sum

◆ hexdigest()

String sptk::MD5::hexdigest ( ) const

Returns hexadecimal presentation of MD5 sum

◆ update() [1/2]

void sptk::MD5::update ( const char *  buffer,
size_type  length 
)

Adds data portion to MD5

Parameters
bufferInput data
lengthSize of input data

◆ update() [2/2]

void sptk::MD5::update ( const unsigned char *  buffer,
size_type  length 
)

Adds data portion to MD5

Parameters
bufferInput data
lengthSize of input data

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  ,
MD5  md5 
)
friend

Prints MD5 sum to stream


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

Fri Oct 14 2022 09:58:43: SPTK 5.4.1