JUCE
Public Member Functions | Static Public Member Functions | List of all members
MD5 Class Reference

MD5 checksum class. More...

Public Member Functions

 MD5 ()
 Creates a null MD5 object. More...
 
 MD5 (const MD5 &)
 Creates a copy of another MD5. More...
 
MD5operator= (const MD5 &)
 Copies 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 ()
 Destructor. More...
 
MemoryBlock getRawChecksumData () const
 Returns the checksum as a 16-byte block of data. More...
 
const uint8getChecksumDataArray () const noexcept
 Returns a pointer to the 16-byte array of result data. More...
 
String toHexString () const
 Returns the checksum as a 32-digit hex string. More...
 
bool operator== (const MD5 &) const noexcept
 
bool operator!= (const MD5 &) const noexcept
 

Static Public Member Functions

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

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

Constructor & Destructor Documentation

◆ MD5() [1/7]

MD5::MD5 ( )

Creates a null MD5 object.

◆ MD5() [2/7]

MD5::MD5 ( const MD5 )

Creates a copy of another MD5.

◆ MD5() [3/7]

MD5::MD5 ( const MemoryBlock )
explicitnoexcept

Creates a checksum for a block of binary data.

◆ MD5() [4/7]

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

Creates a checksum for a block of binary data.

◆ MD5() [5/7]

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/7]

MD5::MD5 ( const File )
explicit

Creates a checksum for the contents of a file.

◆ MD5() [7/7]

MD5::MD5 ( CharPointer_UTF8  utf8Text)
explicitnoexcept

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

E.g.

MD5 checksum (myString.toUTF8());

◆ ~MD5()

MD5::~MD5 ( )

Destructor.

Member Function Documentation

◆ operator=()

MD5& MD5::operator= ( const MD5 )

Copies another MD5.

◆ getRawChecksumData()

MemoryBlock MD5::getRawChecksumData ( ) const

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

◆ getChecksumDataArray()

const uint8* MD5::getChecksumDataArray ( ) const
noexcept

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

References JUCE_LEAK_DETECTOR, operator!=(), and operator==().

◆ toHexString()

String MD5::toHexString ( ) const

Returns the checksum as a 32-digit hex string.

◆ fromUTF32()

static MD5 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.

◆ operator==()

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

◆ operator!=()

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

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