blob: 21e1e71c7c72e68257507e5bef4c55b56df5ce73 [file] [log] [blame]
Jeff Thompson3af7e792013-08-23 14:22:11 -07001/**
Jeff Thompson7687dc02013-09-13 11:54:07 -07002 * Copyright (C) 2013 Regents of the University of California.
Jeff Thompson3af7e792013-08-23 14:22:11 -07003 * See COPYING for copyright and distribution information.
4 */
5
Alexander Afanasyevd409d592014-01-28 18:36:38 -08006#ifndef NDN_UTIL_CRYPTO_HPP
7#define NDN_UTIL_CRYPTO_HPP
8
Alexander Afanasyev19508852014-01-29 01:01:51 -08009#include "../common.hpp"
Yingdi Yu21157162014-02-28 13:02:34 -080010#include "../encoding/buffer.hpp"
Jeff Thompson3af7e792013-08-23 14:22:11 -070011
Alexander Afanasyevd409d592014-01-28 18:36:38 -080012namespace ndn {
Jeff Thompson3af7e792013-08-23 14:22:11 -070013
14/**
15 * Compute the sha-256 digest of data.
16 * @param data Pointer to the input byte array.
17 * @param dataLength The length of data.
18 * @param digest A pointer to a buffer of size SHA256_DIGEST_LENGTH to receive the data.
19 */
Jeff Thompson97223af2013-09-24 17:01:27 -070020void ndn_digestSha256(const uint8_t *data, size_t dataLength, uint8_t *digest);
Jeff Thompson3af7e792013-08-23 14:22:11 -070021
Yingdi Yu21157162014-02-28 13:02:34 -080022namespace crypto {
23
24static size_t SHA256_DIGEST_LENGTH = 32;
25
26/**
27 * Compute the sha-256 digest of data.
28 * @param data Pointer to the input byte array.
29 * @param dataLength The length of data.
30 * @return A pointer to a buffer of SHA256_DIGEST.
31 */
32ConstBufferPtr
33sha256(const uint8_t *data, size_t dataLength);
34
35} // namespace crypto
36
Alexander Afanasyevd409d592014-01-28 18:36:38 -080037} // namespace ndn
Jeff Thompson3af7e792013-08-23 14:22:11 -070038
Alexander Afanasyevd409d592014-01-28 18:36:38 -080039#endif // NDN_UTIL_CRYPTO_HPP