Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

poseidon-bls12381

Package Overview
Dependencies
Maintainers
0
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

poseidon-bls12381

Poseidon implementation for the BLS12-381 elliptic curve

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

Poseidon for BLS12-381

Implementation of the ZK-friendly Poseidon hash in TypeScript. The hash is prepared for the elliptic curve BLS12-381.

This implementation is based on the original Poseidon paper and the official Poseidon implementation. The updated paper recommends that the parameters are calculated with the script code/generate_params_poseidon.sage. The parameters are prepared for the curve BLS12-381 and a security level of 128 bits using the recommended script.

✏️ Use

Add to your javascript project through npm

$ npm install poseidon-bls12381

Poseidon hash is designed for ZK circuits and its parameters are a group of field elements of its elliptic curve. That's why, you'll need to know beforehand how many parameters you want to use in your hash function.

This repository provides function from 1 to 16 parameters. This is an example of call with 2 parameters:

import { poseidon2 } from "poseidon-bls12381";

const hash = poseidon2([BigInt("0x01"), BigInt("0x02")]);

🛠️ Build

This project provides the scripts for building and testing:

# Build

$ npm install
$ npm run build

# Test

$ npm run test

📃 License

This project is licensed under the MIT License - see the LICENSE file for details.

Keywords

FAQs

Package last updated on 21 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc