Giter Site home page Giter Site logo

connor4312 / blake3 Goto Github PK

View Code? Open in Web Editor NEW
177.0 6.0 18.0 799 KB

BLAKE3 hashing for JavaScript: native Node bindings (where available) and WebAssembly

Home Page: https://connor4312.github.io/blake3/index.html

License: MIT License

JavaScript 0.82% TypeScript 74.87% Makefile 3.21% Dockerfile 6.08% Python 1.02% C++ 11.87% C 2.13%
blake3 node-addon webassembly neon rust typescript hash

blake3's People

Contributors

connor4312 avatar dependabot[bot] avatar oconnor663 avatar weihanglo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

blake3's Issues

Can't install any of the blake3 packages via npm

If I try to install the blake3 npm package with npm i blake3, I just get this error message:

npm ERR! code ETARGET
npm ERR! notarget No matching version found for [email protected].
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

If I instead try npm i blake3-wasm, I instead get:

npm ERR! code ETARGET
npm ERR! notarget No matching version found for @c4312/[email protected].
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

I don't know why it's trying to install version 2.1.7 of the dependencies, when as far as I can tell the latest versions of all of these packages on npm is 3.0.0, but in any case it doesn't work and I seemingly have no way to be able to use these at the moment.

Is there some way to actually install these?

memory unsafety?

#[wasm_bindgen]
pub fn hash(data: &[u8]) -> Uint8Array {
  let hash = blake3::hash(data);

  unsafe {
    Uint8Array::view(hash.as_bytes())
  }
}

I don't know anything about WASM, but this code (and the same code in digest) looks like it's creating a dangling pointer. The as_bytes method returns a reference to the contents of the hash object, which then immediately goes out of scope when the function returns. I wonder if a test case like this would fail:

a = hash("abc")
b = hash("xyz")
assert a == hash("abc") // Is `a` still valid? Or does it point to overwritten memory?

Performance tweaks

I haven't done a ton of work passing binary data between Node<->wasm. Once APIs are more fully fledged, I should do a pass on that to make sure we're handling things as efficiently as possible.

Possibly incorrect wording in `hash` documentation?

The API docs for the hash(data, options) function say:

By default, it creates a hash with the first 32 bytes of data, but this is configurable.

This seems strange. Since BLAKE3 is an extendable output function it seems that it should instead say

By default, it creates a 32 byte long hash of the data, but this is configurable.

at least that's what the function probably should be doing, right? Unless I'm missing something, we want to compute the hash based on the whole data content, but the size of the hash might be variable (which is why it being XOF is good).

Error trying to import bindings in Dockerfile

Hi
I'm using this library in my project and it works well. However, when I try to build a docker image from my Dockerfile I receive the following error:

API version for [email protected] linux not explicitly built, falling back to latest. If this does not work, open an issue at https://github.com/connor4312/blake3/issues/new
Retrieving native BLAKE3 bindings for Node v12 on linux...
Error trying to import bindings: Error: Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by /usr/src/app/node_modules/blake3/dist/native.node)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1188:18)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14)
at Module.require (internal/modules/cjs/loader.js:1026:19)
at require (internal/modules/cjs/helpers.js:72:18)
at /usr/src/app/node_modules/blake3/dist/build/install.js:51:13
at Generator.next ()
at fulfilled (/usr/src/app/node_modules/blake3/dist/build/install.js:5:58)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
BLAKE3 will use slower WebAssembly bindings when required in Node.js

My Dockerfile is:

FROM mhart/alpine-node:12.18.2 AS appserver
WORKDIR /usr/src/app
RUN npm install -g typescript
COPY package*.json tsconfig.json ormconfig.js  ./
COPY ./src ./src
RUN npm ci --quiet && npm run build 

FROM mhart/alpine-node:12.18.2 as production
WORKDIR /usr/src/prod
COPY --from=appserver /usr/src/app/package.json ./
COPY --from=appserver /usr/src/app/ormconfig.js ./
COPY --from=appserver /usr/src/app/lib ./lib
COPY --from=appserver /usr/src/app/node_modules ./node_modules
EXPOSE 4000
CMD ["node", "--max_old_space_size=4096", "--max_semi_space_size=256", "./lib/index.js"]

I tried installing the required packages like so:

