Kea
3.1.1
crypto_hash.cc
Go to the documentation of this file.
1
// Copyright (C) 2014-2015 Internet Systems Consortium, Inc. ("ISC")
2
//
3
// This Source Code Form is subject to the terms of the Mozilla Public
4
// License, v. 2.0. If a copy of the MPL was not distributed with this
5
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7
#include <config.h>
8
9
#include <
cryptolink.h
>
10
#include <
cryptolink/crypto_hash.h
>
11
12
#include <boost/scoped_ptr.hpp>
13
14
#include <cstring>
15
16
namespace
isc
{
17
namespace
cryptolink
{
18
19
void
20
digest
(
const
void
*
data
,
const
size_t
data_len,
21
const
HashAlgorithm
hash_algorithm,
22
isc::util::OutputBuffer
& result,
size_t
len)
23
{
24
boost::scoped_ptr<Hash> hash(
25
CryptoLink::getCryptoLink
().createHash(hash_algorithm));
26
hash->update(
data
, data_len);
27
if
(len == 0) {
28
len = hash->getOutputLength();
29
}
30
hash->final(result, len);
31
}
32
33
void
34
deleteHash
(
Hash
* hash) {
35
delete
hash;
36
}
37
38
}
// namespace cryptolink
39
}
// namespace isc
isc::cryptolink::CryptoLink::getCryptoLink
static CryptoLink & getCryptoLink()
Returns a reference to the singleton instance.
Definition
cryptolink.cc:17
isc::cryptolink::Hash
Hash support.
Definition
crypto_hash.h:27
isc::util::OutputBuffer
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
Definition
buffer.h:346
crypto_hash.h
cryptolink.h
isc::cryptolink
Definition
botan_common.h:8
isc::cryptolink::HashAlgorithm
HashAlgorithm
Hash algorithm identifiers.
Definition
cryptolink.h:23
isc::cryptolink::deleteHash
void deleteHash(Hash *hash)
Delete an Hash object.
Definition
crypto_hash.cc:34
isc::cryptolink::digest
void digest(const void *data, const size_t data_len, const HashAlgorithm hash_algorithm, isc::util::OutputBuffer &result, size_t len)
Create an Hash digest for the given data.
Definition
crypto_hash.cc:20
isc::data
Definition
base_stamped_element.cc:12
isc
Defines the logger used by the top-level component of kea-lfc.
Definition
agent_parser.cc:148
src
lib
cryptolink
crypto_hash.cc
Generated on Fri Aug 29 2025 13:13:11 for Kea by
1.13.2