keygentoolshed
Version:
Key generation utilities for cryptographic operations. QUANTUM ENCRYPTION FOLDER UPDATE!!! See its folder for all <3
30 lines (27 loc) • 891 B
JavaScript
import argon2 from 'argon2';
import { program } from 'commander';
async function hashPassword(password) {
try {
const hash = await argon2.hash(password, {
memory: 2 * 1024, // 2 MB
timeCost: 1,
parallelism: 1,
});
return hash;
} catch (err) {
console.error('Error hashing password:', err);
}
}
program
.version('1.0.0')
.description('Hash a password using Argon2')
.option('-p, --password <password>', 'Password to hash')
.action(async (options) => {
if (options.password) {
const hashedPassword = await hashPassword(options.password);
console.log('Hashed Password:', hashedPassword);
} else {
console.log('Please provide a password using the --password option.');
}
});
program.parse(process.argv);