Hi, first time poster here and I am trying to run the Twofish implementation that I found online. I have a very basic knowledge of C++ and I am only trying to get these files to run so that I can analyze encryption times and decryption times for a class project.
I am getting linking errors from twofish.h shown below:
#ifndef CRYPTOPP_TWOFISH_H
#define CRYPTOPP_TWOFISH_H
/** \file
*/
#include "cryptlib.h"
#include "misc.h"
NAMESPACE_BEGIN(CryptoPP)
/// base class, do not use directly
class Twofish : public FixedBlockSize<16>, public VariableKeyLength<16, 0, 32>
{
protected:
Twofish(const byte *userKey, unsigned int keylength);
static word32 h0(word32 x, const word32 *key, unsigned int kLen);
static word32 h(word32 x, const word32 *key, unsigned int kLen);
static const byte q[2][256];
static const word32 mds[4][256];
SecBlock<word32> m_k;
SecBlock<word32[256]> m_s;
};
/// <a href="http://www.weidai.com/scan-mirror/cs.html#Twofish">Twofish</a>
class TwofishEncryption : public Twofish
{
public:
TwofishEncryption(const byte *userKey, unsigned int keylength=DEFAULT_KEYLENGTH)
: Twofish(userKey, keylength) {}
void ProcessBlock(const byte *inBlock, byte * outBlock) const;
void ProcessBlock(byte * inoutBlock) const
{TwofishEncryption::ProcessBlock(inoutBlock, inoutBlock);}
};
/// <a href="http://www.weidai.com/scan-mirror/cs.html#Twofish">Twofish</a>
class TwofishDecryption : public Twofish
{
public:
TwofishDecryption(const byte *userKey, unsigned int keylength=DEFAULT_KEYLENGTH)
: Twofish(userKey, keylength) {}
void ProcessBlock(const byte *inBlock, byte * outBlock) const;
void ProcessBlock(byte * inoutBlock) const
{TwofishDecryption::ProcessBlock(inoutBlock, inoutBlock);}
};
NAMESPACE_END
#endif
The specific errors I am getting are:
Twofish error LNK2001: unresolved external symbol "protected: static unsigned long const (* CryptoPP::Twofish::mds)[256]" (?mds@Twofish@CryptoPP@@1QAY0BAA@$$CBKA)
Twofish error LNK2001: unresolved external symbol "protected: static unsigned char const (* CryptoPP::Twofish::q)[256]" (?q@Twofish@CryptoPP@@1QAY0BAA@$$CBEA)
Twofish error LNK2019: unresolved external symbol _main referenced in function _mainCRTStartup
I know that the first two errors mean that I am declaring something and I am not giving the compiler/linker the correct information to understand what is happening. Unfortunately I am not very experienced in coding and do not know much about Visual Studio and how to actually fix these errors.
The last error from what I understand has something to do with Win32 console projects and the way the linker sees characters or something. I have seen people say try changing the character set in the project properties, but that has not worked. If anyone could help me I would greatly appreciate it. If any further information is required just ask I can provide other pieces of code, but figured I would keep that part short for now until I had some guidance.
Thanks,
Tim