This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

NRF52 HMAC-SHA1 performances

Hello,

I'm working on a project that needs sha1 hash functionality and I found this thread about the integration of openssl hmac lib:

devzone.nordicsemi.com/.../

"It should be possible to make an embedded version of the hmac function, there several C sources available online. However I do not recommend it as it will have an immense runtime, causing system delays and high power consumption."

I've tried on my side to use this code: tls.mbed.org/sha-1-source-code

I didn't run any test bench yet but it looks really fast (few millisecs) with any buffer size (I've tried up to 1Ko).

Could you clarify under which circumpstances you do not recommand to do sha1 in your code please ?

Thank you, Adrien.

  • Hi,

    If you are interested in cryptography functionality, I would recommend taking a look at the nRF52840. The nRF52840 implements the ARM TrustZoneRegistered Cryptocell 310 cryptographic accelerator. Using the Cryptocell hardware to perform cryptographic operations, you will see that applications that use this hardware-accelerated backend usually consume less power and are faster and smaller in size than applications that use a software backend.

    Generally, these software cryptographic operations can use a lot of processing time, especially if the software library used is not written or optimized for an embedded system. So this is probably what Øyvind was concerned about. But it also depends on how often you need to do the sha1 hashing, if you continuously need to use the CPU for several milliseconds, then you might run in to problems with both power consumption and maintaining the performance on the BLE link. So if you for example need to send a lot of data over BLE, then this would not be a good time to use the CPU to do cryptographic operations.

Related