dchest / blake2s-js Goto Github PK
View Code? Open in Web Editor NEWBLAKE2s cryptographic hash function in JavaScript
Home Page: https://dchest.github.io/blake2s-js/
License: The Unlicense
BLAKE2s cryptographic hash function in JavaScript
Home Page: https://dchest.github.io/blake2s-js/
License: The Unlicense
I noticed you implemented blake2xs in Go, any plans for a javascript implementation to compliment your fantastic javascript blake2s work?
Updating incrementally for short inputs produces inconsistent results:
var b = new BLAKE2s(32);
var msg = 'abc';
var msgArray = b.stringToUtf8Array(msg);
b.update(msgArray);
console.log(b.hexDigest()); // 508c5e8c327c14e2e1a72ba34eeb452f37458b209ed63a294d999b4c86675982
var b = new BLAKE2s(32);
var msg = 'abc';
var msgArray = b.stringToUtf8Array(msg);
b.update(msgArray, 0, 1);
b.update(msgArray, 1, 2);
console.log(b.hexDigest()); // 19c3ebeed2ee90063cb5a8a4dd700ed7e5852dfc6108c84fac85888682a18f0e
Suggest fix - line 1283: change this.nx = length to this.nx += length;
I tried adding this but it looks like I was unsuccessful as the output does not match b2sum even though your implementation of BLAKE2s does. Anyway, here's my attempt: https://github.com/neheb/blake2s-js/commit/deaa1e7704b8902e30ddd18798bd4fa49223a2bc
Any plans to support it?
Hi, i'm not understanding why i can't use it in NodeJS (an express app). The module gets exported as a promise? VSCode lets me jump to the .d.ts file...
// UnhandledPromiseRejectionWarning: Error: Not supported
var BLAKE2s = import('blake2s-js');
var gen = {
hash: function(msg, key) {
var hash;
// TypeError: BLAKE2s is not a constructor
hash = new BLAKE2s(32, key);
hash.update(msg);
return hash.digest();
}
};
module.exports = gen;
Solution: use require()
not import()
.
Leaving open because i still need to do some with TextEncoder
/TextDecoder
and/or Uint8Array
...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.