Compare commits

...
2 Commits
Author SHA1 Message Date
n1474335 392652ed8e 6.2.0 2017-09-27 15:33:37 +00:00
n1474335 7557e1e9e5 Added Snefru hashing operation 2017-09-27 15:33:14 +00:00
7 changed files with 117 additions and 6 deletions
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "cyberchef",
"version": "6.1.0",
"version": "6.2.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -1755,9 +1755,9 @@
}
},
"crypto-api": {
"version": "0.7.4",
"resolved": "https://registry.npmjs.org/crypto-api/-/crypto-api-0.7.4.tgz",
"integrity": "sha1-wuiM1WOWxJ0A75uA40lGUKdIKoE="
"version": "0.7.5",
"resolved": "https://registry.npmjs.org/crypto-api/-/crypto-api-0.7.5.tgz",
"integrity": "sha1-TCc3K8s85mnSKNV7NZG8YRjFKdU="
},
"crypto-browserify": {
"version": "3.11.1",
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "cyberchef",
"version": "6.1.0",
"version": "6.2.0",
"description": "The Cyber Swiss Army Knife for encryption, encoding, compression and data analysis.",
"author": "n1474335 <n1474335@gmail.com>",
"homepage": "https://gchq.github.io/CyberChef",
@@ -71,7 +71,7 @@
"bootstrap": "^3.3.7",
"bootstrap-colorpicker": "^2.5.1",
"bootstrap-switch": "^3.3.4",
"crypto-api": "^0.7.4",
"crypto-api": "^0.7.5",
"crypto-js": "^3.1.9-1",
"diff": "^3.3.1",
"escodegen": "^1.9.0",
+1
View File
@@ -257,6 +257,7 @@ const Categories = [
"RIPEMD",
"HAS-160",
"Whirlpool",
"Snefru",
"HMAC",
"Fletcher-8 Checksum",
"Fletcher-16 Checksum",
+18
View File
@@ -3011,6 +3011,24 @@ const OperationConfig = {
}
]
},
"Snefru": {
module: "Hashing",
description: "Snefru is a cryptographic hash function invented by Ralph Merkle in 1990 while working at Xerox PARC. The function supports 128-bit and 256-bit output. It was named after the Egyptian Pharaoh Sneferu, continuing the tradition of the Khufu and Khafre block ciphers.<br><br>The original design of Snefru was shown to be insecure by Eli Biham and Adi Shamir who were able to use differential cryptanalysis to find hash collisions. The design was then modified by increasing the number of iterations of the main pass of the algorithm from two to eight.",
inputType: "string",
outputType: "string",
args: [
{
name: "Rounds",
type: "option",
value: Hash.SNEFRU_ROUNDS
},
{
name: "Size",
type: "option",
value: Hash.SNEFRU_SIZE
}
]
},
"HMAC": {
module: "Hashing",
description: "Keyed-Hash Message Authentication Codes (HMAC) are a mechanism for message authentication using cryptographic hash functions.",
+1
View File
@@ -33,6 +33,7 @@ OpModules.Hashing = {
"RIPEMD": Hash.runRIPEMD,
"HAS-160": Hash.runHAS,
"Whirlpool": Hash.runWhirlpool,
"Snefru": Hash.runSnefru,
"HMAC": Hash.runHMAC,
"Fletcher-8 Checksum": Checksum.runFletcher8,
"Fletcher-16 Checksum": Checksum.runFletcher16,
+25
View File
@@ -294,6 +294,31 @@ const Hash = {
},
/**
* @constant
* @default
*/
SNEFRU_ROUNDS: ["8", "4", "2"],
/**
* @constant
* @default
*/
SNEFRU_SIZE: ["256", "128"],
/**
* Snefru operation.
*
* @param {string} input
* @param {Object[]} args
* @returns {string}
*/
runSnefru: function (input, args) {
const rounds = args[0],
size = args[1];
return CryptoApi.hash(`snefru-${rounds}-${size}`, input, {}).stringify("hex");
},
/**
* @constant
* @default
+66
View File
@@ -338,6 +338,72 @@ TestRegister.addTests([
}
]
},
{
name: "Snefru 2 128",
input: "Hello, World!",
expectedOutput: "a4ad2b8848580511d0884fb4233a7e7a",
recipeConfig: [
{
"op": "Snefru",
"args": ["2", "128"]
}
]
},
{
name: "Snefru 4 128",
input: "Hello, World!",
expectedOutput: "d154eae2c9ffbcd2e1bdaf0b84736126",
recipeConfig: [
{
"op": "Snefru",
"args": ["4", "128"]
}
]
},
{
name: "Snefru 8 128",
input: "Hello, World!",
expectedOutput: "6f3d55b69557abb0a3c4e9de9d29ba5d",
recipeConfig: [
{
"op": "Snefru",
"args": ["8", "128"]
}
]
},
{
name: "Snefru 2 256",
input: "Hello, World!",
expectedOutput: "65736daba648de28ef4c4a316b4684584ecf9f22ddb5c457729e6bf0f40113c4",
recipeConfig: [
{
"op": "Snefru",
"args": ["2", "256"]
}
]
},
{
name: "Snefru 4 256",
input: "Hello, World!",
expectedOutput: "71b0ea4b3e33f2e58bcc67c8a8de060b99ec0107355bbfdc18d8f65f0194ffcc",
recipeConfig: [
{
"op": "Snefru",
"args": ["4", "256"]
}
]
},
{
name: "Snefru 8 256",
input: "Hello, World!",
expectedOutput: "255cd401414c79588cf689e8d5ff0536a2cfab83fcae36e654f202b09bc4b8a7",
recipeConfig: [
{
"op": "Snefru",
"args": ["8", "256"]
}
]
},
{
name: "HMAC SHA256",
input: "Hello, World!",