« MBS Xojo / Real Studi… | Home | Print to PDF File on … »

New universal Hash and Encrypt functions for MBS FileMaker Plugin


With latest prerelease we add two very universal hash and encryption functions:

MBS( "Hash.Digest"; Algorithm; InputType; InputData; InputEncoding; OutputType; OutputInfo )
and
MBS( "Encryption.Cipher"; Direction; Algorithm; KeyType; KeyData; KeyEncoding; InputType; InputData; InputEncoding; OutputType; OutputInfo; IVType; IVData; IVEncoding )

The Hash.Digest function can calculate hashes. For Algorithm we support MD4, MD5, SHA, SHA1, MDC2, RIPEMD160, SHA224, SHA256, SHA384 or SHA512. You pass input data and receive the hash in the requested output format.

The Encryption.Cipher function is a little bit more complex. First you pass direction which can be "encrypt" or "decrypt". Than you pass algorithm. We have a lot of combinations of algorithms, bit depths and block cipher mode as you below in the list. Finally you pass input data and receive the encrypted data in the requested output format.

Supported encryption algorithms:

AES-128-CFB, BF-CBC, BF-CFB, BF-ECB, BF-OFB, AES-128-CBC, id-aes128-CCM, AES-128-CFB1, AES-128-CFB8, AES-128-CTR, AES-128-ECB, id-aes128-GCM, AES-128-OFB, AES-128-XTS, AES-192-CBC, id-aes192-CCM, AES-192-CFB1, AES-192-CFB8, AES-192-CFB, AES-192-CTR, AES-192-ECB, id-aes192-GCM, AES-192-OFB, AES-256-CBC, id-aes256-CCM, AES-256-CFB1, AES-256-CFB8, AES-256-CFB, AES-256-CTR, AES-256-ECB, id-aes256-GCM, AES-256-OFB, AES-256-XTS, CAMELLIA-128-CBC, CAMELLIA-128-CFB1, CAMELLIA-128-CFB8, CAMELLIA-128-CFB, CAMELLIA-128-ECB, CAMELLIA-128-OFB, CAMELLIA-192-CBC, CAMELLIA-192-CFB1, CAMELLIA-192-CFB8, CAMELLIA-192-CFB, CAMELLIA-192-ECB, CAMELLIA-192-OFB, CAMELLIA-256-CBC, CAMELLIA-256-CFB1, CAMELLIA-256-CFB8, CAMELLIA-256-CFB, CAMELLIA-256-ECB, CAMELLIA-256-OFB, CAST5-CBC, CAST5-CFB, CAST5-ECB, CAST5-OFB, DES-EDE, DES-EDE-CBC, DES-EDE-CFB, DES-EDE, DES-EDE-OFB, DES-EDE3, DES-EDE3-CBC, DES-EDE3-CFB1, DES-EDE3-CFB8, DES-EDE3-CFB, DES-EDE3, DES-EDE3-OFB, RC2-40-CBC, RC2-64-CBC, RC2-CBC, RC2-CFB, RC2-ECB, RC2-OFB, RC4, RC4-40, RC4-HMAC-MD5, IDEA-CFB, IDEA-ECB, IDEA-OFB, IDEA-CBC, DES-CFB1, DES-CFB8, DES-CFB, DES-OFB, DES-ECB, DES-CBC or DESX-CBC.

Input data

For input, initial values or key, you pass input with type, data and info. Type can be one of several types: Text, Container, Image, Path, PDF, Data, base64 or Hex. For example you can pass type "text", the actual text with the data parameter and the text encoding to use with the info parameter. If you prefer to pass in a hex string as data, than please pass "hex" as type. You can also pass a file path if type is "path" to read a file. Finally you can pass container values. As type you can pass "Data" to read main stream of container, "Image" to accept any image in the container or "FILE", "PDF", "JPEG", "PNG", "TIFF" or "GIF" for a specific stream in container. If you pass "Container" as type, the container is packed and passed with all streams, so after decrypting you will have the same container back.

For output you can select between various formats: Base64, Hex, Text, File, Path, GIF, TIFF, PNG, PDF, JPEG or Container. So if you encrypted something you can output it to a file on disk (type path), as base64 or hex encoded text or as a container with a FILE stream. After decrypting the data you can return it as text with a specific encoding, write it to a file (type path) or return as container with a specific stream, FILE stream or an unpacked container.

Examples

Calculate MD5 from text:
MBS( "Hash.Digest"; "MD5"; "Text"; "Hello World"; "UTF-8"; "Hex"; "" )

Calculate SHA512 from image in container and encode it as base64:
MBS( "Hash.Digest"; "SHA512"; "Image"; MyTable::MyContainer; ""; "Base64"; "" )

Encrypts some text with AES:
MBS( "Encryption.Cipher"; "encrypt"; "AES-128-CFB"; "Text"; "Test Key"; "UTF-8"; "Text"; "Hello World"; "UTF-8"; "Hex"; "" )

Encrypts a container:
MBS( "Encryption.Cipher"; "encrypt"; "AES-256-ECB"; "Hex"; "1234567812345678"; ""; "Container"; MyTable::MyContainer; ""; "FILE"; "data.dat" )

and decrypt the container:
MBS( "Encryption.Cipher"; "decrypt"; "AES-256-ECB"; "Hex"; "1234567812345678"; ""; "FILE"; MyTable::MyEncryptedContainer; ""; "Container"; "" )
23 02 14 - 20:58
No comments

  
Remember personal info?

Emoticons / Textile


Notify:
Hide email:

Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.