Skip to content

Commit b343bea

Browse files
committed
Fixed generic SHA1 name causing conflicts with other libraries
1 parent d7a68ae commit b343bea

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

examples/SHA1/SHA1.ino

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
2-
ArduinoBearSSL SHA1
2+
ArduinoBearSSL BearSHA1
33
4-
This sketch demonstrates how to create a SHA1 hash and HMAC
4+
This sketch demonstrates how to create a BearSHA1 hash and HMAC
55
for an input string.
66
77
This example code is in the public domain.
@@ -30,35 +30,35 @@ void loop() {
3030
}
3131

3232
void printSHA1(const char* str) {
33-
Serial.print("SHA1 of '");
33+
Serial.print("BearSHA1 of '");
3434
Serial.print(str);
3535
Serial.print("' is 0x");
3636

37-
SHA1.beginHash();
38-
SHA1.print(str);
39-
SHA1.endHash();
37+
BearSHA1.beginHash();
38+
BearSHA1.print(str);
39+
BearSHA1.endHash();
4040

4141
printResult();
4242
}
4343

4444
void printHMACSHA1(const char* secret, const char* str) {
45-
Serial.print("HMAC-SHA1 of '");
45+
Serial.print("HMAC-BearSHA1 of '");
4646
Serial.print(str);
4747
Serial.print("' with secret '");
4848
Serial.print(secret);
4949
Serial.print("' is 0x");
5050

51-
SHA1.beginHmac(secret);
52-
SHA1.print(str);
53-
SHA1.endHmac();
51+
BearSHA1.beginHmac(secret);
52+
BearSHA1.print(str);
53+
BearSHA1.endHmac();
5454

5555
printResult();
5656
}
5757

5858
void printResult()
5959
{
60-
while (SHA1.available()) {
61-
byte b = SHA1.read();
60+
while (BearSHA1.available()) {
61+
byte b = BearSHA1.read();
6262

6363
if (b < 16) {
6464
Serial.print("0");

src/SHA1.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ int SHA1Class::end(uint8_t *digest)
5454
return 1;
5555
}
5656

57-
SHA1Class SHA1;
57+
SHA1Class BearSHA1;

src/SHA1.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ class SHA1Class: public SHAClass {
4747
br_sha1_context _ctx;
4848
};
4949

50-
extern SHA1Class SHA1;
50+
extern SHA1Class BearSHA1;
5151

5252
#endif

0 commit comments

Comments
 (0)