Skip to main content

Encr_EncryptNewDES (function reference)

By April 20, 2023April 25th, 2023Online Help, Troi Encryptor Plug-in
Troi Encryptor Plug-in for FileMaker Pro

Encr_EncryptNewDES

Encrypts text using a DES algorithm and the current crypt key. Specify a key first with the function Encr_SetCryptKey.

SyntaxFunction badge

Encr_EncryptNewDES ( switches ; text )

Parameters

switches reserved for future use, leave empty or set to "-Unused"
text the text to encrypt

Returned Result

Data type returned

Text

Result

the encrypted text

Originated in

Troi Encryptor Plug-in 1.2

Compatibility

FileMaker Pro 16 to FileMaker Pro 2023

Considerations

– The NewDES algorithm is not considered safe anymore.
– AES is a more secure algorithm than NewDES. See the function Encr_EncryptAES.
– Be sure to remember the key (case sensitive!): without it you can not retrieve the original text.
Use Encr_Code to encrypt without the need for a script.
– The result field should be a text field. If you encrypt into a date or number field it won’t work as FileMaker wants to interpret is as a (date) number.

Compatibility with Troi Coding Plug-in:
For backward compatibility, passwords are still Mac ASCII encoded except for chars not in the Mac ASCII set, these chars are now UTF8 encoded before the key is derived. For example:
“japan_显示” becomes “japan_0xE698BEE7A4BA” as password
“españa” becomes “españa” as password
Text is converted to the FileMaker Pro 6 character set. For other characters the UNICODE value is converted to a numeral reference. This ensures that fields with data from older FileMaker 6 databases will have the same encryption. The numeral references look like: À which is the Greek small letter pi.

Example

Set Field [ gErrorCode ; Encr_SetCryptKey ( "-Unused" ; "mySecret" ) ]
If [ gErrorCode = 0 ]
   Set Field [ result ; Encr_EncryptNewDES ( "-Unused" ; "Hello World" ) ] 
   Set Field [ gErrorCode ; Encr_SetCryptKey ( "-Unused" ; "different Key" ) ]
End If

gives this result: “l’ùé—JtO<=! Û¡\}0Óÿ„]˘¿Cºdè≈ˇ”

Example 2

In a database you have defined a text field named “patientData” which contains illness data. Then define a calculation field:

encryptedDataCalc    calculation   Unstored  = Encr_EncryptNewDES ( "-Unused" ; patientData )

this field will contain the encrypted text.

TIP Use the Encr_EncodeSafeAscii function for sending data safely over internet.

Used in example file

EncryptNewDES.fmp12

Related functionsFunction badge

Encr_Code
Encr_DecryptNewDES
Encr_EncodeSafeAscii
Encr_EncryptAES
Encr_SetCryptKey

Related topics

Troi Encryptor Plug-in online help (overview)


Online Help Page for Troi Encryptor Plug-in for 16 to 2023 –> Encr_EncryptNewDES (encrp4271) 2023-0425 15:53:56