New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

poseidon-lite

Package Overview
Dependencies
Maintainers
0
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

poseidon-lite

Lightweight poseidon hash

  • 0.3.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
0
Weekly downloads
 
Created
Source

poseidon-lite CircleCI

A 0 dependence poseidon implementation over alt_bn128 (aka BN254).

Warning

This implementation uses the native javascript BigInt which is vulnerable to timing attacks.

This implementation has not been audited.

Use

npm i poseidon-lite

import { poseidon2 } from 'poseidon-lite'
// pass an array to the function
// array length must be equal to the function name
// returns a BigInt
const hash = poseidon2(['0x01', '0x02'])

Individual import

import { poseidon2 } from 'poseidon-lite/poseidon2'
const hash = poseidon2(['0x01', '0x02'])

Get state elements

More state elements can be retrieved by passing an optional second argument. Useful for e.g. sponge based encryption. The maximum number of elements that can be retrieved is input.length + 1.

import { poseidon2 } from 'poseidon-lite'

// retrieve 3 state elements instead of the default 1
const elements = poseidon2(['0x01', '0x02'], 3)
// elements is now a BigInt[3]

Build

npm i
npm run build
npm test

License

Versions >=0.2.0 are MIT

Versions <0.2.0 are GPL-3.0

Keywords

FAQs

Package last updated on 23 Aug 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