You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not a big deal at all, but the method of timing the hash function also includes the time it takes to print the hash values. Typical code from examples below:
ms = micros(); // timing starts here
Sha256.initHmac(hmacKey1,20); // initialize and load the key - fair to include
Sha256.print("Hi There");// load the data - fair to include
printHash(Sha256.resultHmac()); //also includes time to serial print 32 hex characters
Serial.print(" Hash took : "); // includes time to print this label
Serial.print((micros() - ms)); // time calculated here
Serial.println(" micros");
Serial.println();
In one of my test cases, the time to perform the HMAC SHA256 was showing about 950 microseconds. After I reworked my code to not include the serial print, the time dropped to 344 microseconds. This time also included some code I added to convert the binary HMAC to Hex format.
I don't have a really good way to get accurate timing values that is worth sharing, but thought it might be a good idea to point this out for someone who might get discouraged on a slow processor. The code is much faster than the examples might indicate. Which is a good thing. I'm not suggesting that anything be changed unless there is a good place to add a note in the documentation.
The text was updated successfully, but these errors were encountered:
You are right. I will rework some code in january, as until the 1st of
January i wont be able to test changes to the freamework. Also i will try
to make a unified hash/encryption library in order to have multiple choices.
Thanks for the remarks,
Spaniakos
On Dec 17, 2015 1:12 AM, "Bud Nail" [email protected] wrote:
Not a big deal at all, but the method of timing the hash function also
includes the time it takes to print the hash values. Typical code from
examples below:
ms = micros(); // timing starts here
Sha256.initHmac(hmacKey1,20); // initialize and load the key - fair to
include
Sha256.print("Hi There");// load the data - fair to include
printHash(Sha256.resultHmac()); //also includes time to serial print 32
hex characters
Serial.print(" Hash took : "); // includes time to print this label
Serial.print((micros() - ms)); // time calculated here
Serial.println(" micros");
Serial.println();
In one of my test cases, the time to perform the HMAC SHA256 was showing
about 950 microseconds. After I reworked my code to not include the serial
print, the time dropped to 344 microseconds. This time also included some
code I added to convert the binary HMAC to Hex format.
I don't have a really good way to get accurate timing values that is worth
sharing, but thought it might be a good idea to point this out for someone
who might get discouraged on a slow processor. The code is much faster than
the examples might indicate. Which is a good thing. I'm not suggesting that
anything be changed unless there is a good place to add a note in the
documentation.
—
Reply to this email directly or view it on GitHub #6.
Not a big deal at all, but the method of timing the hash function also includes the time it takes to print the hash values. Typical code from examples below:
ms = micros(); // timing starts here
Sha256.initHmac(hmacKey1,20); // initialize and load the key - fair to include
Sha256.print("Hi There");// load the data - fair to include
printHash(Sha256.resultHmac()); //also includes time to serial print 32 hex characters
Serial.print(" Hash took : "); // includes time to print this label
Serial.print((micros() - ms)); // time calculated here
Serial.println(" micros");
Serial.println();
In one of my test cases, the time to perform the HMAC SHA256 was showing about 950 microseconds. After I reworked my code to not include the serial print, the time dropped to 344 microseconds. This time also included some code I added to convert the binary HMAC to Hex format.
I don't have a really good way to get accurate timing values that is worth sharing, but thought it might be a good idea to point this out for someone who might get discouraged on a slow processor. The code is much faster than the examples might indicate. Which is a good thing. I'm not suggesting that anything be changed unless there is a good place to add a note in the documentation.
The text was updated successfully, but these errors were encountered: