crypto-keygen-suite
Version:
Key generation utilities for cryptographic operations. YES I RENAMED IT. SIX STATE PROTOCOL!!! See its folder for all <3
34 lines (30 loc) • 771 B
JavaScript
import yargs from 'yargs/yargs';
import { hideBin } from 'yargs/helpers';
import bcrypt from 'bcrypt';
// CLI setup
const argv = yargs(hideBin(process.argv))
.option('password', {
alias: 'p',
type: 'string',
demandOption: true,
describe: 'Password to hash with bcrypt',
})
.option('saltRounds', {
alias: 'r',
type: 'number',
default: 12,
describe: 'Number of salt rounds (default: 12)',
})
.help()
.alias('help', 'h')
.argv;
// Hashing logic
(async () => {
try {
const hash = await bcrypt.hash(argv.password, argv.saltRounds);
console.log(`Bcrypt Hash:\n${hash}`);
} catch (err) {
console.error(`❌ Error hashing password: ${err.message}`);
process.exit(1);
}
})();