https://github.com/danieloneill/quickjs-hash
Simple base64, md5, and sha256 module for QuickJS using OpenSSL 3.x
https://github.com/danieloneill/quickjs-hash
Last synced: over 1 year ago
JSON representation
Simple base64, md5, and sha256 module for QuickJS using OpenSSL 3.x
- Host: GitHub
- URL: https://github.com/danieloneill/quickjs-hash
- Owner: danieloneill
- License: mit
- Created: 2022-09-13T20:59:47.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-09-13T21:08:48.000Z (almost 4 years ago)
- Last Synced: 2025-02-12T10:18:50.601Z (over 1 year ago)
- Language: C
- Size: 3.91 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# quickjs-hash
Simple base64 encoding and md5/sha256 hashing module for QuickJS using OpenSSL 3.x
Building requires editing the Makefile and pointing it to your quickjs-2017-03-27 directory, and having OpenSSL 3.x (and headers) installed and findable via pkg-config.
See **example.js** for usage.
Consists of only 4 methods:
* toBase64
* fromBase64
* md5sum
* sha256sum
Each method accepts one parameter.
*toBase64*, *md5sum*, and *sha256sum* expect a Uint8Array as the only parameter.
*toBase64* returns a string containing the Base64 encoded data.
*md5sum* and *sha256sum* return a hex-encoded string representing the calculated hash of the contents passed.
*fromBase64* expects a string as the only parameter and returns a Uint8Array (actually, a Uint32Array but whatever.)
Feature requests and PRs are welcome. Also check out my [low-level sockets module](https://github.com/danieloneill/quickjs-net).