Skip to content
This repository was archived by the owner on Mar 18, 2022. It is now read-only.

Rework interface to mimic bcrypto #33

Merged
merged 9 commits into from
Feb 19, 2020
Merged

Conversation

wemeetagain
Copy link
Member

Resolve #29
This is a somewhat major update, in that the exported AS functions have been modified, and the exported JS/TS functions have been modified.

  • synchronous module loading
    • every new SHA256() is a new WebAssembly.Instance
    • static digest reuses a singleton WebAssembly.Instance, usable for most cases
  • overhauled AS interface
    • INPUT_LENGTH - the length of the default input buffer
    • input - pointer to the default input buffer
    • output - pointer to the default output buffer
    • init(): void; - reset/initialize
    • update(dataPtr: usize, dataLength: i32): void; - add data to hash, referenced by pointer and length
    • final(outputPtr: usize): void; - perform final hashing, write output to outputPtr
    • digest(length: i32): void - read data from the default input buffer with the specified length, write to the default output buffer
  • overhauled TS interface
    • see src/index.d.ts - interoperable with bcrypto

@wemeetagain wemeetagain requested review from MaxGraey and a team February 18, 2020 07:41
Copy link
Member

@mpetrunic mpetrunic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

forgot changelog.md

@wemeetagain wemeetagain force-pushed the cayman/sync-interface branch from 7c7585a to ffe1121 Compare February 18, 2020 08:18
@wemeetagain wemeetagain merged commit 198b424 into master Feb 19, 2020
@wemeetagain wemeetagain deleted the cayman/sync-interface branch February 19, 2020 19:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove async initialization
3 participants