Skip to main content


Performs a SHA-256 hash function




Name Type Description
dataToHash String or blob The data to which the hash function will be applied


Blob — the hashed data (32 bytes)


This method brings to the device equivalent functionality to the agent’s http.hash.sha256(). It performs a SHA-256 hash on the input data.

Device Performance Note

The hashing function provided by crypto.sha256() is computationally intensive, and customers should be aware that calling the method may have an impact on application performance on the device.

For example, on an imp004m, using 32-byte messages and keys, crypto.sha256() takes approximately 740-800µs. For longer messages, the throughput is approximately 1.2MB/s.

The imp004m is the slowest imp currently available, so this represents the worst performance a customer might see. Other imps will perform these operations more quickly.