Welcome to little lamb

Code » test-hashes » next » tree

[next] / src / sha3-nettle-impl-le.c

#include "sha3-nettle-impl-le.h"

void
_nettle_write_le64(size_t length, uint8_t *dst,
                   const uint64_t *src)
{
	size_t i;
	size_t words;
	unsigned leftover;

	words = length / 8;
	leftover = length % 8;

	for (i = 0; i < words; i++, dst += 8)
		LE_WRITE_UINT64(dst, src[i]);

	if (leftover)
	{
		uint64_t word;

		word = src[i];

		do
		{
			*dst++ = word & 0xff;
			word >>= 8;
		}
		while (--leftover);
	}
}