diff --git a/src/core/lib/Ciphers.mjs b/src/core/lib/Ciphers.mjs index a4d174b5..1f741db3 100644 --- a/src/core/lib/Ciphers.mjs +++ b/src/core/lib/Ciphers.mjs @@ -65,6 +65,27 @@ export function genPolybiusSquare (keyword) { return polybius; } +/** + * Generates a mapping for the MultiTap + * + * @private + * @author Necron3574 [kaustubhbm3574@gmail.com] + * @param {int,string} toggle - 1 for encode , 2 for decode, space_delim + * @returns {dict} + */ +export function getMultiTapMap (toggle,space_delim) { + var mapping = {"A" :"2","B":"22","C":"222","D":"3","E":"33","F":"333","G":"4","H":"44","I":"444","J":"5","K":"55","L":"555","M":"6","N":"66","O":"666","P":"7","Q":"77","R":"777","S":"7777","T":"8","U":"88","V":"888","W":"9","X":"99","Y":"999","Z":"9999"," ":space_delim}; + if(toggle == 1) + return mapping; + else{ + var ret = {}; + for(var key in mapping){ + ret[mapping[key]] = key; + } + return ret; + } +} + /** * A mapping of string formats to their classes in the CryptoJS library. *