F´ Flight Software - C/C++ Documentation
NASA-v1.5.0
A framework for building embedded system applications to NASA flight quality standards.
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
Functions
a
b
c
d
g
h
i
m
r
s
t
v
w
Variables
Typedefs
Enumerations
Enumerator
a
b
c
f
h
i
l
m
n
o
p
s
t
v
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
~
Functions
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
z
~
Variables
_
a
b
c
d
e
f
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
Typedefs
c
t
u
w
Enumerations
b
c
d
e
f
g
h
i
m
o
p
q
s
t
w
Enumerator
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
w
Related Functions
a
b
c
f
g
h
l
p
r
s
t
Files
File List
File Members
All
_
a
b
c
d
f
g
h
i
k
l
m
n
p
r
s
t
u
v
w
Functions
f
i
m
s
u
Variables
_
c
f
i
l
p
t
Typedefs
Enumerations
Enumerator
a
c
d
f
i
m
p
r
s
t
w
Macros
a
c
d
f
g
h
i
k
l
m
n
p
r
s
t
u
v
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
SHA256.cpp
Go to the documentation of this file.
1
// ======================================================================
2
// \title SHA256.cpp
3
// \author dinkel
4
// \brief cpp file for SHA implementation of Hash class
5
//
6
// \copyright
7
// Copyright 2009-2015, by the California Institute of Technology.
8
// ALL RIGHTS RESERVED. United States Government Sponsorship
9
// acknowledged.
10
//
11
// ======================================================================
12
13
#include <
Utils/Hash/Hash.hpp
>
14
15
namespace
Utils
{
16
17
Hash ::
18
Hash
()
19
{
20
this->
init
();
21
}
22
23
Hash ::
24
~Hash
()
25
{
26
}
27
28
void
Hash ::
29
hash
(
const
void
*
const
data,
const
NATIVE_INT_TYPE
len, HashBuffer& buffer)
30
{
31
U8
out[
SHA256_DIGEST_LENGTH
];
32
U8
* ret =
SHA256
((
U8
*) data, len, out);
33
FW_ASSERT
(ret !=
NULL
);
34
HashBuffer bufferOut(out,
sizeof
(out));
35
buffer = bufferOut;
36
}
37
38
void
Hash ::
39
init
(
void
)
40
{
41
int
ret =
SHA256_Init
(&this->hash_handle);
42
FW_ASSERT
(ret == 1);
43
}
44
45
void
Hash ::
46
update
(
const
void
*
const
data,
NATIVE_INT_TYPE
len)
47
{
48
int
ret =
SHA256_Update
(&this->hash_handle, (
U8
*) data, len);
49
FW_ASSERT
(ret == 1);
50
}
51
52
void
Hash ::
53
final
(HashBuffer& buffer)
54
{
55
U8
out[
SHA256_DIGEST_LENGTH
];
56
int
ret =
SHA256_Final
(out, &this->hash_handle);
57
FW_ASSERT
(ret == 1);
58
HashBuffer bufferOut(out,
sizeof
(out));
59
buffer = bufferOut;
60
}
61
62
}
U8
uint8_t U8
8-bit unsigned integer
Definition:
BasicTypes.hpp:76
SHA256
unsigned char * SHA256(const unsigned char *d, size_t n, unsigned char *md)
Utils
Definition:
CRCChecker.cpp:20
Utils::Hash::~Hash
~Hash()
Definition:
CRC32.cpp:24
Utils::Hash::final
void final(HashBuffer &buffer)
Definition:
CRC32.cpp:64
Utils::Hash::init
void init(void)
Definition:
CRC32.cpp:47
Hash.hpp
SHA256_Init
int SHA256_Init(SHA256_CTX *c)
SHA256_Final
int SHA256_Final(unsigned char *md, SHA256_CTX *c)
FW_ASSERT
#define FW_ASSERT(...)
Definition:
Assert.hpp:9
Utils::Hash::Hash
Hash()
Definition:
CRC32.cpp:18
SHA256_DIGEST_LENGTH
#define SHA256_DIGEST_LENGTH
Definition:
sha.h:128
Utils::Hash::update
void update(const void *const data, const NATIVE_INT_TYPE len)
Definition:
CRC32.cpp:53
NATIVE_INT_TYPE
int NATIVE_INT_TYPE
native integer type declaration
Definition:
BasicTypes.hpp:29
SHA256_Update
int SHA256_Update(SHA256_CTX *c, const void *data, size_t len)
NULL
#define NULL
NULL.
Definition:
BasicTypes.hpp:100
Utils::Hash::hash
static void hash(const void *data, const NATIVE_INT_TYPE len, HashBuffer &buffer)
Definition:
CRC32.cpp:29
Utils
Hash
openssl
SHA256.cpp
Generated by
1.8.19