Chevron DownAPI Reference

Overview

From-v2.3

The @loaders.gl/crypto module provides a selection of optional cryptographic hash plugins for loaders.gl.

This module is a wrapper around crypto-js which is an archived project. Make your choices around whether and how to use this module accordingly (i.e. building on a module that is not actively maintenaned is not ideal for security related algorithms).

Cryptographic Formats

MD5, SHA256 and many more, see crypto-js

Cryptographic Hash API

The API offers "transforms" that can calculate a cryptographic hash incrementally on data as it comes in on a stream.

TransformsSyncDescription
CRC32HashTransformYBase64-encoded Cryptographic Hash
CRC32CHashTransformYBase64-encoded Cryptographic Hash
MD5HashTransformYBase64-encoded Cryptographic Hash
CryptographicHashTransformYBase64-encoded Cryptographic Hash

Performance

Note that cryptographic hashing is a computationally expensive operation, linear in the size of the data being hashed. Hashing speeds are currently in the order of ~20-30MB/s on 2019 Macbook Pros.

Cryptographic Hash
├─ CRC32HashTransform#hash(): 150M bytes/s
├─ CRC32CHashTransform#hash(): 151M bytes/s
├─ MD5HashTransform#hash(): 75.8M bytes/s
├─ CryptoHashTransform#hashSync(SHA256): 30.6M bytes/s
├─ CryptoHashTransform#hash(MD5): 18.9M bytes/s