UNPKG

keygentoolshed

Version:

Key generation utilities for cryptographic operations. QUANTUM ENCRYPTION FOLDER UPDATE!!! See its folder for all <3

33 lines (30 loc) 978 B
import shamir from 'shamir-secret-sharing'; import yargs from 'yargs/yargs'; import { hideBin } from 'yargs/helpers'; const argv = yargs(hideBin(process.argv)) .option('secret', { alias: 's', type: 'string', default: 'default_secret', description: 'The secret to split' }) .option('splitin', { alias: 'si', type: 'number', default: 5, description: 'Number of parts to split the secret into' }) .option('threshold', { type: 'number', default: 3, description: 'Minimum shares required to reconstruct the secret' }) .argv; function splitSecret(secret, nShares, threshold) { const shares = shamir.split(secret, nShares, threshold); console.log("Generated Shares:"); shares.forEach((share, index) => { console.log(`Share ${index + 1}: ${share}`); }); } splitSecret(argv.secret, argv.splitin, argv.threshold);