For some context, I'm updating some code that was importing from std/hashstd/hash(specifically std/hash/sha256std/hash/sha256) to use std/cryptostd/crypto since the hash submodule is long gone.
I've run up against a case where I'm not really sure what I should do to move forward. The code looks something like this:
const digest = new Sha256()for await (const chunk of generate.chunks()) { digest.update(chunk)}if(some_condition) { digest.update(bonus_chunk)}return digest.hex()
const digest = new Sha256()for await (const chunk of generate.chunks()) { digest.update(chunk)}if(some_condition) { digest.update(bonus_chunk)}return digest.hex()
Is this possible to handle in the web crypto standard? I'm pretty sure I should just be able to aggregate the chunks into one massive uint8array or something but I feel like there is no reason to buffer the whole thing into memory.
Any ideas?
Continue the conversation
Join the Discord to ask follow-up questions and connect with the community
D
Deno
Chat about Deno, a modern runtime for JavaScript and TypeScript.