Converted Vignere, added more tests and cleaned stuff up

This commit is contained in:
Matt C 2018-05-09 21:13:09 +01:00
parent 789ec94eff
commit 6bec68021c
7 changed files with 358 additions and 357 deletions

View file

@ -1,6 +1,6 @@
/**
* @author n1474335 [n1474335@gmail.com]
* @copyright Crown Copyright 2016
* @author Matt C [matt@artemisbot.uk]
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
@ -48,11 +48,9 @@ class BifidCipherEncode extends Operation {
let output = "",
count = 0;
if (keyword.length > 25)
return "The alphabet keyword must be less than 25 characters.";
if (!/^[a-zA-Z]+$/.test(keywordStr) && keyword.length > 0)
return "The key must consist only of letters";
if (!/^[A-Z]+$/.test(keywordStr) && keyword.length > 0)
return "The key must consist only of letters in the English alphabet";
const polybius = genPolybiusSquare(keywordStr);