Remove code that's not part of this library

git-svn-id: http://smhasher.googlecode.com/svn/trunk@4 77a7d1d3-4c08-bdc2-d393-d5859734b01a
diff --git a/BlockCipher.cpp b/BlockCipher.cpp
deleted file mode 100644
index 414cf92..0000000
--- a/BlockCipher.cpp
+++ /dev/null
@@ -1,294 +0,0 @@
-#include "BlockCipher.h"

-

-#include <assert.h>

-#include <memory.h>

-

-//----------------------------------------------------------------------------

-

-BlockCipher::BlockCipher ( void )

-{

-	clear();

-

-	setMode(ECB);

-}

-

-BlockCipher::BlockCipher ( CipherMode mode )

-{

-	clear();

-

-	setMode(mode);

-}

-

-BlockCipher::~BlockCipher ( void )

-{

-}

-

-void BlockCipher::clear ( void )

-{

-	memset(m_plain,  0, 64);

-	memset(m_input,  0, 64);

-	memset(m_temp,   0, 64);

-	memset(m_output, 0, 64);

-	memset(m_crypt,  0, 64);

-}

-

-//----------------------------------------------------------------------------

-

-void BlockCipher::setMode ( CipherMode m )

-{

-	switch(m)

-	{

-		case ECB:  m_pEncrypt = &BlockCipher::encrypt_ECB;  m_pDecrypt = &BlockCipher::decrypt_ECB;  break;

-		case ECBN: m_pEncrypt = &BlockCipher::encrypt_ECBN; m_pDecrypt = &BlockCipher::decrypt_ECBN; break;

-		case CBC:  m_pEncrypt = &BlockCipher::encrypt_CBC;  m_pDecrypt = &BlockCipher::decrypt_CBC;  break;

-		case CFB:  m_pEncrypt = &BlockCipher::encrypt_CFB;  m_pDecrypt = &BlockCipher::decrypt_CFB;  break;

-		case OFB:  m_pEncrypt = &BlockCipher::encrypt_OFB;  m_pDecrypt = &BlockCipher::decrypt_OFB;  break;

-		case PCBC: m_pEncrypt = &BlockCipher::encrypt_PCBC; m_pDecrypt = &BlockCipher::decrypt_PCBC; break;

-		case CTR:  m_pEncrypt = &BlockCipher::encrypt_CTR;  m_pDecrypt = &BlockCipher::decrypt_CTR;  break;

-

-		default:   assert(false); setMode(PCBC); break;

-	};

-}

-

-//----------------------------------------------------------------------------

-

-void BlockCipher::encrypt ( void * key, int keySize, void * plain, void * crypt, int size )

-{

-	clear();

-

-	uint8_t * in = (uint8_t*)plain;

-	uint8_t * out = (uint8_t*)crypt;

-

-	int blockSize = getBlockSize();

-	int blockCount = size / blockSize;

-

-	setKey(key,keySize);

-

-	for(m_blockIndex = 0; m_blockIndex < blockCount; m_blockIndex++)

-	{

-		copy(m_plain,in);

-

-		(this->*m_pEncrypt)();

-

-		copy(out,m_crypt);

-

-		in  += blockSize;

-		out += blockSize;

-	}

-}

-

-void BlockCipher::decrypt ( void * key, int keySize, void * crypt, void * plain, int size )

-{

-	clear();

-

-	uint8_t * in = (uint8_t*)crypt;

-	uint8_t * out = (uint8_t*)plain;

-

-	int blockSize = getBlockSize();

-	int blockCount = size / blockSize;

-

-	setKey(key,keySize);

-

-	for(m_blockIndex = 0; m_blockIndex < blockCount; m_blockIndex++)

-	{

-		copy(m_crypt,in);

-

-		(this->*m_pDecrypt)();

-

-		copy(out,m_plain);

-

-		in  += blockSize;

-		out += blockSize;

-	}

-}

-

-//----------------------------------------------------------------------------

-// Electronic Codebook

-

-void BlockCipher::encrypt_ECB ( void )

-{

-	copy(m_crypt,m_plain);

-

-	encrypt(m_crypt,0);

-}

-

-//----------

-

-void BlockCipher::decrypt_ECB ( void )

-{

-	copy(m_plain,m_crypt);

-

-	decrypt(m_plain,0);

-}

-

-//----------------------------------------------------------------------------

-// Electronic Codebook + Nonce

-

-void BlockCipher::encrypt_ECBN ( void )

-{

-	copy(m_crypt,m_plain);

-

-	encrypt(m_crypt,m_blockIndex);

-}

-

-//----------

-

-void BlockCipher::decrypt_ECBN ( void )

-{

-	copy(m_plain,m_crypt);

-

-	decrypt(m_plain,m_blockIndex);

-}

-

-//----------------------------------------------------------------------------

-// Cipher Block Chaining

-

-void BlockCipher::encrypt_CBC ( void )

-{

-	xor(m_temp,m_plain,m_input);

-

-	encrypt(m_temp,0);

-

-	copy(m_input,m_temp);

-	copy(m_crypt,m_temp);

-}

-

-//----------

-

-void BlockCipher::decrypt_CBC ( void )

-{

-	copy(m_temp,m_crypt);

-

-	decrypt(m_temp,0);

-

-	xor(m_plain,m_temp,m_output);

-	copy(m_output,m_crypt);

-}

-

-//----------------------------------------------------------------------------

-// Cipher Feedback

-

-void BlockCipher::encrypt_CFB ( void )

-{

-	copy(m_temp,m_input);

-

-	encrypt(m_temp,0);

-

-	xor(m_crypt,m_temp,m_plain);

-	copy(m_input,m_crypt);

-}

-

-//----------

-

-void BlockCipher::decrypt_CFB ( void )

-{

-	copy(m_temp,m_input);

-

-	encrypt(m_temp,0);

-

-	xor(m_plain,m_temp,m_crypt);

-	copy(m_input,m_crypt);

-}

-

-//----------------------------------------------------------------------------

-// Output Feedback

-

-void BlockCipher::encrypt_OFB ( void )

-{

-	copy(m_temp,m_input);

-

-	encrypt(m_temp,0);

-

-	xor(m_crypt,m_temp,m_plain);

-	copy(m_input,m_temp);

-}

-

-//----------

-

-void BlockCipher::decrypt_OFB( void )

-{

-	copy(m_temp,m_input);

-

-	encrypt(m_temp,0);

-

-	xor(m_plain,m_temp,m_crypt);

-	copy(m_input,m_temp);

-}

-

-//----------------------------------------------------------------------------

-// Propagating Cipher Block Chaining

-

-// P = M(i)

-// I = M(i-1)

-// C = C(i-1)

-

-void BlockCipher::encrypt_PCBC ( void )

-{

-	xor(m_temp,m_input,m_crypt);

-	xor(m_temp,m_temp,m_plain);

-	copy(m_input,m_plain);

-

-	encrypt(m_temp,0);

-

-	copy(m_crypt,m_temp);

-}

-

-//----------

-

-// P = M(i-1)

-// I = C(i-1)

-// C = C(i)

-

-void BlockCipher::decrypt_PCBC ( void )

-{

-	copy(m_temp,m_crypt);

-

-	decrypt(m_temp,0);

-

-	xor(m_plain,m_plain,m_temp);

-	xor(m_plain,m_plain,m_input);

-

-	copy(m_input,m_crypt);

-}

-

-//----------------------------------------------------------------------------

-// Counter mode

-

-void BlockCipher::encrypt_CTR ( void )

-{

-	*(int*)m_temp = m_blockIndex;

-

-	encrypt(m_temp,0);

-

-	xor(m_crypt,m_temp,m_plain);

-}

-

-//----------

-

-void BlockCipher::decrypt_CTR ( void )

-{

-	*(int*)m_temp = m_blockIndex;

-

-	encrypt(m_temp,0);

-

-	xor(m_plain,m_temp,m_crypt);

-}

-

-//----------------------------------------------------------------------------

-

-void BlockCipher::copy ( uint8_t * dst, const uint8_t * src )

-{

-	memcpy(dst,src,getBlockSize());

-}

-

-void BlockCipher::xor ( uint8_t * dst, const uint8_t * a, const uint8_t * b )

-{

-	int blockSize = getBlockSize();

-

-	for(int i = 0; i < blockSize; i++)

-	{

-		dst[i] = a[i] ^ b[i];

-	}

-}

-

-//----------------------------------------------------------------------------

diff --git a/BlockCipher.h b/BlockCipher.h
deleted file mode 100644
index c5c63ad..0000000
--- a/BlockCipher.h
+++ /dev/null
@@ -1,90 +0,0 @@
-#pragma once

-#include "Cipher.h"

-#include "pstdint.h"

-

-//----------------------------------------------------------------------------

-

-class BlockCipher : public Cipher

-{

-public:

-

-	enum CipherMode

-	{

-		ECB,  // Electronic Codebook

-		ECBN, // Electronic Codebook + Nonce

-		CBC,  // Cipher block chaining

-		CFB,  // Cipher feedback

-		OFB,  // Output feedback

-		PCBC, // Propagating CBC

-		CTR,  // Counter

-		MAX = CTR,

-	};

-

-	//----------

-

-	BlockCipher ( void );

-	BlockCipher ( CipherMode mode );

-	virtual ~BlockCipher ( void );

-

-	virtual void clear ( void );

-

-	//----------

-	// Subclass interface

-

-	virtual int  getBlockSize ( void ) = 0;

-

-	virtual void setKey  ( void * k, int keySize ) = 0;

-

-	virtual void encrypt ( void * block, unsigned int nonce ) const = 0;

-	virtual void decrypt ( void * block, unsigned int nonce ) const = 0;

-

-	//----------

-	// Client interface

-

-	void setMode ( CipherMode m );

-

-	virtual void encrypt ( void * key, int keySize, void * plain, void * crypt, int size );

-	virtual void decrypt ( void * key, int keySize, void * crypt, void * plain, int size );

-

-	//----------

-

-private:

-

-	void encrypt_ECB  ( void );

-	void encrypt_ECBN ( void );

-	void encrypt_CBC  ( void );

-	void encrypt_CFB  ( void );

-	void encrypt_OFB  ( void );

-	void encrypt_PCBC ( void );

-	void encrypt_CTR  ( void );

-

-	void decrypt_ECB  ( void );

-	void decrypt_ECBN ( void );

-	void decrypt_CBC  ( void );

-	void decrypt_CFB  ( void );

-	void decrypt_OFB  ( void );

-	void decrypt_PCBC ( void );

-	void decrypt_CTR  ( void );

-

-	//----------

-

-	virtual void copy ( uint8_t * dst, const uint8_t * src );

-	virtual void xor  ( uint8_t * dst, const uint8_t * a, const uint8_t * b );

-

-	//----------

-

-	uint8_t  m_plain[64];

-	uint8_t  m_input[64];

-	uint8_t  m_temp[64];

-	uint8_t  m_output[64];

-	uint8_t  m_crypt[64];

-

-	int m_blockIndex;

-

-	typedef void (BlockCipher::*pFunc)(void);

-

-	pFunc m_pEncrypt;

-	pFunc m_pDecrypt;

-};

-

-//----------------------------------------------------------------------------

diff --git a/Cipher.cpp b/Cipher.cpp
deleted file mode 100644
index a1de5e6..0000000
--- a/Cipher.cpp
+++ /dev/null
@@ -1 +0,0 @@
-#include "Cipher.h"
\ No newline at end of file
diff --git a/Cipher.h b/Cipher.h
deleted file mode 100644
index 5aa4155..0000000
--- a/Cipher.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#pragma once

-

-//----------------------------------------------------------------------------

-

-class Cipher

