Git Product home page Git Product logo

blst's Introduction

Build Status ubuntu-latest

blst (pronounced 'blast')

A BLS12-381 signature library written in C and assembly focused on performance and security.

Status

This library has not yet been audited. Use at your own risk.

Compliant with IETF draft specifications:

Support for x86_64 and ARM64

Support for Linux, Mac, and Windows

Explicit bindings for other languages

  • Go
  • Rust

Unless deemed appropriate to implement specific one, bindings for other languages will be provided using SWIG

  • so far tested Python

Formal verification will be rolling in to various components of the library over the coming months utilizing cryptol and coq

  • Field, curve and bulk signature operations

API

The blst API is defined in the C header bindings/blst.h. The API can be categorized as follows with some example operations:

  • Field (add, sub, mul, neg, inv, to/from Montgomery)
  • Curve (add, double, mul, to/from affine, group check)
  • Intermediate (hash to curve, pairing, serdes)
  • BLS12-381 signature core (sign, verify, aggregate)

Note there is also an auxiliary header file bindings/blst_aux.h that is used as a staging area for experimental interfaces that may or may not get promoted to blst.h.

Build

The build process is very simple and only requires a C complier. It's integrated into Go and Rust ecosystems, so that respective users would go about as they would with any other external module. Otherwise a binary library would have to be compiled.

C static library

A static library called libblst.a can be built in current working directory of user's choice.

Linux, Mac, and Windows (in MinGW or Cygwin environments)

/some/where/build.sh

Windows (Visual C)

\some\where\build.bat

Bindings

Bindings to other languages that implement minimal-signature-size and minimal-pubkey-size variants of the BLS signature specification are provided as follows:

Go src

TODO - basic details

For more details see the Go binding readme.

Rust src

blst is the Rust binding crate.

To use min-pk version:

use blst::min_pk::*;

To use min-sig version:

use blst::min_sig::*;

For more details see the Rust binding readme.

Others

TODO - example swig build/usage

General notes on implementation

The goal of the blst library is to provide a foundational component for applications and other libraries that require high performance and formally verified BLS12-381 operations. With that in mind some decisions are made to maximize the public good beyond BLS12-381. For example the field operations are optimized for general 384-bit usage as opposed to tuned specifically for the 381-bit BLS12-381 curve parameters. With the formal verification of these foundational components, we believe they can provide a reliable building block for other curves that would like high performance and an extra element of security.

Library deliberately abstains from dealing with memory management and multi-threading with rationale that these ultimately belong in language-specific bindings. Another responsibility that is left to application is random number generation. All this in the name of ultimate run-time neutrality, which makes integration into more stringent environments like Intel SGX or ARM TrustZone trivial.

The assembly code is wrapped into Perl scripts which output an assembly file based on the ABI and operating system. In the build directory there are pre-build assembly files for elf, mingw64, masm, and macosx. See build.sh or refresh.sh for usage. This method allows for simple reuse of optimized assembly across various platforms with minimal effort.

Serialization formatting is implemented according to Appendix A. BLS12-381 of the IETF spec that calls for using the ZCash definition.

Performance

Currently both the Go and Rust bindings provide benchmarks for a variety of signature related operations.

License

The blst library is licensed under the Apache License Version 2.0 software license.

blst's People

Stargazers

 avatar

Watchers

 avatar

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.