nRF5 SDK v17.0.2
Hash Example

The Hash example shows how to perform hash calculations using Hash - Cryptographic hash functions.

Note
This example can run in software or hardware, depending on the supported features of your SoC. It uses the default backend for the specific platform, but you can test it using different backends. For more details on how to change backends, see Configuring nrf_crypto frontend and backends.

You can find the source code and the project file of the example in the following folder: <InstallFolder>\examples\crypto\nrf_crypto\hash

Testing

Test the Hash Example application by performing the following steps:

  1. Skip this step if you are using an RTT viewer. By default, nrf_crypto examples are configured to use RTT for logging.
    Start a terminal emulator like PuTTY and connect to the used COM port with the following UART settings:
    • Baud rate: 115.200
    • 8 data bits
    • 1 stop bit
    • No parity
    • HW flow control: None
  2. Compile and program the application.
  3. Observe the result of the hash calculations in the log using an RTT viewer or a terminal emulator.
    <info> app: Calculating SHA-256 hash with init/update/finalize
    <info> app: SHA-256 hash calculation was correct
    <info> app: Calculating SHA-256 hash with nrf_crypto_hash_compute (integrated version)
    <info> app: Integrated SHA-256 hash calculation was correct

Documentation feedback | Developer Zone | Subscribe | Updated