YOUSEFUL / FILEMAKER
Youseful Crypt: FAQ, examples and tutorial
Learning center · Function reference
Use YsflCrypt.fmx64 for encryption, hashing, compression, container conversion
and Windows Credential Manager access. This tutorial works entirely in variables.
FAQ
How is encryption different from Base64? Encryption requires a key or password to recover the content. Base64 is a reversible text encoding and provides no secrecy. Digest produces a one-way fingerprint rather than an encrypted copy.
Why does encrypting the same text twice produce different results? The password-based function generates fresh random material for each envelope. Compare the decrypted text, not the ciphertext. Keep the entire returned envelope.
What does Encrypt use by default? This build uses AES-256-GCM and PBKDF2-HMAC-SHA256 with 600000 iterations. The tutorial keeps those defaults. Options for interoperability are documented in the reference.
Where are credentials saved? New entries are in Windows Credential Manager
for the current Windows user under Youseful:<name>. Existing entries from the
earlier brand remain accessible. A credential entry is separate from a FileMaker
record; it is not automatically shared with other Windows users.
Examples
Compute a SHA-256 digest:
YsflCr_Digest ( "abc" ; "sha256" ; "hex" )Result:
ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad.
Round-trip a sample value:
Let ( [
envelope = YsflCr_Encrypt ( "Sample note" ; "tutorial-only-password" )
] ;
YsflCr_Decrypt ( envelope ; "tutorial-only-password" )
)Result: Sample note. Use the longer script below to handle errors at each stage.
Tutorial
Standalone sample scripts: Encrypt a note.
Goal: encrypt a note and verify that it decrypts to the original text.
- Create a script named
Youseful - Encrypt a note. - Add these steps. The literal password is only for this disposable example; supply your application's password through its intended credential flow.
Set Variable [ $plain ; Value: "Sample note" ]
Set Variable [ $password ; Value: "tutorial-only-password" ]
Set Variable [ $envelope ; Value: YsflCr_Encrypt ( $plain ; $password ) ]
Set Variable [ $error ; Value: YsflCr_LastError ]
If [ $error <> 0 ]
Show Custom Dialog [ "Encryption failed" ; YsflCr_LastErrorText ]
Exit Script [ Text Result: $envelope ]
End If
Set Variable [ $restored ; Value: YsflCr_Decrypt ( $envelope ; $password ) ]
Set Variable [ $error ; Value: YsflCr_LastError ]
If [ $error <> 0 ]
Show Custom Dialog [ "Decryption failed" ; YsflCr_LastErrorText ]
Exit Script [ Text Result: $restored ]
End If
Show Custom Dialog [ "Round trip" ; If ( $restored = $plain ; "Matched" ; "Different" ) ]
Set Variable [ $password ; Value: "" ]- Run it. Expected:
Matched. The envelope text varies each run. - For a failure demonstration, change only the password passed to Decrypt.
Expect
? Decryption failed; do not replace stored ciphertext with that result.
Troubleshooting
Use EncryptContainer and DecryptToContainer for binary files. Preserve the envelope exactly, including its format prefix. A wrong password, damaged envelope or authentication failure prevents decryption; the tutorial intentionally does not treat empty text as proof of success.