apple / swift-crypto

Open-source implementation of a substantial portion of the API of Apple CryptoKit suitable for use on Linux platforms.
https://apple.github.io/swift-crypto
Apache License 2.0
1.47k stars 166 forks source link

Crypto operations on streamed data #104

Open kodlian opened 2 years ago

kodlian commented 2 years ago

New API Proposal: Crypto operations on streamed data

Motivation:

Add APIs to handle crypto operations on streamed data, meaning by processing chunks of data of arbitrary size in a non-continuous way. These APIs should offer three phases:

Cipher, Digest, and HMac operations would benefit from such API. Although it may not be possible to add this kind of streamed operation on all the algorithms.

Such APIs exist in Common Crypto on the Apple Platforms through for instance CCCryptorCreate, CCCryptorUpdate, and CCCryptorFinal.

Importance:

When performing a crypto operation on a large file, it must be done by streaming the data instead of keeping it all in memory/loading all in memory.