Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
CC32xxSha.hxx
Go to the documentation of this file.
1
36#ifndef _CC32xxSHA_HXX_
37#define _CC32xxSHA_HXX_
38
39#define USE_CC3220_ROM_DRV_API
40
41#include "driverlib/prcm.h"
42#include "driverlib/rom.h"
43#include "driverlib/rom_map.h"
44#include "driverlib/shamd5.h"
45#include "inc/hw_dthe.h"
46#include "inc/hw_memmap.h"
47#include "inc/hw_types.h"
48
49#include <string>
50
51#include "utils/SyncStream.hxx"
52
54{
55public:
61 static std::string sha256(const void *data, size_t len)
62 {
63 MAP_SHAMD5ConfigSet(SHAMD5_BASE, SHAMD5_ALGO_SHA256, 1, 1, 0, 0);
64 std::string ret(32, 0);
65 // Note: this should really be SHAMD5DataProcess, but that has an
66 // assert on len%64 == 0 for no reason. The below function does the
67 // same thing but without the extra assert.
68 ROM_SHAMD5DataProcess(
69 SHAMD5_BASE, (uint8_t *)data, len, (uint8_t *)&ret[0]);
70 return ret;
71 }
72
73private:
76};
77
78#endif // _CC32xxSHA_HXX_
SHAHelper()
This class cannot be instantiated.
static std::string sha256(const void *data, size_t len)
Computes a SHA-256 hash of the given input data.
Definition CC32xxSha.hxx:61