npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

secretfracture

v1.0.11

Published

A simple utility for breaking an ASCII string into cryptographic shares using Shamir's secret sharing.

Downloads

1,910

Readme

Description

SecretFracture is a threshold secret sharing scheme. This is a cryptographic protocol that will split an ASCII plaintext message into a set of n shares that can be recovered by providing an arbitrary set of k shares. This technique was invented by Israeli cryptographer Adi Shamir; you may read more about this simple and elegant system in his seminal paper How to Share a Secret.

WARNING: This project should not be used in production.

I have only minimal experience in writing cryptographic code and this package is yet to be reviewed by cryptanalysts and security researchers.

Installing and Importing

Install

Install the package in your dependencies by running:

npm i secretfracture --save

Import

Import the core functions into your file by typing:

const {share, recover} = require('secretfracture');

Usage:

Again, DON'T. At least not for anything that could potentially be compromised.

Example of a 3/5 sharing scheme

const {share, recover} = require('secretfracture');

// split the secret into 5 shares, requiring any 3 to recover
const [indices, shares] = share(5, 3, "th15_15_@_53cr37");

console.log(indices, shares);

// recover the secret from the shares
const secret = recover(indices, shares);

console.log(secret);

The output will be something similar to:

[ 1, 2, 3, 4, 5 ] [
  '61872a3bd9080624c46c4f78a7bbcbza',
  '7b0868bd1712af33dda401bdcc263d94',
  'c2edebba1b4f2e8c8b064c01d2b58bf5',
  '3533b232e5bf852ecf942f46b966b421',
  'd6ddbe267361b31aa84cab8b813ab81a'
]
th15_15_@_53cr37

Encoding system

Secret Fracture works by splitting every byte of the ascii plaintext into its own set of shares. The hexadecimal you see output as shares is slightly different from regular hexadecimal. Normally, we can only store bytes with values ranging from 0-255. Since each byte in our secret sharing scheme occurs within a finite field of size 257, we have two values that cannot be represented in hexadecimal. Subsequently, I devised a small convention in which the values 256 and 257 are represented by the pseudo-hex bytes za and zb, respectively. Aside from these two values, the rest of the output shares are interpretable as standard hexadecimal.