w3c / webcrypto

The W3C Web Cryptography API
https://w3c.github.io/webcrypto/
Other
265 stars 54 forks source link

support streaming hashing #250

Closed ianopolous closed 3 years ago

ianopolous commented 3 years ago

At the moment we are limiting to hashing data that we can fit into RAM because webcrypto.subtle.digest doesn't have a streaming api. This would be trivial and safe to expose, and would allow hashing of arbitrary amounts of data in low RAM usage.

something like the following

allow window.crypto.subtle.digest to have only the first argument (the algorithm) and return an object with "update(data)" and "complete()" methods.

twiss commented 3 years ago

Closing as a duplicate of #73.

ianopolous commented 3 years ago

@twiss That other issue is focused on encryption and decryption which do have non obvious questions. This issue is purely about hashing, which doesn't have those issues. It is worth separating out because this is a no brainer to implement with zero security considerations.

twiss commented 3 years ago

@ianopolous The other issue is about hashing as well, and has a concrete API proposal here: https://github.com/w3c/webcrypto/issues/73#issuecomment-455065709