NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
Main Page
Related Pages
Modules
+
Namespaces
Namespace List
+
Namespace Members
+
All
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
+
Functions
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
+
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
+
Typedefs
a
b
c
d
e
f
h
i
l
m
n
o
p
q
r
s
t
u
v
Enumerations
+
Enumerator
a
b
c
d
e
f
h
i
k
l
m
n
o
p
q
r
s
u
v
+
Classes
Class List
Class Index
Class Hierarchy
+
Class Members
+
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
~
+
Functions
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
~
+
Variables
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
w
+
Typedefs
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
Enumerations
+
Enumerator
a
d
e
f
i
k
l
n
p
r
s
u
w
+
Related Functions
b
c
d
e
f
g
i
k
l
m
n
o
p
s
v
+
Files
File List
+
File Members
+
All
a
b
c
d
e
f
g
h
i
k
l
m
n
p
r
s
u
v
w
+
Functions
c
f
h
m
r
s
u
w
+
Variables
a
c
d
g
k
l
n
p
r
s
Typedefs
+
Macros
b
d
e
f
i
l
m
n
p
r
s
u
v
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
crypto.cpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22
#include "
crypto.hpp
"
23
#include "../encoding/buffer-stream.hpp"
24
25
#include "../security/v1/cryptopp.hpp"
26
27
namespace
ndn
{
28
namespace
crypto {
29
30
ConstBufferPtr
31
computeSha256Digest
(
const
uint8_t* data,
size_t
dataLength)
32
{
33
try
{
34
CryptoPP::SHA256
hash;
35
OBufferStream
os;
36
CryptoPP::StringSource(data, dataLength,
true
,
37
new
CryptoPP::HashFilter(hash,
new
CryptoPP::FileSink(os)));
38
return
os.
buf
();
39
}
40
catch
(CryptoPP::Exception& e) {
41
return
ConstBufferPtr
();
42
}
43
}
44
45
}
// namespace crypto
46
}
// namespace ndn
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
crypto.hpp
ndn::OBufferStream::buf
shared_ptr< Buffer > buf()
Flush written data to the stream and return shared pointer to the underlying buffer.
Definition:
buffer-stream.cpp:54
ndn::crypto::computeSha256Digest
ConstBufferPtr computeSha256Digest(const uint8_t *data, size_t dataLength)
Compute the sha-256 digest of data.
Definition:
crypto.cpp:31
ndn::DigestAlgorithm::SHA256
ndn::OBufferStream
implements an output stream that constructs ndn::Buffer
Definition:
buffer-stream.hpp:70
ndn::ConstBufferPtr
shared_ptr< const Buffer > ConstBufferPtr
Definition:
buffer.hpp:33
ndnSIM
ndn-cxx
src
util
crypto.cpp
Generated on Wed Jan 11 2017 18:17:14 for ndnSIM by
1.8.13