-{

-public:

-

-	Cipher ( void ) {}

-	virtual ~Cipher ( void ) {}

-

-	virtual void encrypt ( void * key, int keySize, void * plain, void * crypt, int size ) = 0;

-	virtual void decrypt ( void * key, int keySize, void * crypt, void * plain, int size ) = 0;

-};

-

-//----------------------------------------------------------------------------

diff --git a/DictionaryTest.cpp b/DictionaryTest.cpp
deleted file mode 100644
index 56ed6df..0000000
--- a/DictionaryTest.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-#include "DictionaryTest.h"

-

-#include <intrin.h>

-

-#pragma warning(disable:4996) // fopen is unsafe

-

-

-wordlist g_words;

-int g_wordcount = 0;

-

-const char ** g_pwords = NULL;

-int * g_plengths = NULL;

-

-double g_dictoverhead = 0;

-

-//----------------------------------------------------------------------------

-

-void LoadWords ( void )

-{

-	FILE * f = fopen("allwords.txt","r");

-

-	char buffer[1024];

-

-	while(fgets(buffer,1024,f))

-	{

-		char * cursor = buffer + strlen(buffer);

-

-		while((*cursor == 0x0a) || (*cursor == 0))

-		{

-			*cursor = 0;

-			cursor--;

-		}

-

-		g_words.push_back(buffer);

-	}

-

-	fclose(f);

-

-	g_wordcount = (int)g_words.size();

-

-	printf("Loaded %d words\n",g_wordcount);

-

-	g_pwords = new const char*[g_wordcount];

-	g_plengths = new int[g_wordcount];

-

-	for(int i = 0; i < g_wordcount; i++)

-	{

-		g_pwords[i] = g_words[i].c_str();

-		g_plengths[i] = (int)g_words[i].size();

-	}

-}

-

-void DeleteWords ( void )

-{

-	delete [] g_pwords;

-	delete [] g_plengths;

-

-	g_words.clear();

-}

-

-//----------------------------------------------------------------------------

diff --git a/DictionaryTest.h b/DictionaryTest.h
deleted file mode 100644
index 2b82047..0000000
--- a/DictionaryTest.h
+++ /dev/null
@@ -1,119 +0,0 @@
-#pragma once

-

-#include "Types.h"

-#include "Stats.h" // for testkeylist_string 

-

-#include <map>

-

-void LoadWords ( void );

-void DeleteWords ( void );

-

-typedef std::vector<std::string> wordlist;

-

-extern wordlist g_words;

-extern int g_wordcount;

-extern const char ** g_pwords;

-extern int * g_plengths;

-

-//-----------------------------------------------------------------------------

-

-

-template< typename hashtype >

-double DictHashTest ( hashfunc<hashtype> hash )

-{

-	__int64 begin,end;

-

-	const int reps = 999;

-

-	double best = 1.0e90;

-

-	for(int i = 0; i < reps; i++)

-	{

-		begin = __rdtsc();

-

-		for(int i = 0; i < g_wordcount; i++)

-		{

-			const char * buffer = g_pwords[i];

-			const int len = g_plengths[i];

-

-			hash(buffer,len,0);

-		}

-

-		end = __rdtsc();

-	

-		double clocks = double(end-begin) / double(g_wordcount);

-

-		if(clocks < best) best = clocks;

-	}

-

-	return best;

-}

-

-//-----------------------------------------------------------------------------

-

-template< typename hashtype >

-void DumpCollisions ( hashfunc<hashtype> hash )

-{

-	printf("\nDumping collisions for seed 0 - \n\n");

-

-	typedef std::map<hashtype,std::vector<std::string>> hashmap;

-	hashmap hashes;

-

-	for(int i = 0; i < g_wordcount; i++)

-	{

-		hashtype h = hash(g_pwords[i],g_plengths[i],0);

-

-		hashes[h].push_back(g_pwords[i]);

-	}

-

-	int collcount = 0;

-

-	for(hashmap::iterator it = hashes.begin(); it != hashes.end(); it++)

-	{

-		hashtype hash = (*it).first;

-

-		std::vector<std::string> & strings = (*it).second;

-

-		if(strings.size() > 1)

-		{

-			collcount += (int)strings.size() - 1;

-

-			printf("0x%08x - ",hash);

-

-			for(int i = 0; i < (int)strings.size(); i++)

-			{

-				printf("%20s,",strings[i].c_str());

-			}

-

-			printf("\n");

-		}

-	}

-

-	printf("%d collisions\n",collcount);

-}

-

-//----------------------------------------------------------------------------

-

-template< typename hashtype >

-void DictionaryTest ( hashfunc<hashtype> hash )

-{

-	printf("Dictionary-based tests -\n");

-	printf("\n");

-

-	LoadWords();

-

-	double clocks = DictHashTest<hashtype>(hash);

-

-	printf("All words hashed in min %f clocks/word\n",clocks);

-	printf("\n");

-

-	printf("Testing dictionary stats\n");

-	testkeylist_string<hashtype>(hash,g_words,true,true);

-	printf("\n");

-

-	DumpCollisions(hash);

-

-	DeleteWords();

-}

-

-//-----------------------------------------------------------------------------

diff --git a/Diffusion.cpp b/Diffusion.cpp
deleted file mode 100644
index 6927daa..0000000
--- a/Diffusion.cpp
+++ /dev/null
@@ -1,204 +0,0 @@
-#include "Diffusion.h"

-

-#include "Types.h"

-

-#include <memory.h>

-

-//-----------------------------------------------------------------------------

-// check invertibility of diffusion matrix

-

-void TestDiffusionMatrix ( void )

-{

-	//int m[4] = { 3, 1, 1, 3 };

-

-	int tab[65536];

-

-	memset(tab,0,sizeof(tab));

-

-	for(int i = 0; i < 65536; i++)

-	{

-		uint8_t a1 = (uint8_t)i;

-		uint8_t a2 = (uint8_t)(i >> 8);

-

-		//uint8_t b1 = uint8_t(a1 * m[0]) + uint8_t(a2*m[1]);

-		//uint8_t b2 = uint8_t(a1 * m[2]) + uint8_t(a2*m[3]);

-

-		uint8_t b1 = a1;

-		uint8_t b2 = a2;

-

-		b1 += b2;

-		b2 += b1;

-

-		int index = (int(b1) << 8) + b2;

-

-		tab[index]++;

-	}

-

-	int missing = 0;

-

-	for(int i = 0; i < 65536; i++)

-	{

-		if(tab[i] == 0) missing++;

-	}

-

-	printf("missing - %d\n",missing);

-}

-

-//-----------------------------------------------------------------------------

-

-void add_row ( int m[16], int a, int b )

-{

-	for(int i = 0; i < 4; i++)

-	{

-		m[4*a+i] += m[4*b+i];

-	}

-}

-

-void sub_row ( int m[16], int a, int b )

-{

-	for(int i = 0; i < 4; i++)

-	{

-		m[4*a+i] -= m[4*b+i];

-	}

-}

-

-//-----------------------------------------------------------------------------

-// search through diffusion matrices computable in N operations, find ones

-// with a maximal number of odd terms

-

-bool check ( const int m[16], std::vector<int> & dst, std::vector<int> & src )

-{

-	static int best = 0;

-

-	int c = 0;

-	int s = 0;

-

-	if(abs(m[0]+m[4]+m[8]+m[12]) > 2) return false;

-	if(abs(m[1]+m[5]+m[9]+m[13]) > 2) return false;

-	if(abs(m[2]+m[6]+m[10]+m[14]) > 2) return false;

-	if(abs(m[3]+m[7]+m[11]+m[15]) > 2) return false;

-

-	for(int i = 0; i < 16; i++)

-	{

-		if(m[i] == 0) return false;

-

-		int d = abs(m[i]);

-

-		c += (d & 1);

-

-		if(m[i] < 0) s++;

-	}

-

-	if((c == 13) && (s == 8))

-	{

-		std::string g[4];

-

-		g[0] = "A";

-		g[1] = "B";

-		g[2] = "C";

-		g[3] = "D";

-

-		printf("----------\n");

-

-		for(int i = 0; i < (int)dst.size(); i++)

-		{

-			int d = dst[i];

-			int s = src[i];

-

-			std::string tmp;

-

-			tmp += g[d-1];

-

-			tmp += (s < 0) ? "-" : "+";

-

-			tmp += "(";

-			tmp += g[abs(s)-1];

-			tmp += ")";

-

-			g[d-1] = tmp;

-		}

-

-		printf("A : %s\n",g[0].c_str());

-		printf("B : %s\n",g[1].c_str());

-		printf("C : %s\n",g[2].c_str());

-		printf("D : %s\n",g[3].c_str());

-

-		for(int i = 0; i < (int)dst.size(); i++)

-		{

-			int d = dst[i];

-			int s = src[i];

-

-			if(s < 0)

-			{

-				printf("h[%1d] -= h[%1d];\n",d,-s);

-			}

-			else

-			{

-				printf("h[%1d] += h[%1d];\n",d,s);

-			}

-		}

-		printf("----------\n");

-	}

-

-	return c == 16;

-}

-

-bool difrecurse ( const int m[16], int depth, int maxdepth, int last, std::vector<int> & dst, std::vector<int> & src )

-{

-	if(depth == maxdepth)

-	{

-		return check(m,dst,src);

-	}

-

-	for(int i = 0; i < 4; i++)

-	{

-		dst.push_back(i+1);

-

-		for(int j = 0; j < 4; j++)

-		{

-			if(i == j) continue;

-

-			if(i == last) continue;

-			if(j == last) continue;

-

-			int n[16];

-

-			memcpy(n,m,sizeof(n));

-

-			src.push_back(j+1);

-			add_row(n,i,j);

-			difrecurse(n,depth+1,maxdepth,i,dst,src);

-			sub_row(n,i,j);

-			src.pop_back();

-

-			src.push_back(-(j+1));

-			sub_row(n,i,j);

-			difrecurse(n,depth+1,maxdepth,i,dst,src);

-			add_row(n,i,j);

-			src.pop_back();

-		}

-

-		dst.pop_back();

-	}

-

-	return false;

-}

-

-void findDiffuse ( void )

-{

-	int m[16];

-

-	memset(m,0,sizeof(m));

-

-	m[4*0 + 0] = 1;

-	m[4*1 + 1] = 1;

-	m[4*2 + 2] = 1;

-	m[4*3 + 3] = 1;

-

-	std::vector<int> dst;

-	std::vector<int> src;

-

-	difrecurse(m,0,7,-1,dst,src);

-	printf("\n");

-}

-

diff --git a/Diffusion.h b/Diffusion.h
deleted file mode 100644
index 7b9637e..0000000
--- a/Diffusion.h
+++ /dev/null
@@ -1 +0,0 @@
-#pragma once
\ No newline at end of file
diff --git a/FWTransform.cpp b/FWTransform.cpp
deleted file mode 100644
index cf9ed80..0000000
--- a/FWTransform.cpp
+++ /dev/null
@@ -1,443 +0,0 @@
-#include "FWTransform.h"

-

-#include "Random.h"

-

-// FWT1/2/3/4 are tested up to 2^16 against a brute-force implementation.

-

-//----------------------------------------------------------------------------

-

-double test_linear_approximation ( mixfunc<uint32_t> f, uint32_t l, uint32_t mask, int64_t size )

-{

-	int64_t d = 0;

-

-	for(int64_t i = 0; i < size; i++)

-	{

-		uint32_t x = (uint32_t)i;

-		uint32_t b1 = parity( f(x) & mask );

-		uint32_t b2 = parity( x & l );

-

-		d += (b1 ^ b2);

-	}

-

-	return double(d) / double(size);

-}

-

-//----------------------------------------------------------------------------

