Jump to content
Server Maintenance This Week. ×

Help modify a custom function


This topic is 4594 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 ) )

)

Link to comment
Share on other sites

This topic is 4594 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.