Example Code

Native LabVIEW DES Encryption

Code and Documents


LabVIEW DES Encryption Function and Examples

This program implements the NIST Data Encryption Standard (DES) as described in FIPS PUB 46-3. The example is written in native LabVIEW code and is a literal interpretation of the DES algorithm.

Files in this example include:

Top-level directory:
Encrypt-Decrypt data(DES).vi: Top-level VI for encryption/decryption. Calls all other VIs as SubVIs.
CERT-GOOD.TXT: A series of keys, plaintext, and ciphertext to test the example
CERT-BAD.TXT: Another series of keys and data to test. File contains some data errors.
DES-errors.txt: A list of error codes produced by the example.

Examples directory:
Test DES.vi: Example which you can use to load and check all of the CERT.TXT file.
Encipher/Decipher file.vi: Shows how to use Encrypt-Decrypt data(DES).vi to encipher/decipher files.

To use the main encryption/decryption function:
1. Put the file DES-errors.txt in the .\LabVIEW\User.lib\errors directory
2. Load Encrypt-Decrypt data(DES).vi.
3. Copy a line of the file CERT.TXT into the Data input and Key string controls. They are put in as hex strings.
4. Run the VI. The Data output string should match the ciphertext entry on the row used from CERT.TXT
5. To decrypt, put the ciphertext in the Data input, use the same key, and set the Encipher/Decipher? Boolean to Decipher.


Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.