JUCE  v5.4.1-191-g0ab5e696f
JUCE API
Looking for a senior C++ dev?
I'm looking for work. Hire me!
juce::MD5 Class Reference

MD5 checksum class. More...

#include <juce_MD5.h>

Collaboration diagram for juce::MD5:

Public Member Functions

 MD5 () noexcept
 Creates a null MD5 object. More...
 
 MD5 (const MD5 &) noexcept
 Creates a copy of another MD5. More...
 
 MD5 (const MemoryBlock &) noexcept
 Creates a checksum for a block of binary data. More...
 
 MD5 (const void *data, size_t numBytes) noexcept
 Creates a checksum for a block of binary data. More...
 
 MD5 (InputStream &input, int64 numBytesToRead=-1)
 Creates a checksum for the input from a stream. More...
 
 MD5 (const File &)
 Creates a checksum for the contents of a file. More...
 
 MD5 (CharPointer_UTF8 utf8Text) noexcept
 Creates a checksum of the characters in a UTF-8 buffer. More...
 
 ~MD5 () noexcept
 Destructor. More...
 
const uint8getChecksumDataArray () const noexcept
 Returns a pointer to the 16-byte array of result data. More...
 
MemoryBlock getRawChecksumData () const
 Returns the checksum as a 16-byte block of data. More...
 
bool operator!= (const MD5 &) const noexcept
 
MD5operator= (const MD5 &) noexcept
 Copies another MD5. More...
 
bool operator== (const MD5 &) const noexcept
 
String toHexString () const
 Returns the checksum as a 32-digit hex string. More...
 

Static Public Member Functions

static MD5 fromUTF32 (StringRef)
 Creates an MD5 from a little-endian UTF-32 encoded string. More...
 

Private Member Functions

 MD5 (const String &)=delete
 
void processData (const void *, size_t) noexcept
 
void processStream (InputStream &, int64)
 

Private Attributes

uint8 result [16]
 

Detailed Description

MD5 checksum class.

Create one of these with a block of source data or a stream, and it calculates the MD5 checksum of that data.

You can then retrieve this checksum as a 16-byte block, or as a hex string.

See also
SHA256

{Cryptography}

Constructor & Destructor Documentation

◆ MD5() [1/8]

juce::MD5::MD5 ( )
noexcept

Creates a null MD5 object.

◆ MD5() [2/8]

juce::MD5::MD5 ( const MD5 )
noexcept

Creates a copy of another MD5.

◆ MD5() [3/8]

juce::MD5::MD5 ( const MemoryBlock )
explicitnoexcept

Creates a checksum for a block of binary data.

◆ MD5() [4/8]

juce::MD5::MD5 ( const void *  data,
size_t  numBytes 
)
noexcept

Creates a checksum for a block of binary data.

◆ MD5() [5/8]

juce::MD5::MD5 ( InputStream input,
int64  numBytesToRead = -1 
)

Creates a checksum for the input from a stream.

This will read up to the given number of bytes from the stream, and produce the checksum of that. If the number of bytes to read is negative, it'll read until the stream is exhausted.

◆ MD5() [6/8]

juce::MD5::MD5 ( const File )
explicit

Creates a checksum for the contents of a file.

◆ MD5() [7/8]

juce::MD5::MD5 ( CharPointer_UTF8  utf8Text)
explicitnoexcept

Creates a checksum of the characters in a UTF-8 buffer.

E.g.

MD5 checksum (myString.toUTF8());

◆ ~MD5()

juce::MD5::~MD5 ( )
noexcept

Destructor.

◆ MD5() [8/8]

juce::MD5::MD5 ( const String )
explicitprivatedelete

Member Function Documentation

◆ fromUTF32()

static MD5 juce::MD5::fromUTF32 ( StringRef  )
static

Creates an MD5 from a little-endian UTF-32 encoded string.

Note that this method is provided for backwards-compatibility with the old version of this class, which had a constructor that took a string and performed this operation on it. In new code, you shouldn't use this, and are recommended to use the constructor that takes a CharPointer_UTF8 instead.

◆ getChecksumDataArray()

const uint8* juce::MD5::getChecksumDataArray ( ) const
inlinenoexcept

Returns a pointer to the 16-byte array of result data.

References juce::operator!=(), and juce::operator==().

◆ getRawChecksumData()

MemoryBlock juce::MD5::getRawChecksumData ( ) const

Returns the checksum as a 16-byte block of data.

◆ operator!=()

bool juce::MD5::operator!= ( const MD5 ) const
noexcept

◆ operator=()

MD5& juce::MD5::operator= ( const MD5 )
noexcept

Copies another MD5.

◆ operator==()

bool juce::MD5::operator== ( const MD5 ) const
noexcept

◆ processData()

void juce::MD5::processData ( const void *  ,
size_t   
)
privatenoexcept

◆ processStream()

void juce::MD5::processStream ( InputStream ,
int64   
)
private

◆ toHexString()

String juce::MD5::toHexString ( ) const

Returns the checksum as a 32-digit hex string.

Member Data Documentation

◆ result

uint8 juce::MD5::result[16]
private

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