mirror of
https://github.com/gchq/CyberChef.git
synced 2025-05-10 16:25:01 -04:00
Delete Bcrypt.mjs
This commit is contained in:
parent
6d138f345f
commit
8002f576ec
1 changed files with 0 additions and 56 deletions
|
@ -1,56 +0,0 @@
|
||||||
/**
|
|
||||||
* @author n1474335 [n1474335@gmail.com]
|
|
||||||
* @copyright Crown Copyright 2016
|
|
||||||
* @license Apache-2.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
import Operation from "../Operation.mjs";
|
|
||||||
import bcrypt from "bcryptjs";
|
|
||||||
import { isWorkerEnvironment } from "../Utils.mjs";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Bcrypt operation
|
|
||||||
*/
|
|
||||||
class Bcrypt extends Operation {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Bcrypt constructor
|
|
||||||
*/
|
|
||||||
constructor() {
|
|
||||||
super();
|
|
||||||
|
|
||||||
this.name = "Bcrypt";
|
|
||||||
this.module = "Crypto";
|
|
||||||
this.description = "bcrypt is a password hashing function designed by Niels Provos and David Mazi\xe8res, based on the Blowfish cipher, and presented at USENIX in 1999. Besides incorporating a salt to protect against rainbow table attacks, bcrypt is an adaptive function: over time, the iteration count (rounds) can be increased to make it slower, so it remains resistant to brute-force search attacks even with increasing computation power.<br><br>Enter the password in the input to generate its hash.";
|
|
||||||
this.infoURL = "https://wikipedia.org/wiki/Bcrypt";
|
|
||||||
this.inputType = "string";
|
|
||||||
this.outputType = "string";
|
|
||||||
this.args = [
|
|
||||||
{
|
|
||||||
"name": "Rounds",
|
|
||||||
"type": "number",
|
|
||||||
"value": 10
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} input
|
|
||||||
* @param {Object[]} args
|
|
||||||
* @returns {string}
|
|
||||||
*/
|
|
||||||
async run(input, args) {
|
|
||||||
const rounds = args[0];
|
|
||||||
const salt = await bcrypt.genSalt(rounds);
|
|
||||||
|
|
||||||
return await bcrypt.hash(input, salt, null, p => {
|
|
||||||
// Progress callback
|
|
||||||
if (isWorkerEnvironment())
|
|
||||||
self.sendStatusMessage(`Progress: ${(p * 100).toFixed(0)}%`);
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Bcrypt;
|
|
Loading…
Add table
Add a link
Reference in a new issue