FROM mhart/alpine-node:12.18.2 AS appserver
LABEL maintainer="[email protected]"
WORKDIR /usr/src/app
RUN apk add --no-cache \ 
    libc6-compat \
    gcompat && \
    npm install -g typescript
COPY package*.json tsconfig.json ormconfig.js  ./
COPY ./src ./src
RUN npm ci --quiet && npm run build

Although the initial error disappears, now it fails with another error:

API version for [email protected] linux not explicitly built, falling back to latest. If this does not work, open an issue at https://github.com/connor4312/blake3/issues/new
Retrieving native BLAKE3 bindings for Node v12 on linux...
BLAKE3 will use slower WebAssembly bindings when required in Node.js
Error trying to import bindings: Error: Error relocating /usr/src/app/node_modules/blake3/dist/native.node: _ZN2v816FunctionTemplate3NewEPNS_7IsolateEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEENS_5LocalIS4_EENSA_INS_9SignatureEEEiNS_19ConstructorBehaviorENS_14SideEffectTypeEPKNS_9CFunctionE: symbol not found
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1188:18)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14)
at Module.require (internal/modules/cjs/loader.js:1026:19)
at require (internal/modules/cjs/helpers.js:72:18)
at /usr/src/app/node_modules/blake3/dist/build/install.js:51:13
at Generator.next ()
at fulfilled (/usr/src/app/node_modules/blake3/dist/build/install.js:5:58)
at processTicksAndRejections (internal/process/task_queues.js:97:5)

Is there any workaround for this or maybe there is an image that works out of the box?

Thanks,
Nikita

Module did not self-register

I am trying out blake3 2.1.7 but am getting the following error:

node:events:346
      throw er; // Unhandled 'error' event
      ^