-// In-place, non-recursive FWT transform. Reference implementation.

-

-void FWT1 ( int * v, int64_t count )

-{

-	for(int64_t width = 2; width <= count; width *= 2)

-	{

-		int64_t blocks = count / width;

-

-		for(int64_t i = 0; i < blocks; i++)

-		{

-			int64_t ia = i * width;

-			int64_t ib = ia + (width/2);

-

-			for(int64_t j = 0; j < (width/2); j++)

-			{

-				int a = v[ia];

-				int b = v[ib];

-				

-				v[ia++] = a + b;

-				v[ib++] = a - b;

-			}

-		}

-	}

-}

-

-//-----------------------------------------------------------------------------

-// recursive, but fall back to non-recursive for tables of 4k or smaler

-

-// (this proved to be fastest)

-

-void FWT2 ( int * v, int64_t count )

-{

-	if(count <= 4*1024) return FWT1(v,(int32_t)count);

-

-	int64_t c = count/2;

-

-	for(int64_t i = 0; i < c; i++) 

-	{

-		int a = v[i];

-		int b = v[i+c];

-		

-		v[i] = a + b;

-		v[i+c] = a - b;

-	}

-

-	if(count > 2)

-	{

-		FWT2(v,c);

-		FWT2(v+c,c);

-	}

-}

-

-//-----------------------------------------------------------------------------

-// fully recursive (slow)

-

-void FWT3 ( int * v, int64_t count )

-{

-	int64_t c = count/2;

-

-	for(int64_t i = 0; i < c; i++) 

-	{

-		int a = v[i];

-		int b = v[i+c];

-		

-		v[i] = a + b;

-		v[i+c] = a - b;

-	}

-

-	if(count > 2)

-	{

-		FWT3(v,c);

-		FWT3(v+c,c);

-	}

-}

-

-//----------------------------------------------------------------------------

-// some other method

-

-void FWT4 ( int * data, const int64_t count )

-{

-	int nbits = 0;

-

-	for(int64_t c = count; c; c >>= 1) nbits++;

-

-	for (int i = 0; i < nbits; i++)

-	{

-		int64_t block = (int64_t(1) << i);

-		int64_t half  = (int64_t(1) << (i-1));

-

-		for (int64_t j = 0; j < count; j += block)

-		{

-			for (int k = 0; k < half; ++k)

-			{

-				int64_t ia = j+k;

-				int64_t ib = j+k+half;

-

-				int a = data[ia];

-				int b = data[ib];

-

-				data[ia] = a+b;

-				data[ib] = a-b;

-			}

-		}

-	}

-}

-

-//----------------------------------------------------------------------------

-// Evaluate a single point in the FWT hierarchy

-

-/*

-int FWTPoint ( mixfunc<uint32_t> f, int level, int nbits, uint32_t y )

-{

-	if(level == 0)

-	{

-		return f(y);

-	}

-	else

-	{

-		uint32_t mask = 1 << (nbits - level);

-

-		if(y & mask)

-		{

-			return 

-		}

-	}

-}

-*/

-

-

-//----------------------------------------------------------------------------

-// compute 2 tiers down into FWT, so we can break a table up into 4 chunks

-

-int computeWalsh2 ( mixfunc<uint32_t> f, int64_t y, int bits, uint32_t mask )

-{

-	uint32_t size1 = 1 << (bits-1);

-	uint32_t size2 = 1 << (bits-2);

-

-	int a = parity(f((uint32_t)y        ) & mask) ? 1 : -1;

-	int b = parity(f((uint32_t)y ^ size2) & mask) ? 1 : -1;

-

-	int ab = (y & size2) ? b-a : a+b;

-

-	int c = parity(f((uint32_t)y ^ size1        ) & mask) ? 1 : -1;

-	int d = parity(f((uint32_t)y ^ size1 ^ size2) & mask) ? 1 : -1;

-

-	int cd = (y & size2) ? d-c : c+d;

-

-	int e = (y & size1) ? cd-ab : ab+cd;

-

-	return e;

-}

-

-int computeWalsh2 ( int * func, int64_t y, int bits )

-{

-	uint32_t size1 = 1 << (bits-1);

-	uint32_t size2 = 1 << (bits-2);

-

-	int a = parity((uint32_t)func[(uint32_t)y        ]) ? 1 : -1;

-	int b = parity((uint32_t)func[(uint32_t)y ^ size2]) ? 1 : -1;

-

-	int ab = (y & size2) ? b-a : a+b;

-

-	int c = parity((uint32_t)func[(uint32_t)y ^ size1        ]) ? 1 : -1;

-	int d = parity((uint32_t)func[(uint32_t)y ^ size1 ^ size2]) ? 1 : -1;

-

-	int cd = (y & size2) ? d-c : c+d;

-

-	int e = (y & size1) ? cd-ab : ab+cd;

-

-	return e;

-}

-

-//----------------------------------------------------------------------------

-// this version computes the entire table at once - needs 16 gigs of RAM for

-// 32-bit FWT (!!!)

-

-void find_linear_approximation_walsh ( mixfunc<uint32_t> f, uint32_t mask, int inbits, uint32_t & outL, int64_t & outBias )

-{

-	// create table

-

-	const int64_t count = int64_t(1) << inbits;

-

-	int * table = new int[(int)count];

-

-	// fill table

-

-	for(int64_t i = 0; i < count; i++)

-	{

-		table[i] = parity(f((uint32_t)i) & mask) ? 1 : -1;

-	}

-

-	// apply walsh transform

-

-	FWT1(table,count);

-

-	// find maximum value in transformed table, which corresponds

-	// to closest linear approximation to F

-

-	outL = 0;

-	outBias = 0;

-

-	for(unsigned int l = 0; l < count; l++)

-	{

-		if(abs(table[l]) > outBias)

-		{

-			outBias = abs(table[l]);

-			outL = l;

-		}

-	}

-

-	delete [] table;

-}

-

-//-----------------------------------------------------------------------------

-// this version breaks the task into 4 pieces, or 4 gigs of RAM for 32-bit FWT

-

-void find_linear_approximation_walsh2 ( mixfunc<uint32_t> f, uint32_t mask, int inbits, uint32_t & outL, int64_t & outBias )

-{

-	const int64_t count = int64_t(1) << inbits;

- 	const int64_t stride = count/4;

-

-	int * table2 = new int[(int)stride];

-

-	uint32_t worstL = 0;

-	int64_t worstBias = 0;

-

-	for(int64_t j = 0; j < count; j += stride)

-	{

-		printf(".");

-

-		for(int i = 0; i < stride; i++)

-		{

-			table2[i] = computeWalsh2(f,i+j,inbits,mask);

-		}

-

-		FWT2(table2,stride);

-

-		for(int64_t l = 0; l < stride; l++)

-		{

-			if(abs(table2[l]) > worstBias)

-			{

-				worstBias = abs(table2[l]);

-				worstL = uint32_t(l)+uint32_t(j);

-			}

-		}

-	}

-

-	outBias = worstBias/2;

-	outL = worstL;

-

-	delete [] table2;

-}

-

-

-//----------------------------------------------------------------------------

-

-void printtab ( int * tab, int size )

-{

-	for(int j = 0; j < 16; j++)

-	{

-		printf("[");

-		for(int i = 0; i < (size/16); i++)

-		{

-			printf("%3d ",tab[j*16+i]);

-		}

-		printf("]\n");

-	}

-}

-

-void comparetab ( int * tabA, int * tabB, int size )

-{

-	bool fail = false;

-

-	for(int i = 0; i < size; i++)

-	{

-		if(tabA[i] != tabB[i])

-		{

-			fail = true;

-			break;

-		}

-	}

-

-	printf(fail ? "X" : "-");

-}

-

-void testFWT ( void )

-{

-	const int bits = 12;

-	const int size = (1 << bits);

-

-	int * func = new int[size];

-	int * resultA = new int[size];

-	int * resultB = new int[size];

-

-	for(int rep = 0; rep < 1; rep++)

-	{

-		// Generate a random boolean function

-

-		for(int i = 0; i < size; i++)

-		{

-			func[i] = rand_u32() & 1;

-

-			//func[i] = (i ^ (i >> 2)) & 1;

-		}

-

-		//printf("Input boolean function -\n");

-		//printtab(func);

-		//printf("\n");

-

-		// Test against all 256 linear functions

-

-

-		memset(resultA,0,size * sizeof(int));

-

-		//printf("Result - \n");

-		for(uint32_t linfunc = 0; linfunc < size; linfunc++)

-		{

-			resultA[linfunc] = 0;

-

-			for(uint32_t k = 0; k < size; k++)

-			{

-				int b1 = func[k];

-				int b2 = parity( k & linfunc );

-

-				if(b1 == b2) resultA[linfunc]++;

-			}

-

-			resultA[linfunc] -= (size/2);

-		}

-

-		//printtab(resultA);

-		//printf("\n");

-

-

-		// Test with FWTs

-

-		for(int i = 0; i < size; i++) resultB[i] = (func[i] == 0) ? -1 : 1;

-		FWT1(resultB,size);

-		for(int i = 0; i < size; i++) resultB[i] = -resultB[i]/2;

-		comparetab(resultA,resultB,size);

-

-		for(int i = 0; i < size; i++) resultB[i] = (func[i] == 0) ? -1 : 1;

-		FWT2(resultB,size);

-		for(int i = 0; i < size; i++) resultB[i] = -resultB[i]/2;

-		comparetab(resultA,resultB,size);

-

-		for(int i = 0; i < size; i++) resultB[i] = (func[i] == 0) ? -1 : 1;

-		FWT3(resultB,size);

-		for(int i = 0; i < size; i++) resultB[i] = -resultB[i]/2;

-		comparetab(resultA,resultB,size);

-

-		// Test with subdiv-by-4

-

-		{

-			for(int i = 0; i < size; i++) resultB[i] = (func[i] == 0) ? -1 : 1;

-

-			const int64_t count = int64_t(1) << bits;

-			const int64_t stride = count/4;

-

-			for(int64_t j = 0; j < count; j += stride)

-			{

-				for(int i = 0; i < stride; i++)

-				{

-					resultB[i+j] = computeWalsh2(func,i+j,bits);

-				}

-

-				FWT2(&resultB[j],stride);

-			}

-

-			for(int i = 0; i < size; i++) resultB[i] = -resultB[i]/2;

-			comparetab(resultA,resultB,size);

-		}

-

-		printf(" ");

-	}

-

-	delete [] func;

-	delete [] resultA;

-	delete [] resultB;

-}

-

-//-----------------------------------------------------------------------------

-// Compare known-good implementation against optimized implementation

-

-void testFWT2 ( void )

-{

-	const int bits = 24;

-	const int size = (1 << bits);

-

-	int * func = new int[size];

-	int * resultA = new int[size];

-	int * resultB = new int[size];

-

-	for(int rep = 0; rep < 4; rep++)

-	{

-		// Generate a random boolean function

-

-		for(int i = 0; i < size; i++)

-		{

-			func[i] = rand_u32() & 1;

-		}

-

-		// Test with FWTs

-

-		for(int i = 0; i < size; i++) resultA[i] = resultB[i] = (func[i] == 0) ? -1 : 1;

-

-		FWT1(resultA,size);

-		FWT4(resultB,size);

-		

-		comparetab(resultA,resultB,size);

-

-		printf(" ");

-	}

-

-	delete [] func;

-	delete [] resultA;

-	delete [] resultB;

-}
\ No newline at end of file
diff --git a/FWTransform.h b/FWTransform.h
deleted file mode 100644
index 6979cbd..0000000
--- a/FWTransform.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#include "Types.h"

-#include "Bitvec.h"

-

