cuErr = cudaSuccess;
cudaSetDeviceFlags(cudaDeviceBlockingSync);
+
for(int idx = 0; idx < task->rainbowChainLen-1 && cuErr == cudaSuccess; idx+=KERN_CHAIN_SIZE) {
switch(task->hash) {
case rcuda::RHASH_MD5:
int size = reader->GetChainsLeft() * sizeof(RainbowChain);
static CMemoryPool mp;
- unsigned int nAllocatedSize;
+ uint64 nAllocatedSize;
RainbowChain* pChain = (RainbowChain*)mp.Allocate(size, nAllocatedSize);
uint32 chainrowsize = (uint32)ceil((float)(rti_startptlength + rti_endptlength + rti_cplength) / 8) * 8 ; // The size in bits (in whole bytes)
unsigned int chainrowsizebytes = chainrowsize / 8;
indexes.push_back(index);
IndexRow high = {0}; // Used to find the highest numbers. This tells us how much we can pack the index bits
- for(UINT4 i = 0; i < indexes.size(); i++)
+ for(uint32 i = 0; i < indexes.size(); i++)
{
if(indexes[i].numchains > high.numchains)
high.numchains = indexes[i].numchains;
// fwrite(&m_rti_index_indexlength , 1, 1, pFileIndex);
fwrite(&m_rti_index_numchainslength, 1, 1, pFileIndex);
- for(UINT4 i = 0; i < rti_cppos.size(); i++) {
+ for(uint32 i = 0; i < rti_cppos.size(); i++) {
fwrite(&rti_cppos[i], 1, 4, pFileIndex); // The position of the checkpoints
}
// fwrite(&m_rti_index_prefixlength, 1, 1, pFileIndex);
int zero = 0;
fwrite(&indexes[0].prefix, 1, 8, pFileIndex); // Write the first prefix
unsigned int lastPrefix = 0;
- for(UINT4 i = 0; i < indexes.size(); i++) {
+ for(uint32 i = 0; i < indexes.size(); i++) {
if(i == 0) {
lastPrefix = indexes[0].prefix;
}
exit(1);
}
}
- for(UINT4 j = 1; j < diffSize; j++)
+ for(uint32 j = 1; j < diffSize; j++)
{
fwrite(&zero, 1, m_indexrowsizebytes, pFileIndex);
}
printf("no rainbow table found\n");
return 0;
}
- for (UINT4 i = 0; i < vPathName.size(); i++) {
+ for (uint32 i = 0; i < vPathName.size(); i++) {
string sResultFile;
int n = vPathName[i].find_last_of('\\');
if (n != -1) {
* rcracki_mt is a multithreaded implementation and fork of the original
* RainbowCrack
*
- * Copyright 2010 Martin Westergaard Jørgensen <martinwj2005@gmail.com>
+ * Copyright 2010, 2011 Martin Westergaard Jørgensen <martinwj2005@gmail.com>
* Copyright 2010 Daniël Niggebrugge <niggebrugge@fox-it.com>
* Copyright 2010, 2011 James Nobis <frt@quelrod.net>
*
* rcracki_mt is a multithreaded implementation and fork of the original
* RainbowCrack
*
- * Copyright 2010 Martin Westergaard Jørgensen <martinwj2005@gmail.com>
+ * Copyright 2010, 2011 Martin Westergaard Jørgensen <martinwj2005@gmail.com>
* Copyright 2010 Daniël Niggebrugge <niggebrugge@fox-it.com>
* Copyright 2010, 2011 James Nobis <frt@quelrod.net>
*
*/\r
\r
#if defined(_WIN32) && !defined(__GNUC__)\r
- #pragma warning(disable : 4786 4267 4018)\r
+ #pragma warning(disable : 4786)\r
#endif\r
\r
#include "ChainWalkContext.h"\r
* RainbowCrack\r
*\r
* Copyright (C) Zhu Shuanglei <shuanglei@hotmail.com>\r
- * Copyright 2009, 2010 Martin Westergaard Jørgensen <martinwj2005@gmail.com>\r
+ * Copyright 2009, 2010, 2011 Martin Westergaard Jørgensen <martinwj2005@gmail.com>\r
* Copyright 2009, 2010 Daniël Niggebrugge <niggebrugge@fox-it.com>\r
* Copyright 2009, 2010, 2011 James Nobis <frt@quelrod.net>\r
*\r
*/\r
\r
#if defined(_WIN32) && !defined(__GNUC__)\r
- #pragma warning(disable : 4786 4267 4018)\r
+ #pragma warning(disable : 4786)\r
#endif\r
\r
#include "HashRoutine.h"\r
*/\r
\r
#if defined(_WIN32) && !defined(__GNUC__)\r
- #pragma warning(disable : 4786 4267 4018)\r
+ #pragma warning(disable : 4786)\r
#endif\r
\r
#include "Public.h"\r
\r
struct timezone\r
{\r
- int tz_minuteswest; /* minutes W of Greenwich */\r
- int tz_dsttime; /* type of dst correction */\r
+ int tz_minuteswest; /* minutes W of Greenwich */\r
+ int tz_dsttime; /* type of dst correction */\r
};\r
\r
int gettimeofday(struct timeval *tv, struct timezone *tz)\r
\r
using namespace std;\r
\r
-\r
struct RainbowChainO\r
{\r
uint64 nIndexS;\r
\r
#if defined(_WIN32) && !defined(__GNUC__)\r
int gettimeofday( struct timeval *tv, struct timezone *tz );\r
-#endif\r
-\r
-#if !defined(_WIN32) || defined(__GNUC__)\r
+#else\r
#include <sys/time.h>\r
#endif\r
\r
fseek(m_pFile, 0, SEEK_SET);
if(len % m_chainsizebytes > 0)
{
- printf("Invalid filesize %ld\n", len);
+ printf("Invalid filesize %lu\n", len);
return;
}
return;
}
static CMemoryPool mp;
- unsigned int nAllocatedSize;
+ uint64 nAllocatedSize;
BaseRTReader *reader = NULL;
if(sType == "RTI2")
reader = (BaseRTReader*)new RTI2Reader(sFileName);
printf("Invalid table type '%s'", sType.c_str());
return ;
}
- int size = reader->GetChainsLeft() * sizeof(RainbowChain);
+ uint64 size = reader->GetChainsLeft() * sizeof(RainbowChain);
#ifdef _MEMORYDEBUG
printf("Starting allocation of %i bytes\n", size);
#endif
* freerainbowtables is a project for generating, distributing, and using
* perfect rainbow tables
*
- * Copyright 2010 Martin Westergaard Jørgensen <martinwj2005@gmail.com>
+ * Copyright 2010, 2011 Martin Westergaard Jørgensen <martinwj2005@gmail.com>
* Copyright 2010 Daniël Niggebrugge <niggebrugge@fox-it.com>
* Copyright 2010, 2011 James Nobis <frt@quelrod.net>
*
* freerainbowtables is a project for generating, distributing, and using
* perfect rainbow tables
*
- * Copyright 2010 Martin Westergaard Jørgensen <martinwj2005@gmail.com>
+ * Copyright 2010, 2011 Martin Westergaard Jørgensen <martinwj2005@gmail.com>
* Copyright 2010 Daniël Niggebrugge <niggebrugge@fox-it.com>
* Copyright 2010, 2011 James Nobis <frt@quelrod.net>
*
class BaseRTReader
{
public:
- virtual int ReadChains(uint32 &numChains, RainbowChainO *pData) = 0;
+ virtual int ReadChains(uint32 &numChains, RainbowChain *pData) = 0;
virtual uint32 GetChainsLeft() = 0;
virtual ~BaseRTReader() { };
sprintf(sPreCalcFileName, "%s.%d", sPrecalcPathName.c_str(), preCalcPart);
string sReturnPreCalcPath(sPreCalcFileName);
- unsigned int fileLen = 0;
+ long fileLen = 0;
FILE* file = fopen(sReturnPreCalcPath.c_str(), "ab");
if(file!=NULL)
* perfect rainbow tables
*
* Copyright (C) Zhu Shuanglei <shuanglei@hotmail.com>
- * Copyright Martin Westergaard Jørgensen <martinwj2005@gmail.com>
+ * Copyright 2009, 2010, 2011 Martin Westergaard Jørgensen <martinwj2005@gmail.com>
* Copyright 2009, 2010 Daniël Niggebrugge <niggebrugge@fox-it.com>
* Copyright 2009, 2010, 2011 James Nobis <frt@quelrod.net>
*
m_pMem = NULL;
m_nMemSize = 0;
- unsigned int nAvailPhys = GetAvailPhysMemorySize();
+ unsigned long nAvailPhys = GetAvailPhysMemorySize();
if (nAvailPhys < 16 * 1024 * 1024)
{
nAvailPhys = 512 * 1024 * 1024; // There is atleast 256 mb available (Some Linux distros returns a really low GetAvailPhysMemorySize()
CMemoryPool::~CMemoryPool()
{
- if (m_pMem != NULL) {
+ if (m_pMem != NULL)
+ {
#ifdef _MEMORYDEBUG
printf("Freeing %i bytes of memory\n", m_nMemSize);
#endif
}
}
-unsigned char* CMemoryPool::Allocate(unsigned int nFileLen, unsigned int& nAllocatedSize)
+unsigned char* CMemoryPool::Allocate(unsigned int nFileLen, uint64& nAllocatedSize)
{
- if (nFileLen <= m_nMemSize) {
+ if (nFileLen <= m_nMemSize)
+ {
nAllocatedSize = nFileLen;
return m_pMem;
}
unsigned int nTargetSize;
- if (nFileLen < m_nMemMax) {
+ if (nFileLen < m_nMemMax)
nTargetSize = nFileLen;
- }
- else {
+ else
nTargetSize = m_nMemMax;
- }
+
// Free existing memory
- if (m_pMem != NULL) {
+ if (m_pMem != NULL)
+ {
#ifdef _MEMORYDEBUG
printf("Freeing %i bytes of memory\n", m_nMemSize);
#endif
// Allocate new memory
//printf("allocating %u bytes memory\n", nTargetSize);
- // m_pMem = new unsigned char[nTargetSize];
#ifdef _MEMORYDEBUG
printf("Allocating %i bytes of memory - ", nTargetSize);
#endif
m_pMem = new (nothrow) unsigned char[nTargetSize];
- while (m_pMem == NULL && nTargetSize >= 512 * 1024 * 1024 ) {
+ while (m_pMem == NULL && nTargetSize >= 512 * 1024 * 1024 )
+ {
#ifdef _MEMORYDEBUG
printf("failed!\n");
printf("Allocating %i bytes of memory (backup) - ", nTargetSize);
#endif
- nTargetSize -= 16 * 1024 * 1024;
- m_pMem = new (nothrow) unsigned char[nTargetSize];
+ nTargetSize -= 16 * 1024 * 1024;
+ m_pMem = new (nothrow) unsigned char[nTargetSize];
}
- if (m_pMem != NULL) {
+
+ if (m_pMem != NULL)
+ {
#ifdef _MEMORYDEBUG
printf("success!\n");
#endif
nAllocatedSize = nTargetSize;
return m_pMem;
}
- else {
+ else
+ {
+ m_nMemSize = 0;
nAllocatedSize = 0;
return NULL;
}
private:
bool debug;
unsigned char* m_pMem;
- unsigned int m_nMemSize;
+ uint64 m_nMemSize;
- unsigned int m_nMemMax;
+ uint64 m_nMemMax;
public:
- unsigned char* Allocate(unsigned int nFileLen, unsigned int& nAllocatedSize);
+ unsigned char* Allocate(unsigned int nFileLen, uint64& nAllocatedSize);
};
#endif
if (file != NULL)
{
- unsigned int len = GetFileLen(file);
+ long len = GetFileLen(file);
char* data = new char[len + 1];
fread(data, 1, len, file);
data[len] = '\0';
FILE* file = fopen(sPathName.c_str(), "rb");
if (file != NULL)
{
- unsigned int len = GetFileLen(file);
+ long len = GetFileLen(file);
char* data = new char[len + 1];
fread(data, 1, len, file);
data[len] = '\0';
}
-unsigned int RTI2Reader::GetChainsLeft()
+uint32 RTI2Reader::GetChainsLeft()
{
long len = GetFileLen(m_pFile);
return len / m_chainsizebytes - m_chainPosition;
while(true) // Fast forward to current position
{
+ /// XXX
// ALERT: Possible problem here if m_indexrowsizebytes > 1 as pNumChains is a unsigned char.
unsigned int NumChainsInRow = (unsigned int)*(pNumChains + indexRow * m_indexrowsizebytes);
if(m_indexrowsizebytes > 1)
RTI2Reader(string Filename);
~RTI2Reader(void);
int ReadChains(uint32 &numChains, RainbowChain *pData);
- unsigned int GetChainsLeft();
+ uint32 GetChainsLeft();
static RTI2Header *GetHeader() { return m_pHeader; }
};
}
-int RTIReader::ReadChains(unsigned int &numChains, RainbowChain *pData)
+int RTIReader::ReadChains(uint32 &numChains, RainbowChain *pData)
{
// We HAVE to reset the data to 0x00's or we will get in trouble
memset(pData, 0x00, sizeof(RainbowChain) * numChains);
unsigned int readChains = 0;
unsigned int chainsleft = GetChainsLeft();
- for(UINT4 i = 0; i < m_nIndexSize; i++)
+ for(uint32 i = 0; i < m_nIndexSize; i++)
{
if(m_chainPosition + readChains > m_pIndex[i].nFirstChain + m_pIndex[i].nChainCount) // We found the matching index
continue;
return 0;
}
-UINT4 RTIReader::GetChainsLeft()
+uint32 RTIReader::GetChainsLeft()
{
return (GetFileLen(m_pFile) / 8) - m_chainPosition;
}
RTIReader(string Filename);
~RTIReader(void);
- int ReadChains(unsigned int &numChains, RainbowChain *pData);
+ int ReadChains(uint32 &numChains, RainbowChain *pData);
unsigned int GetChainsLeft();
};
{
}
-int RTReader::ReadChains(unsigned int &numChains, RainbowChain *pData)
+int RTReader::ReadChains(uint32 &numChains, RainbowChain *pData)
{
unsigned int numRead = fread(pData, 1, 16 * numChains, m_pFile);
numChains = numRead / 16;
m_chainPosition += numChains;
return 0;
}
-UINT4 RTReader::GetChainsLeft()
+uint32 RTReader::GetChainsLeft()
{
return (GetFileLen(m_pFile) / 16) - m_chainPosition;
}
public:
RTReader(string Filename);
~RTReader(void);
- int ReadChains(unsigned int &numChains, RainbowChain *pData);
+ int ReadChains(uint32 &numChains, RainbowChain *pData);
unsigned int GetChainsLeft();
};