stuj1026 Posted September 30, 2011 Posted September 30, 2011 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
comment Posted September 30, 2011 Posted September 30, 2011 The answer depends on what characters are allowed for the plain text and for the key.
stuj1026 Posted October 1, 2011 Author Posted October 1, 2011 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
comment Posted October 1, 2011 Posted October 1, 2011 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.
stuj1026 Posted October 4, 2011 Author Posted October 4, 2011 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 ) ) )
comment Posted October 4, 2011 Posted October 4, 2011 is this what you meant? Probably. It would be easier to tell if all the redundant parentheses were removed...
Recommended Posts
This topic is 4832 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now