-// Fast Walsh transform stuff. Used for determining how close an arbitrary

-// boolean function is to the set of all possible linear functions.

-

-// Given an arbitrary N-bit mixing function mix(x), we can generate a boolean

-// function out of it by choosing a N-bit mask and computing

-// parity(mix(x) & mask).

-

-// If the mask has 1 bit set, this is equivalent to selecting a column of

-// output bits from the mixing function to test.

diff --git a/Hamming.cpp b/Hamming.cpp
deleted file mode 100644
index e00e5b7..0000000
--- a/Hamming.cpp
+++ /dev/null
@@ -1,133 +0,0 @@
-#include "Hamming.h"

-

-#include "Types.h"

-#include "Random.h"

-

-// Code to measure the hamming weight of mix functions, etc.

-

-// (documentation needed)

-

-// If I change N bits of the input, how many bits of the output change on average?

-

-

-//-----------------------------------------------------------------------------

-// compute table of differential hamming weight for input differentials

-// up to 5 bits

-

-void hamtest ( uint32_t (*mix)(uint32_t), uint32_t d, const int reps, double out[33] )

-{

-	double temp[33];

-

-	memset(temp,0,sizeof(temp));

-

-	for(int i = 0; i < reps; i++)

-	{

-		uint32_t a = rand_u32();

-		uint32_t b = a ^ d;

-

-		uint32_t ma = mix(a);

-		uint32_t mb = mix(b);

-

-		uint32_t md = ma ^ mb;

-

-		temp[popcount(md)] += 1.0 / double(reps);

-	}

-

-	for(int i = 0; i < 33; i++)

-	{

-		if(temp[i] > out[i]) out[i] = temp[i];

-	}

-}

-

-void SparseDiffHamming32 ( uint32_t (*mix)(uint32_t), double accum[33] )

-{

-	uint32_t d = 0;

-

-	memset(accum,0,sizeof(accum));

-

-	//const double c32_1 = 32;

-	//const double c32_2 = 496;

-	//const double c32_3 = 4960;

-	//const double c32_4 = 35960;

-	//const double c32_5 = 201376;

-	//const double c32[5] = { c32_1, c32_2, c32_3, c32_4, c32_5 };

-

-	const int reps = 1000;

-

-	double temp[6][33];

-

-	for(int i = 0; i < 6; i++)

-	{

-		memset(temp[i],0,33 * sizeof(double));

-	}

-

-	for(int i = 0; i < 32; i++)

-	{

-		d ^= (1 << i);

-		hamtest(mix,d,reps,temp[1]);

-

-		for(int j = i+1; j < 32; j++)

-		{

-			d ^= (1 << j);

-			hamtest(mix,d,reps,temp[2]);

-

-			for(int k = j+1; k < 32; k++)

-			{

-				d ^= (1 << k);

-				hamtest(mix,d,reps,temp[3]);

-

-				for(int l = k+1; l < 32; l++)

-				{

-					d ^= (1 << l);

-					hamtest(mix,d,reps,temp[4]);

-

-					//for(int m = l+1; m < 32; m++)

-					//{

-					//	d ^= (1 << m);

-					//	hamtest(mix,d,reps,temp[5]);

-					//

-					//	d ^= (1 << m);

-					//}

-

-					d ^= (1 << l);

-				}

-				d ^= (1 << k);

-			}

-			d ^= (1 << j);

-		}

-		d ^= (1 << i);

-	}

-

-	for(int i = 0; i < 33; i++)

-	{

-		accum[i] = 0;

-	}

-

-	for(int j = 0; j < 33; j++)

-	{

-		for(int i = 0; i < 6; i++)

-		{

-			if((i+j) >= 33) continue;

-

-			double t = temp[i][j];

-

-			if(t > accum[i+j]) accum[i+j] = t;

-		}

-	}

-

-	for(int i = 0; i < 33; i++)

-	{

-		accum[i] *= 100;

-	}

-}

-

-bool hamless ( int count, double * a, double * b )

-{

-	for(int i = 0; i < count; i++)

-	{

-		if(a[i] < b[i]) return true;

-		if(a[i] > b[i]) return false;

-	}

-

-	return false;

-}

diff --git a/Hamming.h b/Hamming.h
deleted file mode 100644
index a372925..0000000
--- a/Hamming.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#pragma once

-#include "Types.h"

-

-void SparseDiffHamming32 ( uint32_t (*mix)(uint32_t), double accum[33] );

-bool hamless ( int count, double * a, double * b );
\ No newline at end of file
diff --git a/Junk.cpp b/Junk.cpp
deleted file mode 100644
index 62e700c..0000000
--- a/Junk.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-#include "Junk.h"

-

-#include "Random.h"

-

-//-----------------------------------------------------------------------------

-// Given a 64->32 bit compression function and a set of differentials, compute

-// the number of collisions

-

-typedef uint32_t (*pfCompress32) ( uint64_t x );

-

-int TestCompress ( pfCompress32 comp, std::vector<uint64_t> & diffs, const int reps )

-{

-	int total = 0;

-

-	for(int j = 0; j < (int)diffs.size(); j++)

-	{

-		uint64_t d = diffs[j];

-

-		int collisions = 0;

-

-		for(int i = 0; i < reps; i++)

-		{

-			uint64_t a = rand_u64();

-			uint64_t b = a ^ d;

-

-			uint32_t ca = comp(a);

-			uint32_t cb = comp(b);

-

-			if(ca == cb) collisions++;

-		}

-

-		if(collisions > 1) total += collisions;

-	}

-

-	return total;

-}

-

-//-----------------------------------------------------------------------------

diff --git a/Junk.h b/Junk.h
deleted file mode 100644
index a4fc5fd..0000000
--- a/Junk.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#include "Types.h"

-

-//-----------------------------------------------------------------------------

-

-template < typename mixtype >

-void calcMixBias ( mixtype (*mix)(mixtype), std::vector<int>& bins, int reps )

-{

-	const int inbits  = sizeof(mixtype) * 8;

-	const int outbits = sizeof(mixtype) * 8;

-

-	mixtype K,A,B,C;

-

-	for(int irep = 0; irep < reps; irep++)

-	{

-		rand_t(K);

-

-		A = mix(K);

-

-		for(int iBit = 0; iBit < inbits; iBit++)

-		{

-			B = mix(K ^ (mixtype(1) << iBit));

-

-			C = A ^ B;

-

-			for(int iOut = 0; iOut < outbits; iOut++)

-			{

-				bins[(iBit*outbits) + iOut] += (C >> iOut) & 1;

-			}

-		}

-	}

-}

-

-//----------

-

-template < typename mixtype >

-double calcMixBias ( mixtype (*mix)(mixtype), int reps )

-{

-	const int bits = sizeof(mixtype) * 8;

-	std::vector<int> bins(bits*bits);

-

-	calcMixBias<mixtype>(mix,bins,reps);

-

-	return maxBias(bins,reps);

-}

-

-//-----------------------------------------------------------------------------

diff --git a/SMHasher.vcproj b/SMHasher.vcproj
index 0c553f0..ab2b022 100644
--- a/SMHasher.vcproj
+++ b/SMHasher.vcproj
@@ -320,50 +320,6 @@
 	</References>

 	<Files>

 		<Filter

-			Name="Crypto"

-			>

-			<File

-				RelativePath=".\BlockCipher.cpp"

-				>

-			</File>

-			<File

-				RelativePath=".\BlockCipher.h"

-				>

-			</File>

-			<File

-				RelativePath=".\Cipher.cpp"

-				>

-			</File>

-			<File

-				RelativePath=".\Cipher.h"

-				>

-			</File>

-			<File

-				RelativePath=".\StreamCipher.cpp"

-				>

-			</File>

-			<File

-				RelativePath=".\StreamCipher.h"

-				>

-			</File>

-			<File

-				RelativePath=".\TEA.cpp"

-				>

-			</File>

-			<File

-				RelativePath=".\TEA.h"

-				>

-			</File>

-			<File

-				RelativePath=".\XTEA.cpp"

-				>

-			</File>

-			<File

-				RelativePath=".\XTEA.h"

-				>

-			</File>

-		</Filter>

-		<Filter

 			Name="Hashes"

 			>

 			<File

@@ -447,14 +403,6 @@
 				>

 			</File>

 			<File

-				RelativePath=".\DictionaryTest.cpp"

-				>

-			</File>

-			<File

-				RelativePath=".\DictionaryTest.h"

-				>

-			</File>

-			<File

 				RelativePath=".\DifferentialTest.cpp"

 				>

 			</File>

@@ -507,10 +455,6 @@
 				>

 			</File>

 			<File

-				RelativePath=".\simplex.cpp"

-				>

-			</File>

-			<File

 				RelativePath=".\Stats.cpp"

 				>

 			</File>

@@ -527,50 +471,6 @@
 				>

 			</File>

 		</Filter>

-		<Filter

-			Name="Junk"

-			>

-			<File

-				RelativePath=".\Diffusion.cpp"

-				>

-			</File>

-			<File

-				RelativePath=".\Diffusion.h"

-				>

-			</File>

-			<File

-				RelativePath=".\FWTransform.cpp"

-				>

-			</File>

-			<File

-				RelativePath=".\FWTransform.h"

-				>

-			</File>

-			<File

-				RelativePath=".\Hamming.cpp"

-				>

-			</File>

-			<File

-				RelativePath=".\Hamming.h"

-				>

-			</File>

-			<File

-				RelativePath=".\Junk.cpp"

-				>

-			</File>

-			<File

-				RelativePath=".\Junk.h"

-				>

-			</File>

-			<File

-				RelativePath=".\SimAnneal.cpp"

-				>

-			</File>

-			<File

-				RelativePath=".\SimAnneal.h"

-				>

-			</File>

-		</Filter>

 		<File

 			RelativePath=".\main.cpp"

 			>

@@ -579,10 +479,6 @@
 			RelativePath=".\pstdint.h"

 			>

 		</File>

-		<File

-			RelativePath=".\scratch.cpp"

-			>

-		</File>

 	</Files>

 	<Globals>

 	</Globals>

diff --git a/SimAnneal.cpp b/SimAnneal.cpp
deleted file mode 100644
index 0096598..0000000
--- a/SimAnneal.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-#include "SimAnneal.h"

-

-#include "Types.h"

-#include "Random.h"

-

-//-----------------------------------------------------------------------------

-// Pseudo-simulated-annealing

-

-double SimAnneal ( void * block, int len, pfFitness fit, pfDump dump, int nFlip, int reps )

-{

-	double baseScore = fit(block,len);

-	double tempScore = 0;

-	double bestScore = 0;

-

-	uint8_t * baseBlock = new uint8_t[len];

-	uint8_t * tempBlock = new uint8_t[len];

-	uint8_t * bestBlock = new uint8_t[len];

-

-	memcpy(baseBlock,block,len);

-	memcpy(tempBlock,block,len);

-	memcpy(bestBlock,block,len);

-

-	while(nFlip)

-	{

-		printf("fit - %f, bits - %2d, dump - ",baseScore,nFlip);

-

-		dump(baseBlock,len);

-

-		bestScore = baseScore;

-

-		if(nFlip == 1)

-		{

-			for(int i = 0; i < len*8; i++)

-			{

-				printf(".");

-

-				memcpy(tempBlock,baseBlock,len);

-				flipbit(tempBlock,len,i);

-

-				tempScore = fit(tempBlock,len);

-

-				if(tempScore > bestScore)

-				{

-					bestScore = tempScore;

-					memcpy(bestBlock,tempBlock,len);

-					break;

-				}

-			}

-		}

-		else

-		{

-			for(int i = 0; i < reps; i++)

-			{

-				//if(i % (reps/10) == 0) printf(".");

-				printf(".");

-

-				memcpy(tempBlock,baseBlock,len);

-

-				for(int i = 0; i < nFlip; i++)

-				{

-					flipbit( tempBlock, len, rand_u32() % (len*8) );

-				}

-

-				tempScore = fit(tempBlock,len);

-

-				if(tempScore > bestScore)

-				{

-					bestScore = tempScore;

-					memcpy(bestBlock,tempBlock,len);

-					break;

-				}

-			}

-		}

-

-		printf("\n");

-

-		// If we found a better solution, expand space starting from that solution

-		// Otherwise, shrink space around previous best

-

-		if(bestScore > baseScore)

-		{

-			memcpy(baseBlock,bestBlock,len);

-			baseScore = bestScore;

-

-			nFlip++;

-		}

-		else

-		{

-			nFlip--;

-		}

-	}

-

-	memcpy(block,baseBlock,len);

-	return baseScore;

-}

