Improve convert to big-endian from little-endian (#1804) (#1815)

This commit is contained in:
komainu8
2017-07-17 16:59:28 +09:00
committed by Aleksandar Fabijanic
parent f2bb0570c9
commit 1e4ee012a2

View File

@@ -18,6 +18,7 @@
#include "Poco/SHA1Engine.h"
#include "Poco/ByteOrder.h"
#include <cstring>
@@ -50,13 +51,12 @@ inline void SHA1Engine::byteReverse(UInt32* buffer, int byteCount)
byteCount /= sizeof(UInt32);
for(int count = 0; count < byteCount; count++)
{
UInt32 value = (buffer[ count ] << 16) | (buffer[ count ] >> 16);
buffer[count] = ((value & 0xFF00FF00L) >> 8) | ((value & 0x00FF00FFL) << 8);
buffer[count] = Poco::ByteOrder::toBigEndian(buffer[ count ]);
}
#endif // POCO_ARCH_LITTLE_ENDIAN
}
void SHA1Engine::updateImpl(const void* buffer_, std::size_t count)
{
const BYTE* buffer = (const BYTE*) buffer_;