September 30, 201114 yr I came across this custom function below within the forums. http://fmforums.com/...e-export-files/ Vigenere ( text, key, decode ) Let ( [ tChar = Left ( text ; 1 ) ; kChar = Left ( key ; 1 ) ; tLen = Length ( text ) ; kLen = Length ( key ) ] ; Char ( Mod ( Code ( tChar ) + Code ( kChar ) * ( not decode - decode ) ; 255 ) ) & Case ( tLen > 1 ; Vigenere ( Right ( text ; tLen - 1 ) ; Right ( key ; kLen - 1 ) & kChar ; decode ) ) ) If anyone could help, I need the text being encoded to fall within the ascii characters 32 and 126 and for the life of me I can't seem to make this work. All text to be encoded would always fall between ascii characters 32 and 126. Any help would be greatly appreciated. Thanks in advance Stu
September 30, 201114 yr The answer depends on what characters are allowed for the plain text and for the key.
October 1, 201114 yr Author thanks for the quick reply. the characters for plain text and for the key will always be ascii characters 32 thru126, all the visible characters on a standard keyboard.. thaks again stu
October 1, 201114 yr You need to subtract 32 from the code values of both plaintext and key characters before combining them, and change the divisor value of the Mod() function to 95. This will generate ciphertext in the range of 0 to 94 - which then needs to be shifted up by 32.
October 4, 201114 yr Author This is what I came up with. It seems to work.. is this what you meant? Thanks again Stu Let ( [ tChar = Left ( text ; 1 ) ; kChar = Left ( key ; 1 ) ; tLen = Length ( text ) ; kLen = Length ( key ) ] ; Char( Mod (((Code ( tChar )-32) + (Code ( kChar )-32)) * ( not decode - decode ); 95 )+32 ) & Case ( tLen > 1 ; Vigenere ( Right ( text ; tLen - 1 ) ; Right ( key ; kLen - 1 ) & kChar ; decode ) ) )
October 4, 201114 yr is this what you meant? Probably. It would be easier to tell if all the redundant parentheses were removed...
Create an account or sign in to comment