Giter VIP home page Giter VIP logo

blake2b's Introduction

Cryptography

Algorithms

Randomness

Applied modules

Noise Protocol

DHT

Key management

Ideas

WASM

Modules

Guides and tools

More modules!

Algorithms

Buffers

Validation

Data structures

Streams

State management

Application

D3

DOM / Frontend

Cordova

Native Modules

Talks and Workshops

Everything else

blake2b's People

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

Watchers

 avatar  avatar  avatar

blake2b's Issues

Can this be used client-side?

Can this be used on the client-side (ie: firefox) or is there any client-side library for blake2 you can suggest?

Thanks!

Type definitions for TypeScript

Hi guys! How do you feel about TypeScript? There seems to be no types for your package. Would you mind including type definitions in the npm package? I could work on it.

Expected hex length

Hey ๐Ÿ‘‹

Is it expected that the returned hex length is double the outLength passed to blake2b()?

I would have assumed if I ran the following, I would get a hex string with a length of 32 but it returns a string with a length of 64:

const input = Buffer.from(value);
const hashedValue = blake2b(32)
  .update(input)
  .digest('hex');

return hashedValue;

Hashes strings wrong

Hi. I noticed hashing strings is incorrect. It hashes the zeroed input buffer instead:

blake2b(16).update('a').digest('hex')
// '7025e075d5e2f6cde3cc051a31f07660'

blake2b(16).update('b').digest('hex')
// '7025e075d5e2f6cde3cc051a31f07660'

blake2b(16).update(new Uint8Array(1)).digest('hex')
// '7025e075d5e2f6cde3cc051a31f07660'

Based on hash.update and blake2bUpdate, the effect seems to be like:

const arr = new Uint8Array(1)
arr[0] = 'a'
// that does nothing:
// arr[0] === 0
blake2b(16).update(arr).digest('hex')
// '7025e075d5e2f6cde3cc051a31f07660'

Related to this issue is hashing empty strings:

blake2b(16).update('').digest('hex')
// Error: input must be TypedArray or Buffer

Maybe this assert was intended for all strings, and not just the empty one? It could also use TextEncoder and Buffer.from for you.

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.