The Blowfish Encryption Algorithm

Publish Date: Jan 22, 2013 | 601 Ratings | 4.86 out of 5 | Print | 15 Customer Reviews | Submit your review

The Blowfish Encryption Algorithm

Block Cipher: 64-bit block
Variable Key Length: 32 bits to 448 bits
Designed by Bruce Schneier
Much faster than DES and IDEA
Not Patented and Royalty-Free
No license required

Blowfish is a symmetric block cipher that can be used as a drop-in replacement for DES (Data Encryption Standard) or IDEA (International Data Encryption Algorithm). It takes a variable-length key, from 32 bits to 448 bits, making it ideal for both domestic and exportable use. Blowfish was designed in 1993 by Bruce Schneier as a fast, free alternative to existing encryption algorithms. Since then, it has been analyzed considerably, and is slowly gaining acceptance as a strong encryption algorithm. Blowfish is not patented, is license-free, and is available free for all uses.

As far as I know, this is the first implementation of the Blowfish Algorithm in LabVIEW. With this set of sub-VIs, one can encrypt data in LabVIEW without the need for external software. This can be used to send data securely over Data Socket as well as TCP and UDP communications. It can also be used to protect remote control systems from unauthorized access by encrypting the control communications.

I have added compatibility for the basic blowfish functions with other implantations, and fixed a couple of bugs. I have also added a self-test VI that should show if the VI is compatible between the PC and MAC. The "LabVIEW Blowfish" uses header info to return an encrypted message back to its original length; because of this, it will likely not be directly compatible with other encryption software even though the software may use the same blowfish encryption method. Without knowing what other software uses for header info, I just used what was convenient for me in LabVIEW.

I welcome any constructive comments, and bug reports can be sent to the e-mail contained in the code.

Back to Top

Additional Information
Contributor Name : Tad Taylor Contributor Company : Blue Road Research
Customer Reviews
15 Reviews | Submit your review

error  - Dec 7, 2014

I am getting the following error This Code Interface Node has no code to execute. Right-click the node, select Load Code Resource from the shortcut menu, and select the object code file (.lsb).

error  - Apr 30, 2012

I got this error in my Labview 2011, Error 116 occurred at Unflatten From String in LabVIEW Blowfish LabVIEW: Unflatten or byte stream read operation failed due to corrupt, unexpected, or truncated data. Why?? Can anyone tell me what's wrong? because I don't change anything there.. thx.

No need for ZLIB dll  - Aug 17, 2010

The zlib DLL ( is only needed for data compression before encoding and to decompress data after decoding. Even when data is not compressed before encoding, the DLL is still called for decompression after decoding, but the result is discarded because it comes back empty. If there is no need to compress data before encoding, the zlib nodes can actually and simply be removed from LabVIEW Blowfish; the zlib.dll will no longer be called and there is no need to also distribute it. Leaving the "Compress Before encrypting?" boolean control intact, so that the vi "interface" does not change, keeps code compatibility (if compression was not used, of course).

Current Version Workaround  - May 21, 2010

Hello all, If you are using LV 8.0+ and want to use this code: 1- Change the CIN block for a Call Library Function Node (CLFN) 2- Click on Configure... 3- Select the zlib.dll and for the CLFN inside the, select the function named "inflate" while for the CLFN being used in the, use the function "deflate". It should work OK after those changes.

Updated version  - Mar 31, 2010

Is there an updated version to this for LabVIEW 8.x or 2009? I have been able to use the code in LV 8.x and 2009, however the CIN calling zlib.dll seems to cause code loading issues with the way NI has implemented projects. I queried NI tech support about the error message I have been getting and received the reply: "After looking into this more, these VIs were orginally LabVIEW 7.0 which wouldn't convert up correctly to LabVIEW 8.6 or LabVIEW 2009 because of the changes between these versions. The CIN node was orginally used to talk to both .dlls and .lsb files but in later versions of LabVIEW (8.2 onwards) the CIN node was only used for .lsb while the Call library function node was used for .dlls. The error that you are receiving is stating that it can't use the dll with the CIN node. In order to fix this code, you would need to change these CIN into call library function nodes. "

Very nice, but not the first  - Dec 20, 2009

Very nice example Tad! Thanks for sharing with the community. The first BlowFish implementation I know of was done by Jeffrey Travis about 5-6 years ago (2003) for security on a hospital management system. That one, however, was not released at that time to the public. (You'd have to ask Jeffrey). As far as I know, your's is the first freely available version. BlowFish with LabVIEW met FDA and HIPAA security and privacy requirements both over intranet and internet configurations at 128 bits, so it's a solid choice for security.

  - Sep 4, 2009

This is a great example. I used it in some of my applications here to allow secure web access to one of my LV applications.

  - Nov 3, 2005

Labview6.1 look at this:

missing .lsb code solved  - Dec 5, 2004

Evaluation of the vi shows that the missing code is only used for optional compression and decompression. Removing this from the vi results in a vi that works on macintosh, though without compression. Thanks for the code. Paul.

code lib is missing  - Sep 19, 2004

I can't execute this vi, because a lib is missing The object code file (.lsb) node has no code to execute. in

How about LV 6.1?  - Feb 11, 2004

It would be a great help if NI can convert this to enable earlier version owners use this tool.

It works, but...  - Jan 22, 2004

Thanks for this code. I would like to crypt a message with this library, and then decrypt it with php, using mcrypt library. The problem is that mcrypt library ask for others parameters, and I can't find the good parameters to decrypt propertly the message. PHP ask for mode (ECB, EFB...) and for create an IV. What is the relation with this compression code?

What about users of LabVIEW 6 and 5?  - Jan 6, 2004

There are a large number of LabVIEW users who are using LabVIEW 5 or 6. There should be 5x and 6x versiona available.

Is the encryption available for the 6.1 versions?  - Dec 22, 2003

I was wondering if the encryption vi's were available for the 6.1 version of labview?

Very useful.  - Dec 5, 2003

Thanks for sharing such a useful VI. I had a couple questions though. In the "Decipher" case, of the right most case structure, you build an error cluster of "Text is Empty Password is most likely incorrect" and tests if the string length is "0, Default". It should probably be "0", and then the non-error case (currently set to "1") be "Default." Otherwise I always get an error. Also, is compression part of the blowfish standard? It seems like I could construct some random plain-text that happens to be zlib compressed that when encrypted with no compression, and then un-encrypted with the "compression" boolean set that I might not get the plain-text that I was expecting (I would get the uncompress form, rather than the plain-text I passed in). Just curious. Thanks!

View more reviews

Bookmark & Share



LabVIEW Blowfish Encryption.ll



Rate this document

Answered Your Question?
Yes No