summaryrefslogtreecommitdiff
path: root/simple.cpp
blob: ee5ab0cbdeecd38eb1bd5ed1e5a167b499a7f540 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// simple.cpp - written and placed in the public domain by Wei Dai

#include "pch.h"
#include "simple.h"
#include "secblock.h"

NAMESPACE_BEGIN(CryptoPP)

void HashTransformationWithDefaultTruncation::TruncatedFinal(byte *digest, unsigned int digestSize)
{
	ThrowIfInvalidTruncatedSize(digestSize);
	unsigned int fullDigestSize = DigestSize();
	if (digestSize == fullDigestSize)
		Final(digest);
	else
	{
		SecByteBlock buffer(fullDigestSize);
		Final(buffer);
		memcpy(digest, buffer, digestSize);
	}
}

NAMESPACE_END