Ejemplo n.º 1
0
MD5::MD5 (const String& text)
{
    ProcessContext context;
    String::CharPointerType t (text.getCharPointer());

    while (! t.isEmpty())
    {
        // force the string into integer-sized unicode characters, to try to make it
        // get the same results on all platforms + compilers.
        uint32 unicodeChar = ByteOrder::swapIfBigEndian ((uint32) t.getAndAdvance());

        context.processBlock (&unicodeChar, sizeof (unicodeChar));
    }

    context.finish (result);
}
Ejemplo n.º 2
0
void MD5::processStream (InputStream& input, int64 numBytesToRead)
{
    ProcessContext context;

    if (numBytesToRead < 0)
        numBytesToRead = std::numeric_limits<int64>::max();

    while (numBytesToRead > 0)
    {
        uint8 tempBuffer [512];
        const int bytesRead = input.read (tempBuffer, (int) jmin (numBytesToRead, (int64) sizeof (tempBuffer)));

        if (bytesRead <= 0)
            break;

        numBytesToRead -= bytesRead;

        context.processBlock (tempBuffer, bytesRead);
    }

    context.finish (result);
}
Ejemplo n.º 3
0
MD5::MD5 (const void* data, const size_t numBytes)
{
    ProcessContext context;
    context.processBlock (data, numBytes);
    context.finish (result);
}
Ejemplo n.º 4
0
//==============================================================================
MD5::MD5 (const MemoryBlock& data)
{
    ProcessContext context;
    context.processBlock (data.getData(), data.getSize());
    context.finish (result);
}