-

-

diff --git a/SimAnneal.h b/SimAnneal.h
deleted file mode 100644
index 1670bbe..0000000
--- a/SimAnneal.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#pragma once

-

-typedef double (*pfFitness) ( void * block, int len );

-typedef void   (*pfDump)    ( void * block, int len );

-

-double SimAnneal ( void * block, int len, pfFitness fit, pfDump dump, int nFlip, int reps );
\ No newline at end of file
diff --git a/StreamCipher.cpp b/StreamCipher.cpp
deleted file mode 100644
index bf9f620..0000000
--- a/StreamCipher.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-#include "StreamCipher.h"

-

-//----------------------------------------------------------------------------

-

-StreamCipher::StreamCipher ( void )

-{

-}

-

-StreamCipher::~StreamCipher ( void )

-{

-}

-

-//----------------------------------------------------------------------------

diff --git a/StreamCipher.h b/StreamCipher.h
deleted file mode 100644
index b78e4db..0000000
--- a/StreamCipher.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#pragma once

-#include "Cipher.h"

-

-//----------------------------------------------------------------------------

-

-class StreamCipher : public Cipher

-{

-public:

-

-	StreamCipher ( void );

-	virtual ~StreamCipher ( void );

-

-	virtual void encrypt ( void * k, int keySize, void * p, void * c, int size ) = 0;

-	virtual void decrypt ( void * k, int keySize, void * c, void * p, int size ) = 0;

-};

-

-//----------------------------------------------------------------------------

diff --git a/TEA.cpp b/TEA.cpp
deleted file mode 100644
index a84d688..0000000
--- a/TEA.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-#include "TEA.h"

-

-#include <memory.h>

-#include <algorithm>

-

-// The TEA algorithm is public domain

-

-//-----------------------------------------------------------------------------

-

-void TEACipher::setKey ( void * key, int keySize )

-{

-	memset(m_key,0,16);

-	memcpy(m_key,key,std::min(keySize,16));

-}

-

-//----------------------------------------------------------------------------

-

-void TEACipher::encrypt ( void * block, unsigned int /*nonce*/ ) const

-{

-	unsigned int * v = (unsigned int*)block;

-	unsigned int * k = (unsigned int*)m_key;

-

-	unsigned int sum   = 0;

-	unsigned int delta = 0x9E3779B9;

-

-	for( int i = 0; i < 32; i++ )

-	{

-		sum += delta;

-		v[0] += ((v[1]<<4) + k[0]) ^ (v[1] + sum) ^ ((v[1]>>5) + k[1]);

-		v[1] += ((v[0]<<4) + k[2]) ^ (v[0] + sum) ^ ((v[0]>>5) + k[3]);

-	}

-}

-

-//----------

-

-void TEACipher::decrypt ( void * block, unsigned int /*nonce*/ ) const

-{

-	unsigned int * v = (unsigned int*)block;

-	unsigned int * k = (unsigned int*)m_key;

-

-	unsigned int sum   = 0xC6EF3720;

-	unsigned int delta = 0x9E3779B9;

-

-	for( int i = 0; i < 32; i++ )

-	{

-		v[1] -= ((v[0]<<4) + k[2]) ^ (v[0] + sum) ^ ((v[0]>>5) + k[3]);

-		v[0] -= ((v[1]<<4) + k[0]) ^ (v[1] + sum) ^ ((v[1]>>5) + k[1]);

-		sum -= delta;

-	}

-}

-

-//----------------------------------------------------------------------------

diff --git a/TEA.h b/TEA.h
deleted file mode 100644
index fff63f1..0000000
--- a/TEA.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#pragma once

-

-#include "BlockCipher.h"

-

-//----------------------------------------------------------------------------

-

-class TEACipher : public BlockCipher

-{

-public:

-

-	int getBlockSize ( void ) { return 8; }

-

-	void setKey  ( void * key, int keySize );

-

-	void encrypt ( void * block, unsigned int nonce ) const;

-	void decrypt ( void * block, unsigned int nonce ) const;

-

-protected:

-

-	uint32_t m_key[4];

-};

-

-//----------------------------------------------------------------------------

diff --git a/Tests.h b/Tests.h
index 975b454..05486af 100644
--- a/Tests.h
+++ b/Tests.h
@@ -9,7 +9,6 @@
 #include "AvalancheTest.h"

 #include "CycleTest.h"

 #include "DifferentialTest.h"

-#include "DictionaryTest.h"

 

 //-----------------------------------------------------------------------------

 

diff --git a/XTEA.cpp b/XTEA.cpp
deleted file mode 100644
index 3ec3591..0000000
--- a/XTEA.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-#include "XTEA.h"

-

-#include <algorithm>

-

-static const int g_rounds = 64;

-

-// The XTEA and BTEA algorithms are public domain

-

-//----------------------------------------------------------------------------

-

-void XTEACipher::setKey ( void * key, int keySize )

-{

-	memset(m_key,0,16);

-	memcpy(m_key,key,std::min(keySize,16));

-}

-

-//----------------------------------------------------------------------------

-

-void XTEACipher::encrypt ( void * block, unsigned int nonce ) const

-{

-	uint32_t * v = (uint32_t*)block;

-	uint32_t * k = (uint32_t*)m_key;

-

-	uint32_t delta = 0x9E3779B9;

-	uint32_t sum = 0;

-

-	v[0] ^= nonce;

-

-	for(int i = 0; i < g_rounds; i++)

-	{

-		v[0] += (((v[1] << 4) ^ (v[1] >> 5)) + v[1]) ^ (sum + k[sum & 3]);

-	    

-		sum += delta;

-	    

-		v[1] += (((v[0] << 4) ^ (v[0] >> 5)) + v[0]) ^ (sum + k[(sum>>11) & 3]);

-	}

-}

-

-//----------

-

-void XTEACipher::decrypt ( void * block, unsigned int nonce ) const

-{

-	uint32_t * v = (uint32_t*)block;

-	uint32_t * k = (uint32_t*)m_key;

-

-	uint32_t delta = 0x9E3779B9;

-	uint32_t sum = delta * g_rounds;

-

-	for(int i = 0; i < g_rounds; i++)

-	{

-		v[1] -= (((v[0] << 4) ^ (v[0] >> 5)) + v[0]) ^ (sum + k[(sum>>11) & 3]);

-	    

-		sum -= delta;

-	    

-		v[0] -= (((v[1] << 4) ^ (v[1] >> 5)) + v[1]) ^ (sum + k[sum & 3]);

-	}

-

-	v[0] ^= nonce;

-}

-

-//----------------------------------------------------------------------------

-

-#define DELTA 0x9e3779b9

-#define MX ((z>>5^y<<2) + (y>>3^z<<4)) ^ ((sum^y) + (k[(p&3)^e] ^ z));

-

-void btea ( unsigned int *v, int n, unsigned int const k[4]) 

-{

-	const int rounds = 6 + (52/n);

-	unsigned int sum = 0;

-

-	unsigned int y = 0;

-	unsigned int z = v[n-1];

-

-	for(int round = 0; round < rounds; round++)

-	{

-		sum += DELTA;

-		unsigned int e = (sum >> 2) & 3;

-

-		int p;

-

-		for( p=0; p < n-1; p++ )

-		{

-			y = v[p+1];

-			z = v[p] += MX;

-		}

-		

-		y = v[0];

-		z = v[n-1] += MX;

-	} 

-}

-

-void btea_decrypt ( unsigned int *v, int n, unsigned int const k[4]) 

-{

-	const int rounds = 6 + (52/n);

-	unsigned int sum = rounds*DELTA;

-

-	unsigned int y = v[0];

-	unsigned int z = 0;

-

-	for(int round = 0; round < rounds; round++)

-	{

-		unsigned int e = (sum >> 2) & 3;

-		

-		int p;

-

-		for( p = n-1; p > 0; p-- )

-		{

-			z = v[p-1];

-			y = v[p] -= MX;

-		}

-		

-		z = v[n-1];

-		y = v[0] -= MX;

-

-		sum -= DELTA;

-	} 

-}

-

-//----------------------------------------------------------------------------

diff --git a/XTEA.h b/XTEA.h
deleted file mode 100644
index 770248f..0000000
--- a/XTEA.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#pragma once

-

-#include "BlockCipher.h"

-

-//----------------------------------------------------------------------------

-

-class XTEACipher : public BlockCipher

-{

-public:

-

-	int getBlockSize ( void ) { return 8; }

-

-	void setKey  ( void * key, int keySize );

-

-	void encrypt ( void * block, unsigned int nonce ) const;

-	void decrypt ( void * block, unsigned int nonce ) const;

-

-protected:

-

-	uint32_t m_key[4];

-};

-

-//----------------------------------------------------------------------------

diff --git a/main.cpp b/main.cpp
index 658f668..1f6e136 100644
--- a/main.cpp
+++ b/main.cpp
@@ -56,7 +56,6 @@
 

 	SparseKeyTest(hash,false);

 

-	//DictionaryTest(hash);

 	//BitrangeKeysetTest(hash,false);

 	//TextKeyTest(hash.m_hash);

 }

@@ -71,14 +70,6 @@
 

 	int a = clock();

 

-#if 0

-

-	optimize_fmix64();

-

-	//scratchmain();

-

-#else

-

 	//----------

 

 	//test<uint32_t>  ( md5_32,  "MD5, first 32 bits" );

@@ -96,8 +87,6 @@
 

 	//test<uint32_t>  ( MurmurHash3x64_32,  "MurmurHash3 32-bit" );

 

-#endif

-

 	int b = clock();

 

 	printf("time %d\n",b-a);

diff --git a/scratch.cpp b/scratch.cpp
deleted file mode 100644
index 0043966..0000000
--- a/scratch.cpp
+++ /dev/null
@@ -1,823 +0,0 @@
-#include <stdio.h>

-#include <tchar.h>

-

-#include "Types.h"

-#include "Stats.h"

-#include "Tests.h"

-#include "Hamming.h"

-#include "Junk.h"

-#include "SimAnneal.h"

-

-#include <vector>

-#include <set>

-#include <map>

-#include <math.h>

-#include <intrin.h>

-

-#pragma warning(disable : 4702)

-

-//-----------------------------------------------------------------------------

-

-template < int nbits > 

-void printkey ( Blob<nbits> & k )

-{

-	int nbytes = nbits/8;

-

-	printf("{");

-

-	uint8_t * d = (uint8_t*)&k;

-

-	for(int i = 0; i < nbytes; i++)

-	{

-		printf("0x%02x,",d[i]);

-	}

-	printf("};\n");

-}

-

-

-//-----------------------------------------------------------------------------

-// Test code for Murmur3's mix function

-

-/*

-uint32_t i1 = 0x95543787;

-uint32_t i2 = 0x2ad7eb25;

-

-uint32_t m1 = 9;

-uint32_t a1 = 0x273581d8;

-

-uint32_t m2 = 5;

-uint32_t a2 = 0xee700bac;

-

-uint32_t m3 = 3;

-uint32_t a3 = 0xa6b84e31;

-

-uint32_t r1 = 5;

-

-int stage = 0;

-

-uint32_t m3mix ( uint32_t k )

-{

-	//return rand_u32();

-

-	uint32_t h = 0x971e137b;

-	uint32_t c1 = i1;

-	uint32_t c2 = i2;

-

-	for(int i = 0; i < stage; i++)

-	{

-		h   = h*m3+a3;

-		c1  = c1*m1+a1;

-		c2  = c2*m2+a2;

-	}

-

-	k  *= c1;

-	k   = _rotl(k,r1);

-	h   = h*m3+a3;

-	k  *= c2;

-	c1  = c1*m1+a1;

-	c2  = c2*m2+a2;

-	h  ^= k;

-

-	return h;

-}

-*/

-

-/*

-uint32_t m1 = 0x85ebca6b;

-uint32_t m2 = 0xc2b2ae35;

-uint32_t m3 = 0x893ed583;

-

-int s1 = 16;

-int s2 = 13;

-int s3 = 16;

-

-uint32_t fmix ( uint32_t k )

-{

-	return rand_u32();

-

-	k ^= k >> 16;

-	k *= 0x85ebca6b;

-	k ^= k >> 13;

-	k *= 0xc2b2ae35;

-	k ^= k >> 16;

-

-	return k;

-}

-*/

-

-//-----------------------------------------------------------------------------

-

-/*

-struct mixconfig

-{

-	uint32_t m1;

-	uint32_t m2;

-};

-

-mixconfig mc = 

-{

-	0x010d5a2d,

-	0xd3636b39,

-};

-

-uint32_t fmix32 ( uint32_t k )

-{

-	//return rand_u32();

-

-	k ^= k >> 16;

-	k *= mc.m1;

-	k ^= k >> 16;

-	k *= mc.m2;

-	k ^= k >> 16;

-

-	return k;

-}

-

-double mixfit ( void * block, int )

-{

-	mixconfig * pc = (mixconfig*)block;

-

-	mc.m1 = pc->m1 | 1;

-	mc.m2 = pc->m2 | 1;

-

-	Stats s = testMixAvalanche<uint32_t>(mixfunc<uint32_t>(blahmix),2000000);

-

-	return 1.0 - s.m_max;

-}

-

-void mixdump ( void * block, int )

-{

-	mixconfig * pc = (mixconfig*)block;

-

-	printf("0x%08x 0x%08x",pc->m1, pc->m2 );

-}

-*/

-

-//-----------------------------------------------------------------------------

-// SimAnneal optimize of fmix64

-

-struct mixconfig

-{

-	//uint8_t s1;

-	uint64_t m1;

-	//uint8_t s2;

-	uint64_t m2;

-	//uint8_t s3;

-};

-

-mixconfig mc = { 0xff51afd7ed558ccd, 0xc4ceb9fe1a85ec53 };

-

-uint64_t fmix64_test ( uint64_t k )

-{

-	k ^= k >> 33;

-	//k ^= k >> mc.s1;

-

-	k *= mc.m1;

-

-	k ^= k >> 33;

-	//k ^= k >> mc.s2;

-

-	k *= mc.m2;

-

-	k ^= k >> 33;

-	//k ^= k >> mc.s3;

-

-	return k;

-}

-

-double fmix64_fit ( void * block, int )

-{

-	mixconfig * pc = (mixconfig*)block;

-

-	mc.m1 = pc->m1 | 1;

-	mc.m2 = pc->m2 | 1;

-

-	//mc.s1 = pc->s1 & 63;

-	//mc.s2 = pc->s1 & 63;

-	//mc.s3 = pc->s1 & 63;

-

-	double bias = calcMixBias<uint64_t>(fmix64_test,50000000);

-

-	return 1.0 - bias;

-}

-

-void fmix64_dump ( void * block, int )

-{

-	mixconfig * pc = (mixconfig*)block;

-

-	//pc->s1 &= 63;

-	//pc->s2 &= 63;

-	//pc->s3 &= 63;

-

-	//printf("{ %2d, 0x%016I64x, %2d, 0x%016I64x, %2d }; ",pc->s1, pc->m1, pc->s2, pc->m2, pc->s3 );

-	printf("{ 0x%016I64x, 0x%016I64x }; ", pc->m1, pc->m2 );

-}

-

-uint32_t fmix32_test ( uint32_t h )

-{

-	h ^= h >> 16;

-	h *= 0x85ebca6b;

-	h ^= h >> 13;

-	h *= 0xc2b2ae35;

-	h ^= h >> 16;

-

-	return h;

-}

-

-void optimize_fmix64 ( void )

-{

-	printf("lskdflksj\n");

-	double bias = calcMixBias<uint32_t>(fmix32_test,500000000);

-

-	printf("%f\n",bias);

-

-	//SimAnneal(&mc,sizeof(mc),fmix64_fit,fmix64_dump,4,100);

-}

-

-

-//-----------------------------------------------------------------------------

-// Fitness == distribution of Hamming weights.

-// Optimize mix by minmaxing Hamming weights

-

-// (we want the smallest differential hamming weight to be as large as possible)

-

-void HammingOptimize ( uint32_t (*mix)(uint32_t) )

-{

-	double best[33];

-	best[0] = 2000000000;

-

-	double c[33];

-

-	printf("0x%08x\n",rand_u32());

-

-	//for(m3 = 0; m3 < 32; m3++)

-	

-	for(int i = 0; i < 100000; i++)

-	{

-		//for(r1 = 12; r1 < 18; r1++)

-		{

-			memset(c,0,sizeof(c));

-			SparseDiffHamming32(mix,c);

-

-			if(hamless(33,c,best))

-			{

-				memcpy(best,c,sizeof(c));

-

-				//printf("{%6.3f, %6.3f, %6.3f, %6.3f, %6.3f, %6.3f, %6.3f, %6.3f, %6.3f } - ",c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8]);

-

-				printf("{");

-

-				for(int i = 0; i < 33; i++) printf("%6.3f ",c[i]);

-				printf("} - ");

-

-				//printf("0x%08x, %2d, 0x%08x %2d\n",m1,r1,m2,m3);

-				//printf("0x%08x, 0x%08x\n",m1,m2);

-				printf("\n");

-			}

-		}

-	}

-}

-

-//-----------------------------------------------------------------------------

-

-u128 mix128 ( u128 h2 )

-{

-	uint32_t * h = (uint32_t*)&h2;

-

-	for(int i = 0; i < 30; i++)

-	{

-		h[0] = _rotl(h[0],3);

-		h[1] = _rotl(h[1],10);

-		h[2] = _rotl(h[2],19);

-		h[3] = _rotl(h[3],26);

-

-		h[0] += h[1];

-		h[0] += h[2];

-		h[0] += h[3];

-

-		h[1] += h[0];

-		h[2] += h[0];

-		h[3] += h[0];

-	}

-

-	return h2;

-}

-

-//-----------------------------------------------------------------------------

-

-void scratchmain ( void )

-{

-	/*

-	double worst = 1000;

-

-	double worstStage = 0;

-

-	for(stage = 0; stage < 16; stage++)

-	{

-		Stats s = testMixAvalanche<uint32_t>(mixfunc<uint32_t>(m3mix),300);

-

-		if(s.m_nbad > worstStage) worstStage = s.m_nbad;

-	}

-

-	if(worstStage < worst)

-	{

-		worst = worstStage;

-

-		printf("%3.4f : 0x%08x 0x%08x %2d 0x%08x %2d 0x%08x %2d 0x%08x %2d\n",worst,i1,i2,m1,a1,m2,a2,m3,a3,r1);

-	}

-

-	//----------

-

-	for(int i = 0; i < 1000000; i++)

-	{

-		for(m1 = 3; m1 < 10; m1 += 2)

-		for(m2 = 3; m2 < 10; m2 += 2)

-		for(m3 = 3; m3 < 10; m3 += 2)

-		for(r1 = 0; r1 < 32; r1++)

-		//for(int bit = 0; bit < 32; bit++)

-		{

-			//i2 ^= (1 << bit);

-

-			if(m1 == 7) continue;

-			if(m2 == 7) continue;

-			if(m3 == 7) continue;

-

-			double worstStage = 0;

-

-			for(stage = 0; stage < 16; stage++)

-			{

-				Stats s = testMixAvalanche<uint32_t>(mixfunc<uint32_t>(m3mix),300);

-

-				if(s.m_nbad > worstStage) worstStage = s.m_nbad;

-			}

-

-			if(worstStage < worst)

-			{

-				worst = worstStage;

-

-				printf("%3.4f : 0x%08x 0x%08x %2d 0x%08x %2d 0x%08x %2d 0x%08x %2d\n",worst,i1,i2,m1,a1,m2,a2,m3,a3,r1);

-			}

-			else

-			{

-				//i2 ^= (1 << bit);

-			}

-		}

-

-		//i1 = rand_u32();

-		//i2 = rand_u32();

-

-		//a1 = rand_u32();

-		//a2 = rand_u32();

-		//a3 = rand_u32();

-	}

-	*/

-}

-

-//-----------------------------------------------------------------------------

-

-/*

-void Pathological ( void )

-{

-	std::set<uint32_t> s;

-

-	uint32_t c = 0;

-	uint32_t seed = 0xdeadbeef * 16;

-

-	for(int j = 0; j < 5000; j++)

-	{

-		for(uint32_t i = 0; i < 10000; i++)

-		{

-			uint32_t key[4] = {c,c,c,c};

-

-			uint32_t hash = MurmurHash2(key,16,seed);

-

-			//v.push_back(hash);

-			s.insert(hash);

-			c++;

-		}

-

-		printf("%8d %8f\n",s.size(),double(s.size()) / double(c));

-	}

-}

-*/

-

-/*

-void Pathological ( void )

-{

-	const int nbytes = 512 * 1024 * 1024;

-

-	unsigned char * block = new unsigned char[nbytes];

-

-	memset(block,0,nbytes);

-

-	unsigned int k = 0;

-	unsigned int key[256];

-	unsigned int collisions = 0;

-	

-	do

-	{

-		for(int i = 0; i < 256; i++) key[i] = k;

-

-		unsigned int h;

-		h = MurmurHash2(&key[0],256*4,(0xdeadbeef * 16));

-		//MurmurHash3_x86_32(&key[0],32,(0xdeadbeef * 16),&h);

-

-		//printf("0x%08x\n",h);

-

-		if(getbit(block,nbytes,h))

-		{

-			collisions++;

-		}

-

-		setbit(block,nbytes,h);

-

-		if(k % 10000000 == 0)

-		{

-			printf("%12d : %9d : %f\n",k,collisions,double(collisions) / double(k));

-		}

-

-		k++;

-	}

-	while(k != 0);

-

-	printf("%d total collisions",collisions);

-

-	delete [] block;

-}

-*/

-

-/*

-void Pathological ( void )

-{

-	const int nbytes = 512 * 1024 * 1024;

-

-	unsigned char * block = new unsigned char[nbytes];

-

-	memset(block,0,nbytes);

-

-	unsigned int k = 0;

-	unsigned int unique = 0;

-	

-	do

-	{

-		const uint32_t m = 0xdeadbeef;

-		const int r = 24;

-

-		uint32_t x = 0;

-		uint32_t h = 0;

-

-		x = k;

-		x *= m;

-		x ^= x >> r;

-		x *= m;

-

-		h *= m;

-		h ^= x;

-

-		x = k;

-		x *= m;

-		x ^= x >> r;

-		x *= m;

-

-		h *= m;

-		h ^= x;

-

-		if(!getbit(block,nbytes,h))

-		{

-			unique++;

-		}

-

-		setbit(block,nbytes,h);

-

-		if(k % 10000000 == 0)

-		{

-			printf("%12d : %9d :%f\n",k,unique,double(unique) / double(k));

-		}

-

-		k++;

-	}

-	while(k);

-

-	printf("%d unique",unique);

-

-	delete [] block;

-}

-*/

-

-/*

-void Pathological ( void )

-{

-	typedef std::map<uint32_t,uint32_t> cmap;

-	

-	cmap collisionmap;

-

-	const int nbytes = 512 * 1024 * 1024;

-

-	unsigned char * block = new unsigned char[nbytes];

-

-	memset(block,0,nbytes);

-

-	unsigned int k = 0;

-	unsigned int key[4];

-	unsigned int collisions = 0;

-	

-	do

-	{

-		for(int i = 0; i < 4; i++) key[i] = k;

-

-		unsigned int h;

-		h = MurmurHash2(&key[0],4*sizeof(uint32_t),16);

-		//MurmurHash3_x86_32(&key[0],32,(0xdeadbeef * 16),&h);

-

-		//printf("0x%08x\n",h);

-

-		if(getbit(block,nbytes,h))

-		{

-			collisions++;

-			collisionmap[h]++;

-		}

-

-		setbit(block,nbytes,h);

-

-		if(k % 10000000 == 0)

-		{

-			printf("%12d : %9d : %9d :%f\n",k,collisionmap.size(),collisions,double(collisions) / double(k));

-		}

-

-		k++;

-	}

-	//while(k);

-	while(k <= 200000000);

-

-	uint32_t most = 0;

-	for(cmap::iterator i = collisionmap.begin(); i != collisionmap.end(); ++i)

-	{

-		uint32_t h = (*i).first;

-		uint32_t c = (*i).second;

-

-		if(c > most)

-		{

-			most = c;

-			printf("0x%08x : %d\n",h,c);

-		}

-	}

-

-	printf("%d total collisions",collisions);

-

-	delete [] block;

-}

-*/

-

-/*

-void Pathological ( void )

-{

-	unsigned int k = 0;

-	unsigned int key[4];

-

-	std::vector<uint32_t> v;

-	

-	do

-	{

-		for(int i = 0; i < 4; i++) key[i] = k;

-

-		unsigned int h;

-		h = MurmurHash2(&key[0],4*sizeof(uint32_t),16);

-

-		if(h == 0xb5abf828) 

-		{

-			v.push_back(k);

-		}

-

-		if(k % 100000000 == 0)

-		{

-			printf("%12u : %12d\n",k,v.size());

-		}

-

-

-		k++;

-	}

-	while(k);

-

-	for(size_t i = 0; i < v.size(); i++)

-	{

-		printf("0x%08x,",v[i]);

-		if(i%8==7) printf("\n");

-	}

-	printf("\n");

-}

-*/

-

-/*

-uint32_t bad[] = 

-{

-0x0017f1a9,0x00f8c102,0x01685768,0x01c6d69e,0x02109e20,0x02ea2120,0x03615606,0x03bab745,

-0x03eb73e9,0x03f7db48,0x04391e64,0x04747fa7,0x04b81cf5,0x04fbcab0,0x054bf06a,0x05d33abc,

-0x05d8eb48,0x06560ce6,0x0697bcfa,0x06a40faa,0x071977fb,0x073a4306,0x073eb088,0x0751c777,

-0x07534cb4,0x079d2fbe,0x07a0ba13,0x07cff5fc,0x082b2d13,0x08457c35,0x093de81e,0x09711b75,

-0x097fdb48,0x09ba9060,0x0a06228a,0x0a5f8691,0x0a63881c,0x0a70bcd7,0x0aed67dd,0x0b0ed19a,

-0x0bc68125,0x0c29fe48,0x0ca1eb57,0x0cbfc528,0x0d4017e2,0x0d6d91c2,0x0d7388de,0x0f0133e9,

-0x0f8d17e7,0x0f90e980,0x0fe6be43,0x1033d71d,0x1087872c,0x10b52186,0x12005768,0x12c817e2,

-0x12ed3caf,0x1343eae2,0x137b2949,0x1407d537,0x1462906a,0x156742a0,0x15f44042,0x17204969,

-0x18c86d6a,0x192c6777,0x1950b0f3,0x19548454,0x1961fb59,0x19e92685,0x1a24be52,0x1a72ccfa,

-0x1a7caf9b,0x1a9d7aa6,0x1b9407c9,0x1b9d472c,0x1bdc3c3f,0x1c2a955f,0x1c44f065,0x1c75fda6,

-0x1c934985,0x1cd45315,0x1d1dce3e,0x1d695a2a,0x1e88f490,0x203a3985,0x2050669c,0x20a34f82,

-0x221b4985,0x222718dc,0x2240aa13,0x22a67680,0x24bdf477,0x250ead99,0x255d00e9,0x2652bb8e,

-0x26823b4d,0x27298fd2,0x27bf3042,0x27e2e537,0x282dbcdc,0x295777e2,0x2ab449ff,0x2d347ad3,

-0x2d3c176d,0x2d4c5e25,0x2d72b111,0x2d9f768f,0x2ddfe73b,0x2e00b246,0x2f9f1523,0x2fdbdba7,

-0x30831cfa,0x30cc91ca,0x3129f75c,0x313f9486,0x315255e3,0x31e70a31,0x33490a31,0x33622c30,

-0x33863468,0x3441b8a7,0x349f03ad,0x3715eda6,0x374df66c,0x3766e2fc,0x3848010c,0x385325bb,

-0x38a843f3,0x398e8722,0x39cc0d5b,0x39e572ed,0x3ace4477,0x3afb8c19,0x3b98b8d4,0x3ce6212a,

-0x3cec46c6,0x3d43761a,0x3de45e25,0x3e1e5a2c,0x3f612a36,0x4008f490,0x41431edb,0x4163e9e6,

-0x41742120,0x41854564,0x41ca60f3,0x41fa37f6,0x421e16a3,0x4263b66c,0x42bc7a4a,0x434286ad,

-0x435858a7,0x43bbf5f2,0x43e43d7e,0x442fc96a,0x443e6342,0x44b58d83,0x45378356,0x45df4db0,

-0x46b09971,0x47337cff,0x47f46fc3,0x48023b4d,0x4823a50a,0x49691a36,0x497767dd,0x4a50eadd,

-0x4ad26a3b,0x4b8463b7,0x4bc34e34,0x4bcd5cc3,0x4bf245e3,0x4c62946d,0x4d18b7f9,0x4da4d029,

-0x4dcac8e3,0x4df83139,0x4e2514b8,0x4e859f82,0x4ea95477,0x4ef42c1c,0x4f68a832,0x4f7acba7,

-0x4fa478d9,0x4ffe8c21,0x50ee3486,0x514795c5,0x51948107,0x51c5fce4,0x51e3eaec,0x52015e27,

-0x526260f3,0x5288a930,0x5360193c,0x53e7ac58,0x54a6567b,0x54c72186,0x54cb8f08,0x54dea5f7,

-0x552d9893,0x555d6f96,0x55b80b93,0x56cac69e,0x56fdf9f5,0x5793010a,0x57d7b747,0x57ec6511,

-0x57f0669c,0x57fd9b57,0x5818c523,0x58fe6cff,0x5a011a36,0x5a4ca3a8,0x5b00675e,0x5c50bfbc,

-0x5c6a50f3,0x5d19f667,0x5d2504a9,0x5ddbc685,0x5e85812a,0x5ed4c61f,0x5f4d0056,0x5fd14dba,

-0x5fd77356,0x608b5837,0x60d6c07e,0x610807c9,0x610986bc,0x6194b3b7,0x62f42120,0x62f774b3,

-0x63233736,0x6361c3c1,0x63811ec2,0x64ad27e9,0x650011e5,0x66b945f7,0x66dd8f73,0x67361999,

-0x67471347,0x67760505,0x6789c685,0x68098e1b,0x683ac4a9,0x68ca7a40,0x69b773df,0x69d5acdc,

-0x6a1ec7e7,0x6a202805,0x6a613195,0x6a6a70f8,0x6a74f315,0x6a838109,0x6aaaacbe,0x6af638aa,

-0x6b4727f6,0x6b7bfcc3,0x6d4eb4ac,0x6dc71805,0x6ef55b70,0x6fa82805,0x6fb3f75c,0x6fcd8893,

-0x7014bf91,0x70fc7fc8,0x724ad2f7,0x729b8c19,0x72b8b523,0x735e4f12,0x7378556e,0x73ac5dba,

-0x74b66e52,0x74e8531f,0x754c0ec2,0x7564261f,0x7567c4bd,0x756fc3b7,0x75af8e66,0x75ba9b5c,

-0x7841287f,0x7973ca45,0x7aaa7fc8,0x7ac8f5ed,0x7aec261f,0x7b2c550f,0x7b6cc5bb,0x7d2bf3a3,

-0x7d68ba27,0x7d8f1e39,0x7d98de70,0x7edf3463,0x80626b7a,0x80b1ec4c,0x81ce9727,0x827aca36,

-0x82944f12,0x86352273,0x8831268f,0x885b22f7,0x887d51bd,0x889f261a,0x89259754,0x89bcadba,

-0x8a323fd7,0x8a72ffaa,0x8a792546,0x8ad0549a,0x8b209af1,0x8bbe27e7,0x8c066fc3,0x8c4464b3,

-0x8cd4d306,0x8cee08b6,0x8d4ab321,0x8ecffd5b,0x8f1223e4,0x8f573f73,0x8f871676,0x904958ca,

-0x904f7e66,0x90e53727,0x91711bfe,0x91859d88,0x919dfef4,0x91cb41c2,0x92426c03,0x92c461d6,

-0x92fffef4,0x936c2c30,0x93dd8269,0x94351cd9,0x94c05b7f,0x94e87d04,0x954e3aba,0x95814e43,

-0x95bbcab0,0x96f5f8b6,0x985f48bb,0x99502cb4,0x995a3b43,0x997f2463,0x99ef72ed,0x9a4e3c2b,

-0x9b57a763,0x9b850fb9,0x9bb1f338,0x9bc723cb,0x9be0895d,0x9c3632f7,0x9c7c176d,0x9c810a9c,

-0x9cf586b2,0x9d07aa27,0x9d315759,0x9d8b6aa1,0x9e99eeef,0x9f215f87,0x9f70c96c,0x9fc195cf,

-0x9fef3f73,0xa06af1b8,0xa06d0dbf,0xa0840b00,0xa12e0083,0xa14df1d4,0xa1748ad8,0xa1884c58,

-0xa2ea4e16,0xa307c528,0xa3f0607e,0xa40bfafb,0xa4558d79,0xa547228c,0xa56495c7,0xa5a5a3a3,

-0xa68b4b7f,0xa728daba,0xa78df8b6,0xa8de0999,0xa90e5479,0xa9dd9e3c,0xa9f72f73,0xa9fd51bd,

-0xaab1e329,0xab3aeee7,0xab68a505,0xab9c9eea,0xabfd18dc,0xac125faa,0xac61a49f,0xac9edbac,

-0xacd9ded6,0xad5e2c3a,0xad6451d6,0xae1836b7,0xae639efe,0xae96653c,0xaee4ad99,0xaef795cf,

-0xaf11f9ff,0xaf43c0fd,0xb0845333,0xb0b015b6,0xb0eea241,0xb1114807,0xb28cf065,0xb3db78e8,

-0xb439f81e,0xb483bfa0,0xb4c2f819,0xb4d3f1c7,0xb516a505,0xb55d42a0,0xb5c7a329,0xb65758c0,

-0xb65e9569,0xb66afcc8,0xb72b3e75,0xb7628b5c,0xb7aba667,0xb7bf11ea,0xb7f74f78,0xb801d195,

-0xb8105f89,0xb84c0cc8,0xb8c92e66,0xb8d40676,0xb908db43,0xb90ade7a,0xb917312a,0xb9c66e34,

-0xba10513e,0xba43177c,0xbab89db5,0xbadb932c,0xbbf2fcc8,0xbc2db1e0,0xbc8239f0,0xbd60895d,

-0xbd81f31a,0xbda19e11,0xbe39a2a5,0xbe895e48,0xbe9d1fc8,0xbf150cd7,0xbfb33962,0xbfe0b342,

-0xc04593a3,0xc0eb2d92,0xc10533ee,0xc1393c3a,0xc1745569,0xc2040b00,0xc259dfc3,0xc275319f,

-0xc2a6f89d,0xc2f1049f,0xc2f4a33d,0xc2faa8ac,0xc3284306,0xc33c6ce6,0xc47378e8,0xc53b3962,

-0xc5605e2f,0xc5b70c62,0xc6d5b1ea,0xc700a8c5,0xc8375e48,0xc879049f,0xcb1bfcb9,0xcb25bcf0,

-0xcb3b8eea,0xcbc7a5d4,0xcbd51cd9,0xcc97dfd2,0xcce5ee7a,0xcd109c26,0xcdef49fa,0xce072949,

-0xce1068ac,0xce3ecacc,0xce4f5dbf,0xceb811e5,0xcee91f26,0xd007a8b6,0xd0212d92,0xd0fc1610,

-0xd2c3881c,0xd3167102,0xd5199800,0xd5be050f,0xd60a303d,0xd62c049a,0xd7498c3a,0xd7bf1e57,

-0xd7d02269,0xd8ad7971,0xd8c5dd0e,0xd8f55ccd,0xd94b0667,0xd9934e43,0xd9d14333,0xda61b186,

-0xdad791a1,0xdbca9962,0xdddc5ce6,0xdf127c08,0xdf2add74,0xdfa79c53,0xdfbf7fa5,0xdfe5d291,

-0xe073d3c6,0xe08cdd74,0xe16a60e9,0xe1c1fb59,0xe2755b84,0xe2db193a,0xe2f63e7a,0xe33fb34a,

-0xe348a930,0xe39d18dc,0xe3b2b606,0xe45a2bb1,0xe5bc2bb1,0xe5d54db0,0xe5f955e8,0xe712252d,

-0xe7db1aab,0xe954024b,0xe96d67dd,0xe9890f26,0xe9c117ec,0xe9da047c,0xea08f5ed,0xeabb228c,

-0xeac6473b,0xec01a8a2,0xec26cd6f,0xec3f2edb,0xec58946d,0xed4e744f,0xed6ead99,0xedf7d038,

-0xedf9ec3f,0xee10e980,0xeebadf03,0xeedad054,0xef152ad8,0xf0577fa5,0xf0917bac,0xf094a3a8,

-0xf17d3efe,0xf198d97b,0xf1e26bf9,0xf27c1610,0xf2d4010c,0xf3d70b66,0xf3e742a0,0xf4913823,

-0xf4b5b93a,0xf4d6d7ec,0xf5b5a82d,0xf62f1772,0xf66ae819,0xf69b32f9,0xf6a2eaea,0xf78a303d,

-0xf8c7cd67,0xf923baf1,0xf9297d6a,0xf989f75c,0xfa2bba2c,0xfa755ccd,0xfa96c68a,0xfbea895d,

-0xfc718c19,0xfc84744f,0xfc9ed87f,0xfcc40c5d,0xfcd09f7d,0xfdf78537,0xfe9e2687,0xff8bd979,

-};

-

-void Pathological ( void )

-{

-	// 'm' and 'r' are mixing constants generated offline.

-	// They're not really 'magic', they just happen to work well.

-

-	const uint32_t m = 0x5bd1e995;

-	const int r = 24;

-

-	for(int i = 0; i < 100; i++)

-	{

-		uint32_t h = 0;

-		uint32_t k = bad[i];

-

-		printf("0x%08x : ",k);

-		k *= m;

-		printf("0x%08x : ",k);

-		k ^= k >> r;

-		printf("0x%08x : ",k);

-		k *= m;

-		printf("0x%08x : ",k);

-

-		printf(" - ");

-

-		h = k;

-		printf("0x%08x : ",h);

-		h *= m;

-		printf("0x%08x : ",h);

-		h ^= k;

-		printf("0x%08x : ",h);

-		h *= m;

-		printf("0x%08x : ",h);

-		h ^= k;

-		printf("0x%08x : ",h);

-		h *= m;

-		printf("0x%08x : ",h);

-		h ^= k;

-		printf("0x%08x\n",h);

-

-	}

-}

-*/

