Skip to content
Armen Michaeli edited this page Mar 9, 2022 · 3 revisions

Overview

This repository tracks development of a WebAssembly (WASM) module implementing core components for computing MD5 digests. Its defining characteristics are:

  • Offer a set of routines which may be leveraged in a wide number of settings and applications -- instead of providing a single routine which could be an impediment to use with some types of data or framework

  • Intended to retain the "written by hand" quality as much as possible -- using the [canonical] WAT text format -- as part of assessing optimization avenues and to retain ability to easily introspect the implementation (a compiler may or may not generate "readable" WASM/WAT code); that said, multiple implementations are tracked by the repository and possibilities of generated WAT code (or WASM code generated by a compiler) are not hereby excluded

Usage

Since the repository stores the source code, the actual loadable WASM module (MD5.wasm) must be built. That is the runtime component loaded by a WebAssembly platform. No concrete building script is offered by this repository, but this document intends to offer some useful pointers:

  • The module has been tested to build from the MD5.wat file using the wat2wasm (v. 1.0.26) program offered by and distributed with the WebAssembly Binary Toolkit (WABT)
  • The M4 preprocessor (v. 1.4.18) was used for source code in the M4 format, like the MD5.wat.m4 -- these files are expected to be pre-processed; the MD5.wat.m4, when pre-processed, generates an MD5.wat file intended to build MD5.wasm

Building using GNU make

In light of the above, assuming you have WABT and M4 installed, the following makefile can be used with GNU's make (and probably other make implementations), to build the module in one step (make MD5.wasm or just make with the directory containing the "makefile" file below):

%.wasm: %.wat
	wat2wasm $< -o $@

%.wat: %.wat.m4
	m4 $< > $@

Releases containing the built module may be made available through the "Releases" feature, eventually, for convenience.

Dependents

There is the MD5.js module that uses this module to facilitate MD5 computation with e.g. a Web browser.

Clone this wiki locally