diff --git a/examples/SHA1/SHA1.ino b/examples/SHA1/SHA1.ino index 456d75d..67b6a4b 100644 --- a/examples/SHA1/SHA1.ino +++ b/examples/SHA1/SHA1.ino @@ -34,9 +34,9 @@ void printSHA1(const char* str) { Serial.print(str); Serial.print("' is 0x"); - SHA1.beginHash(); - SHA1.print(str); - SHA1.endHash(); + BearSHA1.beginHash(); + BearSHA1.print(str); + BearSHA1.endHash(); printResult(); } @@ -48,17 +48,17 @@ void printHMACSHA1(const char* secret, const char* str) { Serial.print(secret); Serial.print("' is 0x"); - SHA1.beginHmac(secret); - SHA1.print(str); - SHA1.endHmac(); + BearSHA1.beginHmac(secret); + BearSHA1.print(str); + BearSHA1.endHmac(); printResult(); } void printResult() { - while (SHA1.available()) { - byte b = SHA1.read(); + while (BearSHA1.available()) { + byte b = BearSHA1.read(); if (b < 16) { Serial.print("0"); diff --git a/src/SHA1.cpp b/src/SHA1.cpp index c59d728..ad9cc70 100644 --- a/src/SHA1.cpp +++ b/src/SHA1.cpp @@ -1,7 +1,7 @@ /* * Copyright (c) 2019 Arduino SA. All rights reserved. * - * Permission is hereby granted, free of charge, to any person obtaining + * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, @@ -9,12 +9,12 @@ * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * - * The above copyright notice and this permission notice shall be + * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN @@ -22,39 +22,31 @@ * SOFTWARE. */ -#include #include "SHA1.h" +#include -SHA1Class::SHA1Class() : - SHAClass(SHA1_BLOCK_SIZE, SHA1_DIGEST_SIZE) -{ -} +SHA1Class::SHA1Class() : SHAClass(SHA1_BLOCK_SIZE, SHA1_DIGEST_SIZE) {} -SHA1Class::~SHA1Class() -{ -} +SHA1Class::~SHA1Class() {} -int SHA1Class::begin() -{ +int SHA1Class::begin() { br_sha1_init(&_ctx); return 1; } -int SHA1Class::update(const uint8_t *buffer, size_t size) -{ +int SHA1Class::update(const uint8_t *buffer, size_t size) { br_sha1_update(&_ctx, buffer, size); return 1; } -int SHA1Class::end(uint8_t *digest) -{ +int SHA1Class::end(uint8_t *digest) { br_sha1_out(&_ctx, digest); return 1; } #if !defined(ARDUINO_BEARSSL_DISABLE_SHA1) -SHA1Class SHA1; +SHA1Class BearSHA1; #endif diff --git a/src/SHA1.h b/src/SHA1.h index c9fdeb0..8a2918c 100644 --- a/src/SHA1.h +++ b/src/SHA1.h @@ -47,6 +47,6 @@ class SHA1Class: public SHAClass { br_sha1_context _ctx; }; -extern SHA1Class SHA1; +extern SHA1Class BearSHA1; #endif