mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-23 08:16:17 -04:00
Converted Bifid & moved over tests
This commit is contained in:
parent
f87666f659
commit
789ec94eff
4 changed files with 338 additions and 0 deletions
|
@ -39,3 +39,23 @@ export function affineEncode(input, args) {
|
|||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a polybius square for the given keyword
|
||||
*
|
||||
* @private
|
||||
* @author Matt C [matt@artemisbot.uk]
|
||||
* @param {string} keyword - Must be upper case
|
||||
* @returns {string}
|
||||
*/
|
||||
export function genPolybiusSquare (keyword) {
|
||||
const alpha = "ABCDEFGHIKLMNOPQRSTUVWXYZ",
|
||||
polArray = `${keyword}${alpha}`.split("").unique(),
|
||||
polybius = [];
|
||||
|
||||
for (let i = 0; i < 5; i++) {
|
||||
polybius[i] = polArray.slice(i*5, i*5 + 5);
|
||||
}
|
||||
|
||||
return polybius;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue