From 34d45455d0dd177b42c968c8b20290d6f428cd07 Mon Sep 17 00:00:00 2001 From: James Nobis Date: Tue, 18 Jan 2011 19:49:23 -0600 Subject: [PATCH] misc cleanup --- Common/rt api/BaseRTReader.h | 4 ++-- Common/rt api/ChainWalkContext.cpp | 33 ++++++++---------------------- Common/rt api/ChainWalkContext.h | 3 +-- Common/rt api/md4.h | 25 +++++++++++++++++++++- 4 files changed, 35 insertions(+), 30 deletions(-) diff --git a/Common/rt api/BaseRTReader.h b/Common/rt api/BaseRTReader.h index a9923cf..9eecd25 100644 --- a/Common/rt api/BaseRTReader.h +++ b/Common/rt api/BaseRTReader.h @@ -37,8 +37,8 @@ using namespace std; class BaseRTReader { public: - virtual int ReadChains(UINT4 &numChains, RainbowChain *pData) = 0; - virtual UINT4 GetChainsLeft() = 0; + virtual int ReadChains(uint32 &numChains, RainbowChainO *pData) = 0; + virtual uint32 GetChainsLeft() = 0; virtual ~BaseRTReader() { }; }; diff --git a/Common/rt api/ChainWalkContext.cpp b/Common/rt api/ChainWalkContext.cpp index f551d63..2fe6b1b 100644 --- a/Common/rt api/ChainWalkContext.cpp +++ b/Common/rt api/ChainWalkContext.cpp @@ -410,8 +410,12 @@ void CChainWalkContext::Dump() printf("hash routine: %s\n", m_sHashRoutineName.c_str()); printf("hash length: %d\n", m_nHashLen); + printf( "m_vCharset[0].m_nPlainCharSetLen: %d\n", m_vCharset[0].m_nPlainCharsetLen ); + printf( "m_vCharset[1].m_nPlainCharSetLen: %d\n", m_vCharset[1].m_nPlainCharsetLen ); + printf("plain charset: "); unsigned int i; + for (i = 0; i < m_vCharset[0].m_nPlainCharsetLen; i++) { if (isprint(m_vCharset[0].m_PlainCharset[i])) @@ -548,15 +552,11 @@ void CChainWalkContext::IndexToPlain() } m_Plain[i] = m_vCharset[j].m_PlainCharset[nTemp]; #else - __asm__ __volatile__ ( "mov %2, %%eax;" - "xor %%edx, %%edx;" + __asm__ __volatile__ ("xor %%edx, %%edx;" "divl %3;" - "mov %%eax, %0;" - "mov %%edx, %1;" - : "=m"(nIndexOfX32), "=m"(nTemp) - : "m"(nIndexOfX32), "m"(m_vCharset[j].m_nPlainCharsetLen) - : "%eax", "%edx" - ); + : "=a"(nIndexOfX32), "=d"(nTemp) + : "a"(nIndexOfX32), "rm"(m_vCharset[j].m_nPlainCharsetLen) + : ); m_Plain[i] = m_vCharset[j].m_PlainCharset[nTemp]; #endif break; @@ -605,24 +605,7 @@ string CChainWalkContext::GetBinary() { return HexToStr(m_Plain, m_nPlainLen); } -/* -string CChainWalkContext::GetPlainBinary() -{ - string sRet; - sRet += GetPlain(); - int i; - for (i = 0; i < m_nPlainLenMax - m_nPlainLen; i++) - sRet += ' '; - sRet += "|"; - - sRet += GetBinary(); - for (i = 0; i < m_nPlainLenMax - m_nPlainLen; i++) - sRet += " "; - - return sRet; -} -*/ string CChainWalkContext::GetHash() { return HexToStr(m_Hash, m_nHashLen); diff --git a/Common/rt api/ChainWalkContext.h b/Common/rt api/ChainWalkContext.h index 9854c59..0435ef7 100644 --- a/Common/rt api/ChainWalkContext.h +++ b/Common/rt api/ChainWalkContext.h @@ -51,8 +51,8 @@ public: static bool isRti2RtFormat; static vector m_vCharset; static int m_nPlainLenMinTotal, m_nPlainLenMaxTotal; - static uint64 m_nPlainSpaceTotal; // Performance consideration static uint64 m_nPlainSpaceUpToX[MAX_PLAIN_LEN + 1]; // Performance consideration + static uint64 m_nPlainSpaceTotal; // Performance consideration static int m_nHybridCharset; static int m_nRainbowTableIndex; // Configuration static uint64 m_nReduceOffset; // Performance consideration @@ -96,7 +96,6 @@ public: const uint64* GetIndexPtr(); string GetPlain(); string GetBinary(); -// string GetPlainBinary(); string GetHash(); bool CheckHash(unsigned char* pHash); // The length should be m_nHashLen }; diff --git a/Common/rt api/md4.h b/Common/rt api/md4.h index f83aa1a..0049e37 100644 --- a/Common/rt api/md4.h +++ b/Common/rt api/md4.h @@ -1,9 +1,32 @@ +/* + * freerainbowtables is a project for generating, distributing, and using + * perfect rainbow tables + * + * Copyright Bitweasil + * Copyright 2009, 2010 Daniël Niggebrugge + * Copyright 2009, 2010, 2011 James Nobis + * + * This file is part of freerainbowtables. + * + * freerainbowtables is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * freerainbowtables is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with freerainbowtables. If not, see . + */ + #ifndef MD4_H #define MD4_H #include "global.h" - #define MD4_DIGEST_LENGTH 16 //Main function -- 2.39.2