Brian Dunning's FileMaker Custom Functions

ChaosEncrypt ( text ; key )

Encrypt text with a chaos-based stream cipher

  Average rating: 4.6 (29 votes) Log in to vote

Jeremy Bante   Jeremy Bante

Share on Facebook Share on Twitter

  Sample input:
ChaosEncrypt ( "The original text" ; "The super-secret key" )
  Sample output:

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

ChaosEncrypt ( text ; key ) uses chaotic permutations of key to create an encrypted version of text that is extremely difficult to retrieve without the original key. This function uses a pseudo-chaotic stream cipher algorithm adapted to the constraints of FileMaker custom functions.

This function has not been subjected to rigorous cryptanalysis, and the author does not warranty the security of encrypted text.

Newer versions of this function are very unlikely to be backwards compatible.



Luis Mateus   Luis Mateus, Porto / Portugal
Feb 19, 2011
Probably is a basic question but can you explain the "$~" and why if it's changed I get an error?

Dan Weiss   Dan Weiss, Cleveland, OH
May 23, 2011
DO NOT USE - Causes Field Damage.
Jeremy Bante   Jeremy Bante, San Mateo, CA, USA
May 23, 2011
Dan, can you be more specific? Perhaps it's something I can fix. I've been thinking about revamping this function for a while now, and omitting any special-purpose unicode characters from the space of possible output could be something to include.
Jose Ferreira   Jose Ferreira, Leiria / Portugal
May 31, 2011
Fantastic cf, but I have a problem. If I try to send the encrypted text by the “SendMail” script step I’m unable to decrypt it.
It works fine if, inside FileMaker, I copy encrypted and paste to decrypt.
Also tried ExportFieldContents and ExportRecord with no luck.
Does the character set have anything to do with this problem?
Jeremy Bante   Jeremy Bante, San Mateo, CA, USA
May 31, 2011
Jose, the character set almost certainly has something to do with the problem. Encoded characters can include **any** Unicode character, which includes control characters and esoteric delimiter characters (the vertical tab character, for example). I'm considering revising the function to avoid certain Unicode ranges in order to avoid this kind of problem, but I haven't gotten around to it yet.
Jose   Jose, Ferreira
Jun 1, 2011
Thanks, Jeremy, for the quick answer. I’m also trying to figure it out and I’ll keep you informed of the results.
Olger   Olger, Gold Coast, Australia
Jul 18, 2014
Have tried this function and am finding it flawed. I encrypted 7000 credit card numbers and some 2% are not encrypted correct. Long or short keys make no difference (although the shorter the key the less gets encrypted correctly).
I've used a key 3 or 4 times the size of a CC number, exactly the same length as a CC , makes no difference. Some numbers in CC's will cause issues for this encryption function.
Using FM13.
Jeremy   Jeremy, USA
Jul 18, 2014
Please do not use this function to encrypt credit card numbers. It has not been subjected to a substantial amount of cryptanalytic scrutiny. Use a more rigorously analyzed and tested algorithm instead, such as AES 256.
Steve S   Steve S, Indiana
Nov 24, 2014
We are trying to use this to encrypt customer and project names to a distributed mobile workforce. The problem is that of the 125 records encrypted, some of the customer names or project names are not decrypting properly. Total error rate is 12 errors. We can't find any pattern in the text that is problematic. Will this work on any and all text?
Jeremy   Jeremy, USA
Nov 24, 2014
Steve, I've done a fair amount of testing, but the space of possibilities is too big for me to test everything. Other folks have found issues before related to nuances of text encoding that I was previously ignorant of. I'm not surprised you're running into more. Send me an email (check the scrim link in the header comment) if you're comfortable sharing some examples with me that I can look at in more detail.

That said, you shouldn't be using this function if you need a lot of confidence in the security of your solution. I wrote this encryption scheme for fun because I was bored with work one week; it has not been subjected to significant cryptanalytic scrutiny. You should consider using FileMaker 13s new encryption at rest feature, which is much more secure.

Log in to post comments.


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

Under construction. Email me your wish list for improvements.