Skip to main content





The crypto object can be used to perform various cryptography functions in Squirrel running on the device. This can be used to ensure data integrity, and is useful in a number of security applications. The object is automatically instantiated as a member of the imp object.

It primarily provides key methods that replicate on the device certain security functionality previously provided only by the agent by way of the hash object.

Performance Note

The hashing functions provided by the crypto object are computationally intensive, and customers should be aware that calling the object’s methods 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, and crypto.hmacsha256 takes approximately 1000-1100µ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.

The crypto object has the following member methods: