File tree 2 files changed +87
-0
lines changed
2 files changed +87
-0
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ This file is part of ArduinoIoTCloud.
3
+
4
+ Copyright 2020 ARDUINO SA (http://www.arduino.cc/)
5
+
6
+ This software is released under the GNU General Public License version 3,
7
+ which covers the main part of arduino-cli.
8
+ The terms of this license can be found at:
9
+ https://www.gnu.org/licenses/gpl-3.0.en.html
10
+
11
+ You can be released from the requirements of the above licenses by purchasing
12
+ a commercial license. Buying such a license is mandatory if you want to modify or
13
+ otherwise use the software for commercial activities involving the Arduino
14
+ software without disclosing the source code of your own applications. To purchase
15
+ a commercial license, send an email to [email protected] .
16
+ */
17
+
18
+ /* *****************************************************************************
19
+ * INCLUDE
20
+ ******************************************************************************/
21
+
22
+ #include " SHA256.h"
23
+
24
+ /* *****************************************************************************
25
+ * PUBLIC MEMBER FUNCTIONS
26
+ ******************************************************************************/
27
+
28
+ void SHA256::begin ()
29
+ {
30
+ br_sha256_init (&_ctx);
31
+ }
32
+
33
+ void SHA256::update (uint8_t const * data, size_t const len)
34
+ {
35
+ br_sha256_update (&_ctx, data, len);
36
+ }
37
+
38
+ void SHA256::finalize (char * hash)
39
+ {
40
+ br_sha256_out (&_ctx, hash);
41
+ }
Original file line number Diff line number Diff line change
1
+ /*
2
+ This file is part of ArduinoIoTCloud.
3
+
4
+ Copyright 2020 ARDUINO SA (http://www.arduino.cc/)
5
+
6
+ This software is released under the GNU General Public License version 3,
7
+ which covers the main part of arduino-cli.
8
+ The terms of this license can be found at:
9
+ https://www.gnu.org/licenses/gpl-3.0.en.html
10
+
11
+ You can be released from the requirements of the above licenses by purchasing
12
+ a commercial license. Buying such a license is mandatory if you want to modify or
13
+ otherwise use the software for commercial activities involving the Arduino
14
+ software without disclosing the source code of your own applications. To purchase
15
+ a commercial license, send an email to [email protected] .
16
+ */
17
+
18
+ #ifndef ARDUINO_TLS_UTILITY_SHA256_H_
19
+ #define ARDUINO_TLS_UTILITY_SHA256_H_
20
+
21
+ /* *****************************************************************************
22
+ * INCLUDE
23
+ ******************************************************************************/
24
+
25
+ #include " ../bearssl/bearssl_hash.h"
26
+
27
+ /* *****************************************************************************
28
+ * CLASS DECLARATION
29
+ ******************************************************************************/
30
+
31
+ class SHA256
32
+ {
33
+
34
+ public:
35
+
36
+ void begin ();
37
+ void update (uint8_t const * data, size_t const len);
38
+ void finalize (char * hash);
39
+
40
+ private:
41
+
42
+ br_sha256_context _ctx;
43
+
44
+ };
45
+
46
+ #endif /* ARDUINO_TLS_UTILITY_SHA256_H_ */
You can’t perform that action at this time.
0 commit comments