Software Venture Consulting

FileMaker Pro downloads & Resources
FileMaker Custom Functions
FileMaker Web Viewer Examples
FileMaker Pro & Lasso Consulting
FileMaker Books
FileMaker Articles
FileMaker Error Reference

Free Web Tools
Free FileMaker Tools

Personal Pages

Shopping Cart
Shopping Cart


Free Newsletter


Privacy Policy

FileMaker is a registered trademark of FileMaker, Inc. in the U.S. and other countries.


 FileMaker Pro Custom Functions

List  |  Show Random  |  Upload  |  Add This to Your Site

OK_Encrypt (Text ; Key )

Rate this function:  

  Average rating: 4.5  (32 votes)
  Discuss this Custom Function

Peter Vinogradov, Peter Vinogradov Consulting

Gently encrypt text with key

Sample Input:
OK_Encrypt ("Hello" ; "Goodbye" )
Sample Output:

 Then copy & paste into FileMaker Advanced's Edit Custom Function window.


I'm using this to create encrypted QR codes, so it only needs to operate on small amounts of text, and it doesn't need to be totally uncrackable, just difficult.

Note: The function keeps track of its position in the text by enclosing a counter in two sets of pipes ("||"). This isn't the most elegant solution, but it fits my purposes. If you need to use pipes in your text, revise to use a different bracket, or add a counter parameter to the function.

Update: To avoid the pipes issue, please see the much better version offered in the comments below.

Note: these functions are not guaranteed or supported by Please contact the individual developer with any questions or problems.

This is my Custom Function and I want to edit it


5 most recent comments | Show all 8 comments

Here is another way - this one uses a "caterpillar track" to serve up the key: export-files/page__p__325022#entry325022

comment, VR
December 30, 2010 12:53pm

OK, I see what you did. I was stuck mentally on trying to match the key against the text from beginning to end. Your way effectively lays it against the text from back to front, with the advantage that we don't need to know how many letters came before the current letter. Thanks for the improvements! And the article you linked to in your fmforums post was helpful in letting me know that (a) this basically a Vigenere cypher, and (b) cracking a Vigenere cipher is annoying enough that the encryption will meet my needs :)

Peter Vinogradov, Hyde Park, NY
December 30, 2010 1:25pm

Yes, it is basically a Vernam or a Vigenere - except that technically you are supposed to do:

C = Char ( Mod ( Code ( P ) + Code ( K ) ; n )

where n is the length of the allowable alphabet.

As for strength: if you were to use random keys of at least the message length, and use each key only once, then this would be unbreakable (as long as the key remains secret).

comment, VR
December 30, 2010 1:48pm

Very nice code I love it! congratulations, but I have some comments:

For long text (20 words or more) its very slow

if the encryption key has the next shift_alt values it will not work ˜ˆ can add some code to not allow this, but I thing this should be fixed in the formula!

if the key is “r” or “rr” or “rrrrrrrrrrrrrr” the encryption is the same! actually lots of combinations can be the same key

You can know if the encrypted text was encrypted with only numbers just by looking at it ...if you have some knowledge of this formula.

for some reason I don't know the formula stops working I had to close and open the file again (FileMaker 11).

Hope this helps! I still think this is the best encryption formula in this site! :)


Brian Donovan, Mexico
February 21, 2015 11:57am

Forgot one comment:

The text to encrypt defenetly can't have any shift_alt values!


Brian Donovan, Mexico
February 21, 2015 12:00pm

Make a comment about this Custom Function (please try to keep it brief & to the point). Anyone can post:

Your Name:
characters left. If you paste in more than 1500 characters, it will be truncated. Discuss the function - advertisements and other useless posts will be deleted.
Answer 0 + 7 =
Search for Custom Functions:

Custom Functions Widget
Download the Custom Function Dashboard Widget for OS X
Keep all the latest Custom Functions right at your fingertips!

Newest Custom Functions:

1. JSONArrayLength ( JSONArrayStr )
  (Fri, May 25, 7:46am)
2. interpolation (y1; y2; y3; x1; x2; x3; x1y1; x2y1; x1y2; x2y2; rnd)
  (Sat, May 19, 3:55am)
3. @JSONFormatElements ( json )
  (Tue, May 15, 3:31am)
4. WindowNamesAll ( dbNames ; excludeCurrentWindow )
  (Sat, May 12, 11:34am)
5. RandomChoiceFromList ( values ; required )
  (Wed, May 02, 6:35am)
6. @JSONFormatElements ( json )
  (Fri, Apr 27, 7:31am)
7. MBS-OCR ( language ; Image )
  (Mon, Apr 23, 1:48pm)
8. MBS_Image_Rotate ( Picture ; rotation )
  (Mon, Apr 23, 1:27pm)

RSS Feed of Custom Functions