File tree 1 file changed +4
-14
lines changed
1 file changed +4
-14
lines changed Original file line number Diff line number Diff line change 9
9
*/
10
10
11
11
#include < Arduino_SHA256.h>
12
+ #include < Arduino_HEX.h>
12
13
#include " buffer.h"
13
14
14
15
void setup () {
@@ -22,22 +23,11 @@ void setup() {
22
23
sha256.update (buffer, sizeof (buffer));
23
24
sha256.finalize (sha);
24
25
25
- Serial.println (hexEncode (sha, sizeof (sha)));
26
+ Serial.println (THEXT::encode (sha, sizeof (sha)));
26
27
27
28
/* One-shot */
28
- arduino::sha256::sha256 (buffer, sizeof (buffer), sha);
29
- Serial.println (hexEncode (sha, sizeof (sha)));
30
- }
31
-
32
- static String hexEncode (uint8_t * in, uint32_t size) {
33
- String out;
34
- out.reserve ((size * 2 ) + 1 );
35
-
36
- char * ptr = out.begin ();
37
- for (uint32_t i = 0 ; i < size; i++) {
38
- ptr += sprintf (ptr, " %02X" , in[i]);
39
- }
40
- return String (out.c_str ());
29
+ SHA256::sha256 (buffer, sizeof (buffer), sha);
30
+ Serial.println (THEXT::encode (sha, sizeof (sha)));
41
31
}
42
32
43
33
void loop () { }
You can’t perform that action at this time.
0 commit comments