Problems including Blowfish in Arduino sketch

Hey Guys,

i tried to include the C++ blowfish code from https://www.schneier.com/code/bfsh-unk.zip into my sketch.
But while testing it i got a couple of errors.
For example:
H:\Programme\arduino-1.5.4/test_blowfish.ino:2: undefined reference to `Blowfish::~Blowfish()'
(after I commented out the "= NULL" in line 67)

H:\Programme\arduino-1.5.4\libraries\Blowfish/blowfish.h:67: error: expected primary-expression before '=' token
H:\Programme\arduino-1.5.4\libraries\Blowfish/blowfish.h:67: error: expected `)' before ';' token
H:\Programme\arduino-1.5.4\libraries\Blowfish/blowfish.h:67: error: expected unqualified-id before ')' token

My code looks like this at the momen (just for testing the lib):

#include <blowfish.h>
Blowfish bf;
char* Key = "ABCDE";

void setup() {
  bf.Set_Passwd(Key);
  

}

void loop() {
  // put your main code here, to run repeatedly: 
  
}

It would be great if somebody could help me including this code.

NG
Dr_Console

Your going to have your work cut out for you to get that code to work. First, why would you provide a link to a zip file containing one file, when clearly you needed to break that file into three files?

Second, how are you defining LITTLE_ENDIAN or BIG_ENDIAN so the compile knows which definition of the WordByte structure to include?

Third, where are you expecting the cout statements to write to? The cin statements to read from?

What Arduino are you planning to use that code with? Not a 328-based Arduino, that's for sure.

Hey thanks for your reply,

i linked this zip, cause i'm at the moment in school, so i haven't the possebilities to upload everything here.
But as you said i already parted the file into the 3 marked in it.
To the programming, i'm not that good in coding C++ so i didn't realized it.
last but not least, i want to get it running on an arduino duemillanove.

Would be great if you could help me with it.

NG
Dr_Console

Would be great if you could help me with it.

It can't be done. One of the arrays in that class will take every bit of SRAM, leaving to room for anything else.

Okay tanks for that info...
Do you know any other cryptcode like Blowfish which runs on a arduino?

NG

The Blowfish library may also be assuming 32 bit ints or other big-computer C facilities, so
in practice for stuff like this you have to port to Arduino, carefully checking/adapting the
code to fit the hardware (which is doesn't for the Uno/Mega class of Arduinos due
to memory requirements. A microcontroller typically has 4 to 6 orders of magnitude less
memory than a general purpose computer, you cannot ignore that!)

If you are looking for a symmetric block cipher then the obvious candidate is XTEA/XXTEA
or even triple-DES, which have tiny memory footprints.

But before you throw crypto into a project you need to realise that you won't make a system
secure unless you really know what you are doing, and that isn't easy (even for experts).
Perhaps you need authentication rather than secrecy? What is your threat model?

If you want to use an arduino for cryptography and/or secure autentication, use a hardware based solution. There are several modules available ( adafruit and sparkfun sell them) for this. Maybe an arduino due has enough cpu power and memory to do this comfortably, uno's and the likes most likely do not. But if you want to give it a go, there are several arduino libraries available (including DES/TDES and AES).