Error: Module did not self-register: '/home/ubuntu/ironfish-src2/node_modules/blake3/dist/native.node'.
    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1151:18)
    at Module.load (node:internal/modules/cjs/loader:972:32)
    at Function.Module._load (node:internal/modules/cjs/loader:813:14)
    at Module.require (node:internal/modules/cjs/loader:996:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at Object.<anonymous> (/home/ubuntu/ironfish-src2/node_modules/blake3/dist/node-native/native.js:3:16)
    at Module._compile (node:internal/modules/cjs/loader:1092:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
    at Module.load (node:internal/modules/cjs/loader:972:32)
    at Function.Module._load (node:internal/modules/cjs/loader:813:14)
Emitted 'error' event on process instance at:
    at emitUnhandledRejectionOrErr (node:internal/event_target:639:11)
    at MessagePort.[nodejs.internal.kHybridDispatch] (node:internal/event_target:464:9)
    at MessagePort.exports.emitMessage (node:internal/per_context/messageport:23:28) {
  code: 'ERR_DLOPEN_FAILED'
}

I have tried using Node 16 with ubuntu-latest-93.node and Node 15 with ubuntu-latest-88.node but both give the same error.

Any ideas what causes this error?

README incorrect for streaming version?

The README on npm shows this example

// Update incrementally (Node and Browsers):
const hash = createHash();
stream.on('data', d => hash.update(hash));
stream.on('error', err => {
  // hashes use unmanaged memory in WebAssembly, always free them if you don't digest()!
  hash.dispose();
  throw err;
});
stream.on('end', () => finishedHash(hash.digest()));

I think the line stream.on('data', d => hash.update(hash));
should probably read stream.on('data', d => hash.update(d));

This may be something obvious, but with cryptographic algorithms I feel it is good to have clear examples so people don't shoot themselves in the foot.

Trying to use Blake3 in React with TS. Build Warnings and Runtime Errors

Runtime

index.tsx

import('blake3/browser').then(blake3 => {
  console.log(blake3.hash('foo')); // => Uint8Array
});

ReactDOM.render(
  ...
);
[Error] Unhandled Promise Rejection: TypeError: undefined is not an object (evaluating 'wasm2.memory.buffer')
	getUint8Memory0 (blake3_browser.js:38)
	hash2 (blake3_browser.js:60)
	hash3 (blake3_browser.js:240)
	(anonymous function) (index.tsx:12)
	promiseReactionJob

As posted in an issue elsewhere, they recommended changing the .d.ts names, but they are already present in this version.
rustwasm/wasm-bindgen#2200
Screen Shot 2022-04-28 at 1 13 50 PM

Build Warnings

'memory' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'memory' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'__wbindgen_malloc' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'__wbindgen_malloc' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'hash' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'__wbindgen_free' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'create_hasher' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'__wbindgen_malloc' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'create_keyed' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'__wbindgen_malloc' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'__wbindgen_realloc' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'create_derive' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'__wbg_blake3hash_free' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'blake3hash_reader' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'__wbindgen_malloc' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'blake3hash_update' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'__wbindgen_malloc' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'blake3hash_digest' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'__wbindgen_free' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'__wbg_hashreader_free' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'__wbindgen_malloc' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'hashreader_fill' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'__wbindgen_free' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'hashreader_set_position' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'

npm install [email protected] — >> npm ERR! code ETARGET !!! >> npm ERR! notarget No matching version found for [email protected].

What's wrong?

INPUT:

npm install [email protected]

OUTPUT:


npm ERR! code ETARGET
npm ERR! notarget No matching version found for [email protected].
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

npm ERR! A complete log of this run can be found in: /Users/.../.npm/_logs/2023-06-07T08_18_27_622Z-debug-0.log


What is this happening?

Online demo gives incorrect value

Hey! Thank you for the nice library!

The online demo at https://connor4312.github.io/blake3/index.html gives incorrect answer for the following text:
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 (utf-8)

Gives back:
8bee3200baa9f3a1acd279f049f914f1010e730555ff15109bd59cdd73895e239

Instead of:
8bee3200baa9f3a1acd279f049f914f110e730555ff15109bd59cdd73895e239

It's only broken on the website. The blake3 npm library gives back the correct result when running it from node.

Node 14 is not supported

I hope that I'm barking up the right tree :)

$ node --version
v14.2.0
$ npm install

> [email protected] install /.../node_modules/blake3
> node -e "try{require('./dist/build/install')}catch(e){}"

API version for node linux not explicitly built, falling back to latest. If this does not work, open an issue at https://github.com/connor4312/blake3/issues/new
Retrieving native BLAKE3 bindings for Node v14 on linux...
BLAKE3 bindings retrieved

And when i run my tests that require('blake3')

$ node test.js
internal/modules/cjs/loader.js:1226
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: /.../node_modules/blake3/dist/native.node: undefined symbol: _ZN2v816FunctionTemplate3NewEPNS_7IsolateEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEENS_5LocalIS4_EENSA_INS_9SignatureEEEiNS_19ConstructorBehaviorENS_14SideEffectTypeE
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1226:18)
    at Module.load (internal/modules/cjs/loader.js:1040:32)
    at Function.Module._load (internal/modules/cjs/loader.js:929:14)
    at Module.require (internal/modules/cjs/loader.js:1080:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/.../node_modules/blake3/dist/node-native/native.js:3:16)
    at Module._compile (internal/modules/cjs/loader.js:1176:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1196:10)
    at Module.load (internal/modules/cjs/loader.js:1040:32)
    at Function.Module._load (internal/modules/cjs/loader.js:929:14)

Is there a way to force building the node bindings?

Parcel compatibility

My code (inside an ES6 module)
import load from 'blake3/browser-async'

Parcel warnings
Could not load source file "../../ts/browser/wasm.ts" in source map of "node_modules/blake3/esm/browser/wasm.js". ⚠️ Could not load source file "../../ts/browser/index.ts" in source map of "node_modules/blake3/esm/browser/index.js". ⚠️ Could not load source file "../../ts/browser/index.ts" in source map of "node_modules/blake3/esm/browser/index.js". ⚠️ Could not load source file "../../ts/browser/wasm.ts" in source map of "node_modules/blake3/esm/browser/wasm.js". ⚠️ Could not load source file "../../ts/base/index.ts" in source map of "node_modules/blake3/esm/base/index.js". ⚠️ Could not load source file "../../ts/browser/hash-instance.ts" in source map of "node_modules/blake3/esm/browser/hash-instance.js". ⚠️ Could not load source file "../../ts/browser/hash-fn.ts" in source map of "node_modules/blake3/esm/browser/hash-fn.js". ⚠️ Could not load source file "../../ts/base/hash-instance.ts" in source map of "node_modules/blake3/esm/base/hash-instance.js". ⚠️ Could not load source file "../../ts/base/hash-reader.ts" in source map of "node_modules/blake3/esm/base/hash-reader.js". ⚠️ Could not load source file "../../ts/base/hash-fn.ts" in source map of "node_modules/blake3/esm/base/hash-fn.js". ⚠️ Could not load source file "../../ts/base/disposable.ts" in source map of "node_modules/blake3/esm/base/disposable.js". ⚠️ Could not load source file "../../ts/browser/encoding.ts" in source map of "node_modules/blake3/esm/browser/encoding.js". ⚠️ Could not load source file "../../ts/browser/hash-reader.ts" in source map of "node_modules/blake3/esm/browser/hash-reader.js". ⚠️ Could not load source file "../../ts/browser/hash.ts" in source map of "node_modules/blake3/esm/browser/hash.js". ⚠️ Could not load source file "../../ts/browser/hash-instance.ts" in source map of "node_modules/blake3/esm/browser/hash-instance.js". ⚠️ Could not load source file "../../ts/base/index.ts" in source map of "node_modules/blake3/esm/base/index.js". ⚠️ Could not load source file "../../ts/browser/hash-fn.ts" in source map of "node_modules/blake3/esm/browser/hash-fn.js". ⚠️ Could not load source file "../../ts/base/hash-fn.ts" in source map of "node_modules/blake3/esm/base/hash-fn.js". ⚠️ Could not load source file "../../ts/base/hash-reader.ts" in source map of "node_modules/blake3/esm/base/hash-reader.js". ⚠️ Could not load source file "../../ts/browser/encoding.ts" in source map of "node_modules/blake3/esm/browser/encoding.js". ⚠️ Could not load source file "../../ts/browser/hash-reader.ts" in source map of "node_modules/blake3/esm/browser/hash-reader.js". ⚠️ Could not load source file "../../ts/browser/hash.ts" in source map of "node_modules/blake3/esm/browser/hash.js". ⚠️ Could not load source file "../../ts/base/hash-instance.ts" in source map of "node_modules/blake3/esm/base/hash-instance.js".

Browser console
Uncaught SyntaxError: Cannot use 'import.meta' outside a module
Coming from app. ... .js file generated by Parcel
function init(module) { if (typeof module === 'undefined') { module = import.meta.url.replace(/\.js$/, '_bg.wasm'); } ...

I am a bit of a JS noob, so any help would be greatly appreciated.

When running under Meteor: archived threads in combination with wasm not supported

We're hoping to use BLAKE3 for content hashing due to its awesome speed. The server is in Meteor and we're getting an error that appears to be very low level.

Reproduction:

# install meteor
# I wrote this reproduction using 1.9, but I believe my colleague has tried
# beta versions.
nvm use 12
meteor create --react simple-todos-2
cd simple-todos-2
meteor npm install blake3
meteor
^C
# apologies for being old school. ed isn't usable, but it is scriptable!
ed server/main.js
%p
/function
-1
i
var blake3 = require('blake3');
.
%p
wq
meteor
# observe crash:
W20200303-14:22:16.239(-5)? (STDERR)
W20200303-14:22:16.288(-5)? (STDERR)
W20200303-14:22:16.288(-5)? (STDERR) #
W20200303-14:22:16.288(-5)? (STDERR) # Fatal error in , line 0
W20200303-14:22:16.289(-5)? (STDERR) # archived threads in combination with wasm not supported
W20200303-14:22:16.289(-5)? (STDERR) #
W20200303-14:22:16.289(-5)? (STDERR) #
W20200303-14:22:16.290(-5)? (STDERR) #
W20200303-14:22:16.290(-5)? (STDERR) #FailureMessage Object: 0x102e79240

This issuse seems to be related: nodejs/node#29767 .

It suggests --no-wasm-code-gc, but that is already in use:

ps aux | grep no-wasm-code-gc
sk               23007  21.5  3.4 17398548 281708 s011  S+    2:27PM   0:15.17 /Users/sk/.meteor/packages/meteor-tool/.1.9.0.z44zal++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/dev_bundle/bin/node --max-old-space-size=4096 --no-wasm-code-gc /Users/sk/.meteor/packages/meteor-tool/.1.9.0.z44zal++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/tools/index.js

The error message appears to come from here: https://chromium.googlesource.com/v8/v8/+/master/src/wasm/wasm-engine.cc#106

which contains this comment:

Archived threads are rarely used, and not combined with Wasm at the
moment. Implement this and test it properly once we have a use case for
that.

Problem during using npm i

Screenshot from 2022-02-07 16-59-12
We Have package-lock.json file which includes many packages. During Npm i , we are getting this problem.

API version for [email protected] linux not explicitly built, falling back to latest. If this does not work, open an issue at https://github.com/connor4312/blake3/issues/new
Retrieving native BLAKE3 bindings for Node v12 on linux...

npm i was stooped in this line Retrieving native BLAKE3 bindings for Node v12 on linux... So we can not install packages because we should exit from npm i.

Please let me know, why this is happening?
We can not install packageg and buil our projecy. We are blocked.

Please help. It is urgent need.

Node version is : v12.22.7

Thanks

readme.md is incomplete for non webpack browser

Hello,

I'm using vite so I must use the import load from 'blake3/browser-async';

But load take an arguments and the readme does not say what it should be. (It does not event mention that it require some parameter.)

What should go there ?

Module not found: Error: Can't resolve './node.js' in '<project-path>/node_modules/blake3/esm'

When I try to bundle blake3 with webpack I get this error:

ERROR in ./node_modules/blake3/esm/index.js 13:0-26
Module not found: Error: Can't resolve './node.js' in '<project-path>/node_modules/blake3/esm'
resolve './node.js' in '<project-path>/node_modules/blake3/esm'
  using description file: <project-path>/node_modules/blake3/package.json (relative path: ./esm)
    using description file: <project-path>/node_modules/blake3/package.json (relative path: ./esm/node.js)
      no extension
        <project-path>/node_modules/blake3/esm/node.js doesn't exist
      .tsx
        <project-path>/node_modules/blake3/esm/node.js.tsx doesn't exist
      .ts
        <project-path>/node_modules/blake3/esm/node.js.ts doesn't exist
      .js
        <project-path>/node_modules/blake3/esm/node.js.js doesn't exist
      as directory
        <project-path>/node_modules/blake3/esm/node.js doesn't exist

Also in the node_modules/blake3/package.json I saw this:

{
    "module": "./esm/index",
}

But If I change the node_modules/blake3/package.json into this

{
    "module": "./esm/node/index",
}

It works.
Is that a bug or the problem is with my local environment? (NB: blake3 version: "2.1.7")

nodejs importing wasm

I noticed in dist/index.js it __export(require("./node-native"));
If I wanted wasm, I can __export(require("./node"));
What is the proper way to do this?

I would like to use the wasm version since the performance is much higher than neon for small inputs (16 bytes)

Browser can't access WASM

I'm trying to use blake3 in an Angular project. The instructions in the README file for browser use seem incorrect.

Importing blake3/browser-async fails to find the module. Using the import blake3/browser.mjs compiles but then the browser produces this error:

Security Error: Content at http://localhost:4200/shop may not load or link to file:///path/to/my/project/node_modules/blake3-wasm/esm/wasm/blake3.wasm.

It seems to not be packaging things correctly.

Browser API depends on webpack

I tried importing it using const blake3 = await import('https://unpkg.com/[email protected]/browser.js?module') and it failed with Uncaught ReferenceError: exports is not defined. Seems the code is a mix of ES modules and CommonJS modules.

I also tried importing it using Parcel and it failed with Imports argument must be present and must be an object. Checking this issue seems Parcel's WASM importing behavior is different from webpack's. Then, after, I tried importing it using webpack, it worked.

Is there a way to make it not dependent on webpack behavior?

Access the Merkle tree

BLAKE3 is internally a Merkle tree, which means that individual hashes are computed from the binary chunks (the Merkle leaf node) which are then combined to eventually get the root hash of the tree - the result of the whole hash function.

Would it be possible to access the hash list at any individual depth of the Merkle tree, and "store it for later"? Let's say the file is 4 GiB in size, so we have 4194304 individual hashes. I want to reduce this a few times (say thrice to 524288), intercept the current state of the computation (store the 524288 hashes at this level in the tree) as a binary blob, and then use this hash list in a completely new context to compute the final hash, which would be identical to the hash if computed without the interception in the middle.

Variable length output

BLAKE3 hashes can output up to 2^64-1 bytes. By default we return 32 bytes, but we should make it configurable, or readable

Is this actively maintained?

Hi guys, I'm looking into using this lib in one of my critical libraries. I noticed some PRs and issues are here for some time and the last commit was half a year ago. Is this maintained or should I continue using BLAKE2?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.