Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SHA256 project #119

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions showcase/sha256.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: SHA256 Digest Implemented in WebAssembly Text
source_url: https://github.com/ChrisWhealy/wasm_sha256
website: https://github.com/ChrisWhealy/wasm_sha256
description: An implementation of the SHA256 message digest algorithm written in WebAssembly Text
keywords: sha256 webassembly webassemblytext
---

## SHA256 Message Digest

Based on the excellent overview of the SHA256 algorithm available at [SHA256Algorithm](https://sha256algorithm.com/), I decided to see how small a binary I could create by implementing this functionality directly in WebAssemb;y Text.

The results are pretty encouraging - 951 byte!

### Known Performance Issue - But Not With WebAssembly

The performance of the JavaScript coding used to create the host environment is known to be slow. When calculating the digest of a large file (E.G. a 100Mb MP4 movie file), the JavaScript coding is **_really_** slow...

When testing against a big MP4 file, the program takes just over 9 seconds to complete; however, JavaScript needs 7.5 of those seconds to load the file into WASM shared memory...

Once loaded however, the `.wasm` binary calculates the SH256 digest in a time that's very similar to the built-in macos program `sha256sum`.