Giter Site home page Giter Site logo

blake3's Introduction

Hex.pm Version

Blake3

Elixir bindings for the Rust Blake3 implementation. These bindings use :rustler to connect to the hashing functions.

Installation

The package can be installed by adding blake3 to your list of dependencies in mix.exs:

def deps do
  [
    {:blake3, "~> 1.0"}
  ]
end

run mix deps.get and mix deps.compile to pull and build the bindings

Configuration

There are feature options in the rust implementation that allow for additional SIMD instructions and multithreading. They can be set though environment variable or Mix.Config.

export BLAKE3_SIMD_MODE=neon
export BLAKE3_RAYON=true

or

config :blake3,
   simd_mode: :neon,
   rayon: :true
  • neon enables ARM NEON support
  • rayon enables Rayon-based multithreading

When changing configuration you will need to call mix deps.compile to enable the features.

Example Usage

> Blake3.hash("foobarbaz")
#<<192, 154, 254, 224, 201, 243, 97 ...

> Blake3.new() |> Blake3.update("foo") |> Blake3.update("bar") |> Blake3.update("baz") |> Blake3.finalize()
#<<192, 154, 254, 224, 201, 243, 97 ...

> Blake3.hash("boom") |> Base.encode16(case: :lower)
#"a74bb4d1d4e44d0a2981d131762f45db9a211313d8e9f2cd151b4e673a35a6c1"

Supported Elixir / Erlang / Rust

We follow Rustler itself, supporting latest three minor Elixir versions and major OTP versions. As for Rust itself, we only support stable.

Documentation can found at https://hexdocs.pm/blake3.

blake3's People

Contributors

thomas-jean avatar juulsme avatar kristoff3r avatar reinder1213 avatar madclaws avatar

Stargazers

Shir Levkowitz avatar Ievgen Pyrogov avatar Renê Schneider avatar Olexandr Maslo avatar  avatar  avatar  avatar heri16 avatar 'Ley Missailidis avatar EVOKE avatar Alessandro Usseglio Viretta avatar Lucas Allen avatar Jack O'Connor avatar Gregory Ostermayr avatar

Watchers

Neustradamus avatar  avatar

blake3's Issues

Enable support for extended output

Maybe this is already possible but this library should enable the extended output functionality of the base crate if it does not. If it does, if shown how I can update the docs.

You can do this in the base crate for example

// Extended output. OutputReader also implements Read and Seek.
let mut output = [0; 1000];
let mut output_reader = hasher.finalize_xof();
output_reader.fill(&mut output);
assert_eq!(hash1, output[..32]);

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.