-

-/*

-void Pathological ( void )

-{

-	const int nbytes = 512 * 1024 * 1024;

-

-	unsigned char * block = new unsigned char[nbytes];

-

-	memset(block,0,nbytes);

-

-	unsigned int k = 0;

-	unsigned int collisions = 0;

-	

-	do

-	{

-		//const uint32_t m = 0x5bd1e995;

-		unsigned int h = 0;

-

-		uint32_t m1 = 0x5bd1e995;

-		uint32_t m2 = 0x5bd1e995;

-		uint32_t m3 = 0x5bd1e995;

-		uint32_t x;

-

-		x = k; x *= m1; x ^= x >> 25; x *= m2; h ^= x; h *= m3;

-		m2 = m2*9+0x273581d8;

-		x = k; x *= m1; x ^= x >> 25; x *= m2; h ^= x; h *= m3;

-		m2 = m2*9+0x273581d8;

-		

-		//printf("0x%08x : 0x%08x\n",k,h);

-		//h *= 3;

-

-		if(getbit(block,nbytes,h))

-		{

-			collisions++;

-		}

-

-		setbit(block,nbytes,h);

-

-		if(k % 10000000 == 0)

-		{

-			printf("%12u : %9u : %f\n",k,collisions,double(collisions) / double(k));

-		}

-

-		k++;

-	}

-	while(k != 0);

-

-	printf("%u total collisions, %f",collisions,double(collisions) / 4294967296.0);

-

-	delete [] block;

-}

-*/

-

-/*

-// Applying FWT to fmix32 to look for linearities (it found some bias, but nothing above a fraction of a percent)

-

-void find_linear_approximation_walsh2 ( mixfunc<uint32_t> f, uint32_t mask, int inbits, uint32_t & outL, int64_t & outBias );

-void find_linear_approximation_walsh  ( mixfunc<uint32_t> f, uint32_t mask, int inbits, uint32_t & outL, int64_t & outBias );

-uint32_t test_linear_approximation ( mixfunc<uint32_t> f, uint32_t l, uint32_t mask, int inbits );

-

-uint32_t bitrev ( uint32_t v );

-

-uint32_t FWTMix ( uint32_t x )

-{

-	x ^= x >> 16;

-	x *= 0x85ebca6b;

-	x ^= x >> 13;

-	x *= 0xc2b2ae35;

-	x ^= x >> 16;

-

-	return x;

-}

-

-double test_linear_approximation ( mixfunc<uint32_t> f, uint32_t l, uint32_t mask, int64_t size );

-

-void WalshStuff(void )

-{

-	const int64_t nbits = 32;

-	const int64_t size = int64_t(1) << nbits;

-

-	mixfunc<uint32_t> f(FWTMix);

-

-	for(int i = 0; i < nbits; i++)

-	{

-		uint32_t mask = (1 << i);

-		uint32_t outL = 0;

-		int64_t bias = 0;

-		find_linear_approximation_walsh2(f,mask,nbits,outL,bias);

-

-		double b = test_linear_approximation ( f, outL, mask, size);

-

-		printf("0x%08x, 0x%08x, %8I64d, %f\n",mask,outL,bias,b);

-	}

-}

-*/
\ No newline at end of file
diff --git a/simplex.cpp b/simplex.cpp
deleted file mode 100644
index 3f08f1d..0000000
--- a/simplex.cpp
+++ /dev/null
@@ -1,171 +0,0 @@
-#include <stdio.h>

-#include <set>

-#include <map>

-#include "pstdint.h"

-

-#pragma warning(disable:4996)

-

-struct node;

-

-typedef std::set<node*> nodeset;

-

-struct node

-{

-	node ( void )

-	{

-		name = 0;

-		mark = 0;

-		used = 0;

-		next = 0;

-	}

-

-	uint32_t name;

-	uint32_t mark;

-	uint32_t used;

-

-	node * next;

-

-	nodeset edges;

-};

-

-typedef std::map<uint32_t,node> nodegraph;

-

-nodegraph graph;

-

-bool can_link ( node * A, node * B )

-{

-	if(A->edges.find(B) == A->edges.end()) return false;

-	if(B->edges.find(A) == B->edges.end()) return false;

-

-	return true;

-}

-

-bool can_link_all ( node * A, node * B )

-{

-	node * cursor = A;

-

-	while(cursor)

-	{

-		if(!can_link(cursor,B)) return false;

-

-		cursor = cursor->next;

-	}

-

-	return true;

-}

-

-void print_simplex( node * head )

-{

-	node * cursor = head;

-

-	while(cursor)

-	{

-		printf("0x%08x,",cursor->name);

-		cursor = cursor->next;

-	}

-	printf("\n");

-}

-

-void find_simplex ( node * head )

-{

-	bool found = false;

-

-	for(nodeset::iterator it = head->edges.begin(); it != head->edges.end(); it++)

-	{

-		node * next = (*it);

-

-		if(next->mark) continue;

-		if(next->name > head->name) continue;

-

-		if(can_link_all(head,next))

-		{

-			found = true;

-			next->mark = head->mark + 1;

-			next->next = head;

-

-			find_simplex(next);

-

-			next->mark = 0;

-			next->next = 0;

-		}

-	}

-

-	if(!found && (head->mark > 3))

-	{

-		bool used = false;

-

-		node * cursor = head;

-

-		while(cursor)

-		{

-			if(cursor->used) used = true;

-

-			cursor = cursor->next;

-		}

-

-		if(!used) 

-		{

-			print_simplex(head);

-

-			node * cursor = head;

-

-			while(cursor)

-			{

-				cursor->used = 1;

-				cursor = cursor->next;

-			}

-		}

-	}

-}

-

-int simplex_main ( int argc, char * argv[] )

-{

-	if(argc < 2)

-	{

-		printf("blah\n");

-		return 1;

-	}

-

-	FILE * file = fopen(argv[1],"r");

-

-	if(!file)

-	{

-		printf("Couldn't open file\n");

-		return 1;

-	}

-

-	char buffer[512];

-

-	while(fgets(buffer,512,file))

-	{

-		uint32_t nameA;

-		uint32_t nameB;

-

-		int found = sscanf(buffer,"0x%08x,0x%08x",&nameA,&nameB);

-

-		if(found != 2) continue;

-

-		node * nodeA = &graph[nameA];

-		node * nodeB = &graph[nameB];

-

-		nodeA->name = nameA;

-		nodeB->name = nameB;

-

-		nodeA->edges.insert(nodeB);

-		nodeB->edges.insert(nodeA);

-	}

-

-	for(std::map<uint32_t,node>::iterator it = graph.begin(); it != graph.end(); it++)

-	{

-		node & n = (*it).second;

-

-		n.mark = 1;

-

-		find_simplex(&n);

-

-		n.mark = 0;

-	}

-

-	return 0;

-}

-