]> git.sesse.net Git - freerainbowtables/commitdiff
64-bit fixes for distrrtgen
authorJames Nobis <quel@quelrod.net>
Sun, 17 Oct 2010 05:27:58 +0000 (00:27 -0500)
committerJames Nobis <quel@quelrod.net>
Sun, 17 Oct 2010 05:27:58 +0000 (00:27 -0500)
misc 64-bit fixes
cleanup

19 files changed:
BOINC software/BOINC client apps/distrrtgen/Makefile
BOINC software/BOINC client apps/distrrtgen/distrrtgen.cpp
BOINC software/BOINC client apps/distrrtgen/global.h [new symlink]
Common/rt api/ChainWalkContext.cpp
Common/rt api/HashAlgorithm.cpp
Common/rt api/HashAlgorithm.h
Common/rt api/HashRoutine.cpp
Common/rt api/HashRoutine.h
Common/rt api/Public.cpp
Common/rt api/Public.h
Common/rt api/des.h
Common/rt api/des_enc.c
Common/rt api/global.h
Common/rt api/md4.h
Common/rt api/md5.h
Common/rt api/tmp/HashAlgorithm.cpp [deleted file]
Common/rt api/tmp/HashAlgorithm.h [deleted file]
Common/rt api/tmp/HashRoutine.cpp [deleted file]
Common/rt api/tmp/HashRoutine.h [deleted file]

index 503fd08cbaf45219cedfb189c1363f5d5a3e4840..153f289d924b66be1935d92c60139204c72415ae 100644 (file)
@@ -1,33 +1,96 @@
-# This should work on Linux.  Modify as needed for other platforms.
+# freerainbowtables is a project for generating, distributing, and using
+# perfect rainbow tables
+#
+# Copyright (C) Zhu Shuanglei <shuanglei@hotmail.com>
+# Copyright Martin Westergaard Jørgensen <martinwj2005@gmail.com>
+# Copyright 2009, 2010 Daniël Niggebrugge <niggebrugge@fox-it.com>
+# Copyright 2009, 2010 James Nobis <frt@quelrod.net>
+#
+# 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 <http://www.gnu.org/licenses/>.
 
 
-BOINC_DIR = /home/ubuntu/boinc
+SHELL = /bin/sh
+
+#BOINC_DIR = /home/ubuntu/boinc
+BOINC_DIR = /usr/share/boinc-dev
 BOINC_API_DIR = $(BOINC_DIR)/api
 BOINC_LIB_DIR = $(BOINC_DIR)/lib
 COMMON_LIB_DIR = /usr/lib
 
 BOINC_API_DIR = $(BOINC_DIR)/api
 BOINC_LIB_DIR = $(BOINC_DIR)/lib
 COMMON_LIB_DIR = /usr/lib
 
+OPTIMIZATION = -O3
+
 CXXFLAGS = -g \
     -static -static-libgcc \
     -I$(BOINC_DIR) \
     -I$(BOINC_LIB_DIR) \
     -I$(BOINC_API_DIR) \
 CXXFLAGS = -g \
     -static -static-libgcc \
     -I$(BOINC_DIR) \
     -I$(BOINC_LIB_DIR) \
     -I$(BOINC_API_DIR) \
-    -L$(BOINC_API_DIR) \
-    -L$(BOINC_LIB_DIR) \
-    -L /usr/X11R6/lib \
-    -L.
+        -Wall \
+        -c \
+        -DBOINC \
+        $(OPTIMIZATION)
+
+LFLAGS = -static -static-libgcc -Wall $(OPTIMIZATION) -L$(BOINC_API_DIR) \
+       -L$(BOINC_LIB_DIR) -L /usr/X11R6/lib -L.
+
+LIBS = -lboinc_api -lboinc -lpthread -lssl libstdc++.a $(COMMON_LIB_DIR)/libssl.a $(COMMON_LIB_DIR)/libpthread.a
+OBJS = ChainWalkContext.o des_enc.o des_setkey.o distrrtgen.o ecb_enc.o HashAlgorithm.o HashRoutine.o md4.o md5.o Public.o
 
 
+OSNAME = $(shell uname -s)
 
 
-PROGS = distrrtgen \
+all: distrrtgen
 
 
-all: $(PROGS)
+distrrtgen: libstdc++.a $(BOINC_API_DIR)/libboinc_api.a $(BOINC_LIB_DIR)/libboinc.a $(OBJS)
+       $(CXX) $(LFLAGS) $(OBJS) $(LIBS) -o distrrtgen
 
 libstdc++.a:
        ln -s `g++ -print-file-name=libstdc++.a`
 
 clean:
 
 libstdc++.a:
        ln -s `g++ -print-file-name=libstdc++.a`
 
 clean:
-       /bin/rm -f $(PROGS) *.o
+       /bin/rm -f distrrtgen *.o
 
 distclean:
 
 distclean:
-       /bin/rm -f $(PROGS) *.o libstdc++.a
+       /bin/rm -f distrrtgen *.o libstdc++.a
+
+rebuild: clean all
+
+ChainWalkContext.o: ChainWalkContext.h ChainWalkContext.cpp HashRoutine.h Public.h
+       $(CXX) $(CXXFLAGS) ChainWalkContext.cpp
+
+des_enc.o: des_enc.c des_locl.h spr.h
+       $(CXX) $(CXXFLAGS) des_enc.c
+
+des_setkey.o: des_setkey.c des_locl.h podd.h sk.h
+       $(CXX) $(CXXFLAGS) des_setkey.c
+
+distrrtgen.o: distrrtgen.cpp distrrtgen.h ChainWalkContext.h Public.h
+       $(CXX) $(CXXFLAGS) distrrtgen.cpp
+
+ecb_enc.o: ecb_enc.c des_locl.h spr.h
+       $(CXX) $(CXXFLAGS) ecb_enc.c
+
+HashAlgorithm.o: HashAlgorithm.h HashAlgorithm.cpp Public.h md4.h md5.h
+       $(CXX) $(CXXFLAGS) HashAlgorithm.cpp
+
+HashRoutine.o: HashRoutine.h HashRoutine.cpp global.h HashAlgorithm.h
+       $(CXX) $(CXXFLAGS) HashRoutine.cpp
+
+md4.o: md4.h md4.cpp global.h
+       $(CXX) $(CXXFLAGS) md4.cpp
+
+md5.o: md5.h md5.cpp global.h
+       $(CXX) $(CXXFLAGS) md5.cpp
 
 
-distrrtgen: distrrtgen.o libstdc++.a $(BOINC_API_DIR)/libboinc_api.a $(BOINC_LIB_DIR)/libboinc.a
-       $(CXX) *.c *.cpp $(CXXFLAGS) -o distrrtgen distrrtgen.o libstdc++.a $(COMMON_LIB_DIR)/libssl.a $(COMMON_LIB_DIR)/libpthread.a -lboinc_api -lboinc -lpthread -lssl -O3
+Public.o: Public.h Public.cpp global.h
+       $(CXX) $(CXXFLAGS) Public.cpp
index 527151206f67e6bc8e786ad0b4cf941843d4a116..d9367852ab16d89229b855ea1c5eb97a578789f9 100644 (file)
@@ -58,9 +58,6 @@
 #include "Public.h"
 // Rainbowcrack code
 #include "ChainWalkContext.h"
 #include "Public.h"
 // Rainbowcrack code
 #include "ChainWalkContext.h"
-typedef unsigned int uint32;
-//typedef unsigned __int64 uint64;
-
 
 using std::string;
 
 
 using std::string;
 
@@ -72,7 +69,7 @@ double cpu_time = 20, comp_result;
 */
 int QuickSortPartition(RainbowChainCP* pChain, int nLow, int nHigh)
 {
 */
 int QuickSortPartition(RainbowChainCP* pChain, int nLow, int nHigh)
 {
-       int nRandomIndex = nLow + ((unsigned int)rand() * (RAND_MAX + 1) + (unsigned int)rand()) % (nHigh - nLow + 1);
+       int nRandomIndex = nLow + ((uint32)rand() * ((uint32)RAND_MAX + 1) + (uint32)rand()) % (nHigh - nLow + 1);
        RainbowChainCP TempChain;
        TempChain = pChain[nLow];
        pChain[nLow] = pChain[nRandomIndex];
        RainbowChainCP TempChain;
        TempChain = pChain[nLow];
        pChain[nLow] = pChain[nRandomIndex];
@@ -130,7 +127,7 @@ int main(int argc, char **argv) {
                return -1;
        }
        string sHashRoutineName, sCharsetName, sSalt, sCheckPoints;
                return -1;
        }
        string sHashRoutineName, sCharsetName, sSalt, sCheckPoints;
-       uint32 nRainbowChainCount, nPlainLenMin, nPlainLenMax, nRainbowTableIndex, nRainbowChainLen;
+       int nRainbowChainCount, nPlainLenMin, nPlainLenMax, nRainbowTableIndex, nRainbowChainLen;
        uint64 nChainStart;
        sHashRoutineName = argv[1];
        sCharsetName = argv[2];
        uint64 nChainStart;
        sHashRoutineName = argv[1];
        sCharsetName = argv[2];
@@ -242,7 +239,7 @@ int main(int argc, char **argv) {
 //     std::cout << "Starting to generate chains" << std::endl;
        for(int nCurrentCalculatedChains = nDataLen / 18; nCurrentCalculatedChains < nRainbowChainCount; nCurrentCalculatedChains++)
        {               
 //     std::cout << "Starting to generate chains" << std::endl;
        for(int nCurrentCalculatedChains = nDataLen / 18; nCurrentCalculatedChains < nRainbowChainCount; nCurrentCalculatedChains++)
        {               
-               int cpcheck = 0;
+               uint32 cpcheck = 0;
                unsigned short checkpoint = 0;
                fd = (double)nCurrentCalculatedChains / (double)nRainbowChainCount;
                boinc_fraction_done(fd);
                unsigned short checkpoint = 0;
                fd = (double)nCurrentCalculatedChains / (double)nRainbowChainCount;
                boinc_fraction_done(fd);
diff --git a/BOINC software/BOINC client apps/distrrtgen/global.h b/BOINC software/BOINC client apps/distrrtgen/global.h
new file mode 120000 (symlink)
index 0000000..a5e31dc
--- /dev/null
@@ -0,0 +1 @@
+../../../Common/rt api/global.h
\ No newline at end of file
index 3d7dcf82f5cccde8f1253fa40954839b4a3bc5a4..4597fc2ddbe82d027b224b6b858541454d448339 100644 (file)
@@ -1,8 +1,28 @@
 /*
 /*
-   RainbowCrack - a general propose implementation of Philippe Oechslin's faster time-memory trade-off technique.
-
-   Copyright (C) Zhu Shuanglei <shuanglei@hotmail.com>
-*/
+ * freerainbowtables is a multithreaded implementation and fork of the original 
+ * RainbowCrack
+ *
+ * Copyright (C) Zhu Shuanglei <shuanglei@hotmail.com>
+ * Copyright Martin Westergaard Jørgensen <martinwj2005@gmail.com>
+ * Copyright 2009, 2010 Daniël Niggebrugge <niggebrugge@fox-it.com>
+ * Copyright 2009, 2010 James Nobis <frt@quelrod.net>
+ * Copyright 2010 Yngve AAdlandsvik
+ *
+ * This file is part of rcracki_mt.
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
 
 #ifdef _WIN32
        #pragma warning(disable : 4786)
 
 #ifdef _WIN32
        #pragma warning(disable : 4786)
@@ -58,10 +78,23 @@ bool CChainWalkContext::LoadCharset(string sName)
        {
                m_nHybridCharset = 1;           
        }
        {
                m_nHybridCharset = 1;           
        }
+
+       bool readCharset = false;
        vector<string> vLine;
        vector<string> vLine;
-       if (ReadLinesFromFile("charset.txt", vLine))
+
+       #ifdef BOINC
+               if ( boinc_ReadLinesFromFile( "charset.txt", vLine ) )
+                       readCharset = true;
+       #else
+               if ( ReadLinesFromFile("charset.txt", vLine) )
+                       readCharset = true;
+               else if ( ReadLinesFromFile(GetApplicationPath() + "charset.txt", vLine) )
+                       readCharset = true;
+       #endif
+
+       if ( readCharset )
        {
        {
-               int i;
+               uint32 i;
                for (i = 0; i < vLine.size(); i++)
                {
                        // Filter comment
                for (i = 0; i < vLine.size(); i++)
                {
                        // Filter comment
@@ -78,7 +111,7 @@ bool CChainWalkContext::LoadCharset(string sName)
                                                                
                                // sCharsetName charset check
                                bool fCharsetNameCheckPass = true;
                                                                
                                // sCharsetName charset check
                                bool fCharsetNameCheckPass = true;
-                               int j;
+                               uint32 j;
                                for (j = 0; j < sCharsetName.size(); j++)
                                {
                                        if (   !isalpha(sCharsetName[j])
                                for (j = 0; j < sCharsetName.size(); j++)
                                {
                                        if (   !isalpha(sCharsetName[j])
@@ -120,7 +153,7 @@ bool CChainWalkContext::LoadCharset(string sName)
                                        GetHybridCharsets(sName, vCharsets);
                                        if(sCharsetName == vCharsets[m_vCharset.size()].sName)
                                        {
                                        GetHybridCharsets(sName, vCharsets);
                                        if(sCharsetName == vCharsets[m_vCharset.size()].sName)
                                        {
-                                               stCharset tCharset = {0};
+                                               stCharset tCharset;
                                                tCharset.m_nPlainCharsetLen = sCharsetContent.size();                                                   
                                                memcpy(tCharset.m_PlainCharset, sCharsetContent.c_str(), tCharset.m_nPlainCharsetLen);
                                                tCharset.m_sPlainCharsetName = sCharsetName;
                                                tCharset.m_nPlainCharsetLen = sCharsetContent.size();                                                   
                                                memcpy(tCharset.m_PlainCharset, sCharsetContent.c_str(), tCharset.m_nPlainCharsetLen);
                                                tCharset.m_sPlainCharsetName = sCharsetName;
@@ -149,6 +182,7 @@ bool CChainWalkContext::LoadCharset(string sName)
        }
        else
                printf("can't open charset configuration file\n");
        }
        else
                printf("can't open charset configuration file\n");
+
        return false;
 }
 
        return false;
 }
 
@@ -189,7 +223,7 @@ bool CChainWalkContext::SetPlainCharset(string sCharsetName, int nPlainLenMin, i
        m_nPlainLenMaxTotal = 0;
        m_nPlainLenMinTotal = 0;
        uint64 nTemp = 1;
        m_nPlainLenMaxTotal = 0;
        m_nPlainLenMinTotal = 0;
        uint64 nTemp = 1;
-       int j, k = 1;
+       uint32 j, k = 1;
        for(j = 0; j < m_vCharset.size(); j++)
        {
                int i;
        for(j = 0; j < m_vCharset.size(); j++)
        {
                int i;
@@ -280,7 +314,7 @@ bool CChainWalkContext::SetupWithPathName(string sPathName, int& nRainbowChainLe
        }
        else
        {
        }
        else
        {
-               if (sCharsetDefinition.find('#') == -1)         // For backward compatibility, "#1-7" is implied
+               if ( sCharsetDefinition.find('#') == string::npos )             // For backward compatibility, "#1-7" is implied
                {                       
                        sCharsetName = sCharsetDefinition;
                        nPlainLenMin = 1;
                {                       
                        sCharsetName = sCharsetDefinition;
                        nPlainLenMin = 1;
@@ -424,29 +458,32 @@ void CChainWalkContext::IndexToPlain()
                m_nPlainLen = m_nPlainLenMinTotal;
        uint64 nIndexOfX = m_nIndex - m_nPlainSpaceUpToX[m_nPlainLen - 1];
 
                m_nPlainLen = m_nPlainLenMinTotal;
        uint64 nIndexOfX = m_nIndex - m_nPlainSpaceUpToX[m_nPlainLen - 1];
 
-#ifdef _WIN64
+// this is the generic code for non ia32 x86 platforms
+#if !defined(_M_X86) && !defined(__i386__)
        
        
-       // Slow version
+       // 32-bit/generic version (slow for non 64-bit platforms)
        for (i = m_nPlainLen - 1; i >= 0; i--)
        {
                int nCharsetLen = 0;
        for (i = m_nPlainLen - 1; i >= 0; i--)
        {
                int nCharsetLen = 0;
-               for(int j = 0; j < m_vCharset.size(); i++)
+               for(uint32 j = 0; j < m_vCharset.size(); i++)
                {
                        nCharsetLen += m_vCharset[j].m_nPlainLenMax;
                        if(i < nCharsetLen) // We found the correct charset
                        {
                {
                        nCharsetLen += m_vCharset[j].m_nPlainLenMax;
                        if(i < nCharsetLen) // We found the correct charset
                        {
-                               m_Plain[i] = m_vCharset[j].m_PlainCharset[nIndexOfX % m_nPlainCharsetLen];
+                               m_Plain[i] = m_vCharset[j].m_PlainCharset[nIndexOfX % m_vCharset[j].m_nPlainCharsetLen];
                                nIndexOfX /= m_vCharset[j].m_nPlainCharsetLen;
                                nIndexOfX /= m_vCharset[j].m_nPlainCharsetLen;
+                               break;
                        }
                }
        }
 #else
 
 
                        }
                }
        }
 #else
 
 
-       // Fast version
+       // Fast ia32 version
        for (i = m_nPlainLen - 1; i >= 0; i--)
        {
        for (i = m_nPlainLen - 1; i >= 0; i--)
        {
-#ifdef _WIN32
+               // 0x100000000 = 2^32
+#ifdef _M_X86
                if (nIndexOfX < 0x100000000I64)
                        break;
 #else
                if (nIndexOfX < 0x100000000I64)
                        break;
 #else
@@ -454,7 +491,7 @@ void CChainWalkContext::IndexToPlain()
                        break;
 #endif
                int nCharsetLen = 0;
                        break;
 #endif
                int nCharsetLen = 0;
-               for(int j = 0; j < m_vCharset.size(); j++)
+               for(uint32 j = 0; j < m_vCharset.size(); j++)
                {
                        nCharsetLen += m_vCharset[j].m_nPlainLenMax;
                        if(i < nCharsetLen) // We found the correct charset
                {
                        nCharsetLen += m_vCharset[j].m_nPlainLenMax;
                        if(i < nCharsetLen) // We found the correct charset
@@ -466,27 +503,30 @@ void CChainWalkContext::IndexToPlain()
                }
        }
 
                }
        }
 
-       unsigned int nIndexOfX32 = (unsigned int)nIndexOfX;
+       uint32 nIndexOfX32 = (uint32)nIndexOfX;
        for (; i >= 0; i--)
        {
                int nCharsetLen = 0;
        for (; i >= 0; i--)
        {
                int nCharsetLen = 0;
-               for(int j = 0; j < m_vCharset.size(); j++)
+               for(uint32 j = 0; j < m_vCharset.size(); j++)
                {
                        nCharsetLen += m_vCharset[j].m_nPlainLenMax;
                        if(i < nCharsetLen) // We found the correct charset
                        {
 
                {
                        nCharsetLen += m_vCharset[j].m_nPlainLenMax;
                        if(i < nCharsetLen) // We found the correct charset
                        {
 
-//             m_Plain[i] = m_PlainCharset[nIndexOfX32 % m_vCharset[j].m_nPlainCharsetLen];
+//             m_Plain[i] = m_vCharset[j].m_PlainCharset[nIndexOfX32 % m_vCharset[j].m_nPlainCharsetLen];
 //             nIndexOfX32 /= m_vCharset[j].m_nPlainCharsetLen;
 
 //             nIndexOfX32 /= m_vCharset[j].m_nPlainCharsetLen;
 
-               unsigned int nPlainCharsetLen = m_vCharset[j].m_nPlainCharsetLen;
+// moving nPlainCharsetLen into the asm body and avoiding the extra temp
+// variable results in performance gain
+//             unsigned int nPlainCharsetLen = m_vCharset[j].m_nPlainCharsetLen;
                unsigned int nTemp;
                unsigned int nTemp;
-#ifdef _WIN32
+
+#if defined(_WIN32) && !defined(__GNUC__)
                __asm
                {
                        mov eax, nIndexOfX32
                        xor edx, edx
                __asm
                {
                        mov eax, nIndexOfX32
                        xor edx, edx
-                       div nPlainCharsetLen
+                       div m_vCharset[j].m_nPlainCharsetLen
                        mov nIndexOfX32, eax
                        mov nTemp, edx
                }
                        mov nIndexOfX32, eax
                        mov nTemp, edx
                }
@@ -498,7 +538,7 @@ void CChainWalkContext::IndexToPlain()
                                                                "mov %%eax, %0;"
                                                                "mov %%edx, %1;"
                                                                : "=m"(nIndexOfX32), "=m"(nTemp)
                                                                "mov %%eax, %0;"
                                                                "mov %%edx, %1;"
                                                                : "=m"(nIndexOfX32), "=m"(nTemp)
-                                                               : "m"(nIndexOfX32), "m"(nPlainCharsetLen)
+                                                               : "m"(nIndexOfX32), "m"(m_vCharset[j].m_nPlainCharsetLen)
                                                                : "%eax", "%edx"
                                                         );
                m_Plain[i] = m_vCharset[j].m_PlainCharset[nTemp];
                                                                : "%eax", "%edx"
                                                         );
                m_Plain[i] = m_vCharset[j].m_PlainCharset[nTemp];
index 909f79cf5ada7695c4ab2d7f83dc719134c5f58a..e6f92c0c17a586e969c7380fee5bfc9b71ff031d 100644 (file)
@@ -1,16 +1,49 @@
 /*
 /*
-   RainbowCrack - a general propose implementation of Philippe Oechslin's faster time-memory trade-off technique.
-
-   Copyright (C) Zhu Shuanglei <shuanglei@hotmail.com>
-*/
+ * freerainbowtables is a project for generating, distributing, and using
+ * perfect rainbow tables
+ *
+ * Copyright (C) Zhu Shuanglei <shuanglei@hotmail.com>
+ * Copyright Martin Westergaard Jørgensen <martinwj2005@gmail.com>
+ * Copyright 2009, 2010 Daniël Niggebrugge <niggebrugge@fox-it.com>
+ * Copyright 2009, 2010 James Nobis <frt@quelrod.net>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ *
+ * Changes: not using OpenSSL routines the slow way anymore, as suggested by jci.
+ */
 
 #include "HashAlgorithm.h"
 
 #include "Public.h"
 
 #include "HashAlgorithm.h"
 
 #include "Public.h"
+
 #include <string.h>
 #include <string.h>
+
+//#include <openssl/md2.h>
 #include "md4.h"
 #include "md5.h"
 #include "des.h"
 #include "md4.h"
 #include "md5.h"
 #include "des.h"
+//#include "sha1.h"
+#if defined(_WIN32) && !defined(__GNUC__)
+       #pragma comment(lib, "libeay32.lib")
+#endif
+
+#ifdef __NetBSD__
+       #include <des.h>
+#endif
+
 #define MSCACHE_HASH_SIZE 16
 void setup_des_key(unsigned char key_56[], des_key_schedule &ks)
 {
 #define MSCACHE_HASH_SIZE 16
 void setup_des_key(unsigned char key_56[], des_key_schedule &ks)
 {
@@ -97,32 +130,38 @@ void HashHALFLMCHALL(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)
 
 void HashNTLMCHALL(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)
 {
 
 void HashNTLMCHALL(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)
 {
-  unsigned char UnicodePlain[MAX_PLAIN_LEN];
-  static unsigned char spoofed_challange[] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88}; 
-  
-  int len = (nPlainLen < 127) ? nPlainLen : 127;
-  int i;
-  
-  for (i = 0; i < len; i++)
-  {
-    UnicodePlain[i * 2] = pPlain[i];
-    UnicodePlain[i * 2 + 1] = 0x00;
-  }
-
-  des_key_schedule ks;
-  unsigned char lm[21];
-
-  MD4_NEW(UnicodePlain, len * 2, lm);
-  lm[16] = lm[17] = lm[18] = lm[19] = lm[20] = 0;
-
-  setup_des_key(lm, ks);
-  des_ecb_encrypt((des_cblock*)spoofed_challange, (des_cblock*)pHash, ks, DES_ENCRYPT);
-
-  setup_des_key(&lm[7], ks);
-  des_ecb_encrypt((des_cblock*)spoofed_challange, (des_cblock*)&pHash[8], ks, DES_ENCRYPT);
-
-  setup_des_key(&lm[14], ks);
-  des_ecb_encrypt((des_cblock*)spoofed_challange, (des_cblock*)&pHash[16], ks, DES_ENCRYPT);
+       unsigned char UnicodePlain[MAX_PLAIN_LEN];
+       static unsigned char spoofed_challange[] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88}; 
+       
+       int len = (nPlainLen < 127) ? nPlainLen : 127;
+       int i;
+       
+       for (i = 0; i < len; i++)
+       {
+       UnicodePlain[i * 2] = pPlain[i];
+       UnicodePlain[i * 2 + 1] = 0x00;
+       }
+       
+       des_key_schedule ks;
+       unsigned char lm[21];
+       
+       /*MD4_CTX ctx;
+       MD4_Init(&ctx);
+       MD4_Update(&ctx, UnicodePlain, len * 2);
+       MD4_Final(lm, &ctx);  */
+       MD4_NEW(UnicodePlain, len * 2, lm);
+       
+       //MD4(UnicodePlain, len * 2, lm);
+       lm[16] = lm[17] = lm[18] = lm[19] = lm[20] = 0;
+       
+       setup_des_key(lm, ks);
+       des_ecb_encrypt((des_cblock*)spoofed_challange, (des_cblock*)pHash, ks, DES_ENCRYPT);
+       
+       setup_des_key(&lm[7], ks);
+       des_ecb_encrypt((des_cblock*)spoofed_challange, (des_cblock*)&pHash[8], ks, DES_ENCRYPT);
+       
+       setup_des_key(&lm[14], ks);
+       des_ecb_encrypt((des_cblock*)spoofed_challange, (des_cblock*)&pHash[16], ks, DES_ENCRYPT);
 }
 
 /*
 }
 
 /*
@@ -183,12 +222,19 @@ void HashNTLM(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)
 
        MD4_NEW(UnicodePlain, nPlainLen * 2, pHash);
 }
 
        MD4_NEW(UnicodePlain, nPlainLen * 2, pHash);
 }
+
 /*
 void HashMD2(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)
 {
 /*
 void HashMD2(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)
 {
-       MD2(pPlain, nPlainLen, pHash);
+       MD2_CTX ctx;
+       MD2_Init(&ctx);
+       MD2_Update(&ctx, pPlain, nPlainLen);
+       MD2_Final(pHash, &ctx);
+
+       //MD2(pPlain, nPlainLen, pHash);
 }
 */
 }
 */
+
 void HashMD4(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)
 {
        MD4_NEW(pPlain, nPlainLen, pHash);
 void HashMD4(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)
 {
        MD4_NEW(pPlain, nPlainLen, pHash);
@@ -205,15 +251,24 @@ void HashDoubleMD5(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)
        memcpy(hash, pHash, 16);
        MD5_NEW(hash, 16, pHash);
 }
        memcpy(hash, pHash, 16);
        MD5_NEW(hash, 16, pHash);
 }
+
 /*
 void HashSHA1(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)
 {
 /*
 void HashSHA1(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)
 {
-       SHA1(pPlain, nPlainLen, pHash);
+       SHA_CTX ctx;
+       SHA1_Init(&ctx);
+       SHA1_Update(&ctx, (unsigned char *) pPlain, nPlainLen);
+       SHA1_Final(pHash, &ctx);
 }
 
 void HashRIPEMD160(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)
 {
 }
 
 void HashRIPEMD160(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)
 {
-       RIPEMD160(pPlain, nPlainLen, pHash);
+       RIPEMD160_CTX ctx;
+       RIPEMD160_Init(&ctx);
+       RIPEMD160_Update(&ctx, pPlain, nPlainLen);
+       RIPEMD160_Final(pHash, &ctx);  
+
+       //RIPEMD160(pPlain, nPlainLen, pHash);
 }
 
 void HashMSCACHE(unsigned char *pPlain, int nPlainLen, unsigned char* pHash)
 }
 
 void HashMSCACHE(unsigned char *pPlain, int nPlainLen, unsigned char* pHash)
@@ -241,9 +296,7 @@ void HashMSCACHE(unsigned char *pPlain, int nPlainLen, unsigned char* pHash)
                unicode_user[i*2+1] = 0x00;
        }
 
                unicode_user[i*2+1] = 0x00;
        }
 
-       MD4_Init(&ctx);
-       MD4_Update(&ctx,unicode_pwd,nPlainLen*2);
-       MD4_Final(final1,&ctx);
+       MD4_NEW( (unsigned char*)unicode_pwd, nPlainLen*2, final1 );
 
        MD4_Init(&ctx);
        MD4_Update(&ctx,final1,MD4_DIGEST_LENGTH);
 
        MD4_Init(&ctx);
        MD4_Update(&ctx,final1,MD4_DIGEST_LENGTH);
@@ -256,7 +309,7 @@ void HashMSCACHE(unsigned char *pPlain, int nPlainLen, unsigned char* pHash)
        {
                unicode_pwd[i*2] = pPlain[i];
                unicode_pwd[i*2+1] = 0x00;
        {
                unicode_pwd[i*2] = pPlain[i];
                unicode_pwd[i*2+1] = 0x00;
-       }*/     
+       }*/
        /*
        unsigned char *buf = (unsigned char*)calloc(MSCACHE_HASH_SIZE + nSaltLength, sizeof(unsigned char));    
        HashNTLM(pPlain, nPlainLen, buf, NULL);
        /*
        unsigned char *buf = (unsigned char*)calloc(MSCACHE_HASH_SIZE + nSaltLength, sizeof(unsigned char));    
        HashNTLM(pPlain, nPlainLen, buf, NULL);
@@ -273,19 +326,19 @@ void HashMSCACHE(unsigned char *pPlain, int nPlainLen, unsigned char* pHash)
 /*
 inline void mysql_hash_password_323(unsigned long *result, const char *password) 
 {
 /*
 inline void mysql_hash_password_323(unsigned long *result, const char *password) 
 {
-  register unsigned long nr=1345345333L, add=7, nr2=0x12345671L;
-  unsigned long tmp;
-  for (; *password ; password++) 
-  {
-    if (*password == ' ' || *password == '\t') continue;
-       tmp= (unsigned long) (unsigned char) *password;
-       nr^= (((nr & 63)+add)*tmp)+ (nr << 8);
-       nr2+=(nr2 << 8) ^ nr;
-       add+=tmp;
-  }
-  result[0]=nr & (((unsigned long) 1L << 31) -1L); ;
-  result[1]=nr2 & (((unsigned long) 1L << 31) -1L);
-  return;
+       register unsigned long nr=1345345333L, add=7, nr2=0x12345671L;
+       unsigned long tmp;
+       for (; *password ; password++) 
+       {
+               if (*password == ' ' || *password == '\t') continue;
+               tmp= (unsigned long) (unsigned char) *password;
+               nr^= (((nr & 63)+add)*tmp)+ (nr << 8);
+               nr2+=(nr2 << 8) ^ nr;
+               add+=tmp;
+       }
+       result[0]=nr & (((unsigned long) 1L << 31) -1L); // Don't use sign bit (str2int)
+       result[1]=nr2 & (((unsigned long) 1L << 31) -1L);
+       return;
 }
 
 void HashMySQL323(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)
 }
 
 void HashMySQL323(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)
@@ -316,18 +369,19 @@ void HashMySQLSHA1(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)
        SHA1_Final(pHash, &ctx);
 }
 */
        SHA1_Final(pHash, &ctx);
 }
 */
+
 //*********************************************************************************
 // Code for PIX password hashing
 //*********************************************************************************
 static char itoa64[] =          /* 0 ... 63 => ascii - 64 */
 //*********************************************************************************
 // Code for PIX password hashing
 //*********************************************************************************
 static char itoa64[] =          /* 0 ... 63 => ascii - 64 */
-        "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+       "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
 
 void _crypt_to64(char *s, unsigned long v, int n)
 {
 
 void _crypt_to64(char *s, unsigned long v, int n)
 {
-        while (--n >= 0) {
-                *s++ = itoa64[v&0x3f];
-                v >>= 6;
-        }
+       while (--n >= 0) {
+               *s++ = itoa64[v&0x3f];
+               v >>= 6;
+       }
 }
 /*
 void HashPIX(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)
 }
 /*
 void HashPIX(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)
@@ -342,6 +396,7 @@ void HashPIX(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)
        MD5_Init(&ctx);
        MD5_Update(&ctx, (unsigned char *) pass, MD5_DIGEST_LENGTH);
        MD5_Final(final, &ctx);
        MD5_Init(&ctx);
        MD5_Update(&ctx, (unsigned char *) pass, MD5_DIGEST_LENGTH);
        MD5_Final(final, &ctx);
+       MD5_NEW((unsigned char *) pass, MD5_DIGEST_LENGTH, final);
 
        char* p = (char*) temp;
        _crypt_to64(p,*(unsigned long*) (final+0),4); p += 4;
 
        char* p = (char*) temp;
        _crypt_to64(p,*(unsigned long*) (final+0),4); p += 4;
@@ -355,3 +410,15 @@ void HashPIX(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)
        free (pass);
 }
 */
        free (pass);
 }
 */
+#if !defined(_WIN32) || defined(__GNUC__)
+char *strupr(char *s1)
+{
+       char *p = s1;
+       while(*p)
+       {
+               *p = (char) toupper(*p);
+               p++;
+       }
+       return s1;
+}
+#endif
index 667245aa290daea63cd306aa5e1df911c869ad4b..01a4d74ca8c3e7eca859f807a218271f64f92a39 100644 (file)
@@ -1,8 +1,27 @@
 /*
 /*
-   RainbowCrack - a general propose implementation of Philippe Oechslin's faster time-memory trade-off technique.
-
-   Copyright (C) Zhu Shuanglei <shuanglei@hotmail.com>
-*/
+ * freerainbowtables is a project for generating, distributing, and using
+ * perfect rainbow tables
+ *
+ * Copyright (C) Zhu Shuanglei <shuanglei@hotmail.com>
+ * Copyright Martin Westergaard Jørgensen <martinwj2005@gmail.com>
+ * Copyright 2009, 2010 Daniël Niggebrugge <niggebrugge@fox-it.com>
+ * Copyright 2009, 2010 James Nobis <frt@quelrod.net>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
 
 #ifndef _HASHALGORITHM_H
 #define _HASHALGORITHM_H
 
 #ifndef _HASHALGORITHM_H
 #define _HASHALGORITHM_H
@@ -13,20 +32,23 @@ void HashNTLM(unsigned char* pPlain, int nPlainLen, unsigned char* pHash);
 void HashMD4(unsigned char* pPlain, int nPlainLen, unsigned char* pHash);
 void HashMD5(unsigned char* pPlain, int nPlainLen, unsigned char* pHash);
 void HashDoubleMD5(unsigned char* pPlain, int nPlainLen, unsigned char* pHash);
 void HashMD4(unsigned char* pPlain, int nPlainLen, unsigned char* pHash);
 void HashMD5(unsigned char* pPlain, int nPlainLen, unsigned char* pHash);
 void HashDoubleMD5(unsigned char* pPlain, int nPlainLen, unsigned char* pHash);
-/*void HashSHA1(unsigned char* pPlain, int nPlainLen, unsigned char* pHash);
-void HashRIPEMD160(unsigned char* pPlain, int nPlainLen, unsigned char* pHash);
+void HashSHA1(unsigned char* pPlain, int nPlainLen, unsigned char* pHash);
+//void HashRIPEMD160(unsigned char* pPlain, int nPlainLen, unsigned char* pHash);
 void HashMSCACHE(unsigned char *pPlain, int nPlainLen, unsigned char* pHash);
 void HashMSCACHE(unsigned char *pPlain, int nPlainLen, unsigned char* pHash);
+
 //****************************************************************************
 // MySQL Password Hashing
 //****************************************************************************
 //****************************************************************************
 // MySQL Password Hashing
 //****************************************************************************
+
 void HashMySQL323(unsigned char* pPlain, int nPlainLen, unsigned char* pHash);
 void HashMySQLSHA1(unsigned char* pPlain, int nPlainLen, unsigned char* pHash);
 
 //****************************************************************************
 // Cisco PIX Password Hashing
 //****************************************************************************
 void HashMySQL323(unsigned char* pPlain, int nPlainLen, unsigned char* pHash);
 void HashMySQLSHA1(unsigned char* pPlain, int nPlainLen, unsigned char* pHash);
 
 //****************************************************************************
 // Cisco PIX Password Hashing
 //****************************************************************************
+
 void HashPIX(unsigned char* pPlain, int nPlainLen, unsigned char* pHash);
 void HashPIX(unsigned char* pPlain, int nPlainLen, unsigned char* pHash);
-*/
+
 //****************************************************************************
 // (HALF) LM CHALL hashing
 void HashLMCHALL(unsigned char* pPlain, int nPlainLen, unsigned char* pHash);
 //****************************************************************************
 // (HALF) LM CHALL hashing
 void HashLMCHALL(unsigned char* pPlain, int nPlainLen, unsigned char* pHash);
@@ -34,6 +56,9 @@ void HashHALFLMCHALL(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)
 
 // From mao
 void HashNTLMCHALL(unsigned char* pPlain, int nPlainLen, unsigned char* pHash);
 
 // From mao
 void HashNTLMCHALL(unsigned char* pPlain, int nPlainLen, unsigned char* pHash);
-//void HashORACLE(unsigned char* pPlain, int nPlainLen, unsigned char* pHash);
+void HashORACLE(unsigned char* pPlain, int nPlainLen, unsigned char* pHash);
 
 
+#if !defined(_WIN32) || defined(__GNUC__)
+char *strupr(char *s1);
+#endif
 #endif
 #endif
index 496f399d11a1736e4f3e121e698a0b0daddfd635..6d72c4b3813163b281a4d852a2bc83fa67a6484d 100644 (file)
@@ -53,7 +53,7 @@ void CHashRoutine::AddHashRoutine(string sHashRoutineName, HASHROUTINE pHashRout
 string CHashRoutine::GetAllHashRoutineName()
 {
        string sRet;
 string CHashRoutine::GetAllHashRoutineName()
 {
        string sRet;
-       int i;
+       uint32 i;
        for (i = 0; i < vHashRoutineName.size(); i++)
                sRet += vHashRoutineName[i] + " ";
 
        for (i = 0; i < vHashRoutineName.size(); i++)
                sRet += vHashRoutineName[i] + " ";
 
@@ -62,7 +62,7 @@ string CHashRoutine::GetAllHashRoutineName()
 
 void CHashRoutine::GetHashRoutine(string sHashRoutineName, HASHROUTINE& pHashRoutine, int& nHashLen)
 {
 
 void CHashRoutine::GetHashRoutine(string sHashRoutineName, HASHROUTINE& pHashRoutine, int& nHashLen)
 {
-       int i;
+       uint32 i;
        for (i = 0; i < vHashRoutineName.size(); i++)
        {
                if (sHashRoutineName == vHashRoutineName[i])
        for (i = 0; i < vHashRoutineName.size(); i++)
        {
                if (sHashRoutineName == vHashRoutineName[i])
index 681fa786c4a8a5e336f192ac999c99802eafae8e..4b53c1474139fe48af90c79cbdbd55f23585ea56 100644 (file)
@@ -9,6 +9,9 @@
 
 #include <string>
 #include <vector>
 
 #include <string>
 #include <vector>
+
+#include "global.h"
+
 using namespace std;
 
 typedef void (*HASHROUTINE)(unsigned char* pPlain, int nPlainLen, unsigned char* pHash);
 using namespace std;
 
 typedef void (*HASHROUTINE)(unsigned char* pPlain, int nPlainLen, unsigned char* pHash);
index f917d3720fa69301ba8767697ca46289ea4d0431..66e8ce46638521020d0dc13b4f76bd3c3e171403 100644 (file)
@@ -1,7 +1,26 @@
 /*
 /*
-   RainbowCrack - a general propose implementation of Philippe Oechslin's faster time-memory trade-off technique.
-
-   Copyright (C) Zhu Shuanglei <shuanglei@hotmail.com>
+ * freerainbowtables is a project for generating, distributing, and using
+ * perfect rainbow tables
+ *
+ * Copyright (C) Zhu Shuanglei <shuanglei@hotmail.com>
+ * Copyright Martin Westergaard Jørgensen <martinwj2005@gmail.com>
+ * Copyright 2009, 2010 Daniël Niggebrugge <niggebrugge@fox-it.com>
+ * Copyright 2009, 2010 James Nobis <frt@quelrod.net>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
 */
 
 #ifdef _WIN32
 */
 
 #ifdef _WIN32
 
 #ifdef _WIN32
        #include <windows.h>
 
 #ifdef _WIN32
        #include <windows.h>
-#else
-       #include <sys/sysinfo.h>
+#elif defined(__APPLE__) || \
+       ((defined(__unix__) || defined(unix)) && !defined(USG))
+
+       #include <sys/param.h>
+
+       #if defined(BSD)
+               #include <sys/sysctl.h>
+       #elif defined(__linux__)
+               #include <sys/sysinfo.h>
+       #else
+               #error Unsupported Operating system
+       #endif
 #endif
 
 //////////////////////////////////////////////////////////////////////
 #endif
 
 //////////////////////////////////////////////////////////////////////
@@ -72,12 +101,13 @@ bool GetHybridCharsets(string sCharset, vector<tCharset>& vCharset)
        // Example: hybrid(mixalpha-numeric-all-space#1-6,numeric#1-4)
        if(sCharset.substr(0, 6) != "hybrid") // Not hybrid charset
                return false;
        // Example: hybrid(mixalpha-numeric-all-space#1-6,numeric#1-4)
        if(sCharset.substr(0, 6) != "hybrid") // Not hybrid charset
                return false;
-       size_t nEnd = sCharset.rfind(')');
-       size_t nStart = sCharset.rfind('(');
+
+       UINT4 nEnd = (int) sCharset.rfind(')');
+       UINT4 nStart = (int) sCharset.rfind('(');
        string sChar = sCharset.substr(nStart + 1, nEnd - nStart - 1);
        vector<string> vParts;
        SeperateString(sChar, ",", vParts);
        string sChar = sCharset.substr(nStart + 1, nEnd - nStart - 1);
        vector<string> vParts;
        SeperateString(sChar, ",", vParts);
-       for(int i = 0; i < vParts.size(); i++)
+       for(UINT4 i = 0; i < vParts.size(); i++)
        {
                tCharset stCharset;
                vector<string> vParts2;
        {
                tCharset stCharset;
                vector<string> vParts2;
@@ -95,15 +125,16 @@ bool GetHybridCharsets(string sCharset, vector<tCharset>& vCharset)
 bool boinc_ReadLinesFromFile(string sPathName, vector<string>& vLine)
 {
        vLine.clear();
 bool boinc_ReadLinesFromFile(string sPathName, vector<string>& vLine)
 {
        vLine.clear();
-    char input_path[512];
-    boinc_resolve_filename(sPathName.c_str(), input_path, sizeof(input_path));
-    FILE *file = boinc_fopen(input_path, "rb");
-    if (!file) {
-        fprintf(stderr,
-            "Couldn't find input file, resolved name %s.\n", input_path
-        );
-        exit(-1);
-    }
+       char input_path[512];
+       boinc_resolve_filename(sPathName.c_str(), input_path, sizeof(input_path));
+       FILE *file = boinc_fopen(input_path, "rb");
+       if (!file) {
+               fprintf(stderr,
+                       "Couldn't find input file, resolved name %s.\n", input_path
+               );
+               exit(-1);
+       }
+
        if (file != NULL)
        {
                unsigned int len = GetFileLen(file);
        if (file != NULL)
        {
                unsigned int len = GetFileLen(file);
@@ -112,7 +143,7 @@ bool boinc_ReadLinesFromFile(string sPathName, vector<string>& vLine)
                data[len] = '\0';
                string content = data;
                content += "\n";
                data[len] = '\0';
                string content = data;
                content += "\n";
-               delete data;
+               delete [] data;
 
                unsigned int i;
                for (i = 0; i < content.size(); i++)
 
                unsigned int i;
                for (i = 0; i < content.size(); i++)
@@ -253,9 +284,38 @@ unsigned int GetAvailPhysMemorySize()
 #endif
 }
 
 #endif
 }
 
+string GetApplicationPath()
+{
+       char fullPath[FILENAME_MAX];
+
+#ifdef _WIN32
+       GetModuleFileName(NULL, fullPath, FILENAME_MAX);
+#else
+       char szTmp[32];
+       // XXX linux/proc file system dependent
+       sprintf(szTmp, "/proc/%d/exe", getpid());
+       int bytes = readlink(szTmp, fullPath, FILENAME_MAX);
+
+       if( bytes >= 0 )
+               fullPath[bytes] = '\0';
+#endif
+
+       string sApplicationPath = fullPath;
+#ifdef _WIN32
+       int nIndex = sApplicationPath.find_last_of('\\');
+#else
+       int nIndex = sApplicationPath.find_last_of('/');
+#endif
+
+       if ( nIndex != -1 )
+               sApplicationPath = sApplicationPath.substr(0, nIndex+1);
+
+       return sApplicationPath;
+}
+
 void ParseHash(string sHash, unsigned char* pHash, int& nHashLen)
 {
 void ParseHash(string sHash, unsigned char* pHash, int& nHashLen)
 {
-       int i;
+       uint32 i;
        for (i = 0; i < sHash.size() / 2; i++)
        {
                string sSub = sHash.substr(i * 2, 2);
        for (i = 0; i < sHash.size() / 2; i++)
        {
                string sSub = sHash.substr(i * 2, 2);
index 3a315ae56fc55db6d886d1f52d7c386118156704..b3103f7d3dda3cedba6f0f9037081448af467967 100644 (file)
@@ -1,24 +1,41 @@
 /*
 /*
-   RainbowCrack - a general propose implementation of Philippe Oechslin's faster time-memory trade-off technique.
-
-   Copyright (C) Zhu Shuanglei <shuanglei@hotmail.com>
-*/
+ * freerainbowtables is a project for generating, distributing, and using
+ * perfect rainbow tables
+ *
+ * Copyright (C) Zhu Shuanglei <shuanglei@hotmail.com>
+ * Copyright 2009, 2010 Daniël Niggebrugge <niggebrugge@fox-it.com>
+ * Copyright 2009, 2010 James Nobis <frt@quelrod.net>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
 
 #ifndef _PUBLIC_H
 #define _PUBLIC_H
 
 #include <stdio.h>
 
 #ifndef _PUBLIC_H
 #define _PUBLIC_H
 
 #include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 
 #include <string>
 #include <vector>
 #include <list>
 
 #include <string>
 #include <vector>
 #include <list>
-using namespace std;
 
 
-#ifdef _WIN32
-       #define uint64 unsigned __int64
-#else
-       #define uint64 u_int64_t
-#endif
+#include "global.h"
+
+using namespace std;
 
 struct RainbowChain
 {
 
 struct RainbowChain
 {
@@ -35,8 +52,8 @@ struct RainbowChainCP
 struct IndexChain
 {
        uint64 nPrefix;
 struct IndexChain
 {
        uint64 nPrefix;
-       int nFirstChain;
-       unsigned int nChainCount;
+       UINT4 nFirstChain;
+       UINT4 nChainCount;
 };
 struct FoundRainbowChain
 {
 };
 struct FoundRainbowChain
 {
@@ -77,6 +94,7 @@ string uint64tostr(uint64 n);
 string uint64tohexstr(uint64 n);
 string HexToStr(const unsigned char* pData, int nLen);
 unsigned int GetAvailPhysMemorySize();
 string uint64tohexstr(uint64 n);
 string HexToStr(const unsigned char* pData, int nLen);
 unsigned int GetAvailPhysMemorySize();
+string GetApplicationPath();
 void ParseHash(string sHash, unsigned char* pHash, int& nHashLen);
 bool GetHybridCharsets(string sCharset, vector<tCharset>& vCharset);
 void Logo();
 void ParseHash(string sHash, unsigned char* pHash, int& nHashLen);
 bool GetHybridCharsets(string sCharset, vector<tCharset>& vCharset);
 void Logo();
index abe140182c6544218cd3faeaee91388adc25eabb..8063f1e688b97eba74761112bfa540b2ffe0b24a 100644 (file)
 #ifdef  __cplusplus
 extern "C" {
 #endif
 #ifdef  __cplusplus
 extern "C" {
 #endif
-typedef unsigned int u_int32_t;
 
 
+#ifndef u_int32_t
+       typedef unsigned int u_int32_t;
+#endif
+               
 /* must be 32bit quantity */
 #define DES_LONG u_int32_t
 
 /* must be 32bit quantity */
 #define DES_LONG u_int32_t
 
index 320f570317885eed530412242d211957b94d3b22..a2dd9131cb7dbe0e7ab85356a7daa6266048fc77 100644 (file)
@@ -60,6 +60,7 @@
  */
 
 #include "des_locl.h"
  */
 
 #include "des_locl.h"
+#include "spr.h"
 
 extern const DES_LONG des_SPtrans[8][64];
 void des_encrypt1(DES_LONG *data, des_key_schedule ks, int enc)
 
 extern const DES_LONG des_SPtrans[8][64];
 void des_encrypt1(DES_LONG *data, des_key_schedule ks, int enc)
index 04c4e804dd1cd7b68f23398fa6adb916ac013655..56aa04e408657fc2f9d1a022714addaeac6f170a 100644 (file)
@@ -1,31 +1,29 @@
 /*
 /*
- * rcracki_mt is a multithreaded implementation and fork of the original 
- * RainbowCrack
+ * freerainbowtables is a project for generating, distributing, and using
+ * perfect rainbow tables
  *
  * Copyright 2009, 2010 Daniël Niggebrugge <niggebrugge@fox-it.com>
  * Copyright 2009, 2010 James Nobis <frt@quelrod.net>
  *
  *
  * Copyright 2009, 2010 Daniël Niggebrugge <niggebrugge@fox-it.com>
  * Copyright 2009, 2010 James Nobis <frt@quelrod.net>
  *
- * This file is part of racrcki_mt.
+ * This file is part of freerainbowtables.
  *
  *
- * rcracki_mt is free software: you can redistribute it and/or modify
+ * 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.
  *
  * 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.
  *
- * rcracki_mt is distributed in the hope that it will be useful,
+ * 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
  * 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 rcracki_mt.  If not, see <http://www.gnu.org/licenses/>.
+ * along with freerainbowtables.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef _GLOBAL_H
 #define _GLOBAL_H
 
  */
 
 #ifndef _GLOBAL_H
 #define _GLOBAL_H
 
-//#include <stdint.h>
-
 #if defined(_WIN32) && !defined(__GNUC__)
        #define uint64 unsigned __int64
 #else
 #if defined(_WIN32) && !defined(__GNUC__)
        #define uint64 unsigned __int64
 #else
 
 #if defined(_WIN32) && !defined(__GNUC__)
        #define UINT4 unsigned __int32
 
 #if defined(_WIN32) && !defined(__GNUC__)
        #define UINT4 unsigned __int32
+       #define uint32 unsigned __int32
 #else
        #ifndef u_int32_t
                #define UINT4 unsigned int
 #else
        #ifndef u_int32_t
                #define UINT4 unsigned int
+               #define uint32 unsigned int
        #else
                #define UINT4 u_int32_t
        #else
                #define UINT4 u_int32_t
+               #define uint32 u_int32_t
        #endif
 #endif
 
        #endif
 #endif
 
index 8a5c428c40984c938f0fc633d723fc917651aee2..249ebcd54b31f67b4b4c477fc7a1610c1739982b 100644 (file)
@@ -1,8 +1,7 @@
 #ifndef MD4_H
 #define MD4_H
 
 #ifndef MD4_H
 #define MD4_H
 
-//typedef unsigned long uint32;
-typedef unsigned long UINT4;
+#include "global.h"
 
 //Main function
 void MD4_NEW( unsigned char * buf, int len, unsigned char * pDigest);
 
 //Main function
 void MD4_NEW( unsigned char * buf, int len, unsigned char * pDigest);
index 1d3da9e50e27ccbcd4e14a8996fa6c8c950e638f..f245420a7ca0d1ac3fd835df86b926cef58b9e3a 100644 (file)
@@ -1,7 +1,9 @@
 #ifndef MD5_H
 #define MD5_H
 
 #ifndef MD5_H
 #define MD5_H
 
-typedef unsigned long uint32;
+#include "global.h"
+
+#define MD5_DIGEST_LENGTH 16
 
 //Main function
 void MD5_NEW( unsigned char * buf, int len, unsigned char * pDigest);
 
 //Main function
 void MD5_NEW( unsigned char * buf, int len, unsigned char * pDigest);
diff --git a/Common/rt api/tmp/HashAlgorithm.cpp b/Common/rt api/tmp/HashAlgorithm.cpp
deleted file mode 100644 (file)
index 07cebe5..0000000
+++ /dev/null
@@ -1,349 +0,0 @@
-/*
-   RainbowCrack - a general propose implementation of Philippe Oechslin's faster time-memory trade-off technique.
-
-   Copyright (C) Zhu Shuanglei <shuanglei@hotmail.com>
-*/
-
-#include "HashAlgorithm.h"
-
-#include "Public.h"
-
-#include <openssl/des.h>
-#include <openssl/md2.h>
-#include <openssl/md4.h>
-#include <openssl/md5.h>
-#include <openssl/sha.h>
-#include <openssl/ripemd.h>
-#ifdef _WIN32
-       #pragma comment(lib, "libeay32.lib")
-#endif
-#define MSCACHE_HASH_SIZE 16
-void setup_des_key(unsigned char key_56[], des_key_schedule &ks)
-{
-       des_cblock key;
-
-       key[0] = key_56[0];
-       key[1] = (key_56[0] << 7) | (key_56[1] >> 1);
-       key[2] = (key_56[1] << 6) | (key_56[2] >> 2);
-       key[3] = (key_56[2] << 5) | (key_56[3] >> 3);
-       key[4] = (key_56[3] << 4) | (key_56[4] >> 4);
-       key[5] = (key_56[4] << 3) | (key_56[5] >> 5);
-       key[6] = (key_56[5] << 2) | (key_56[6] >> 6);
-       key[7] = (key_56[6] << 1);
-
-       //des_set_odd_parity(&key);
-       des_set_key(&key, ks);
-}
-
-void HashLM(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)
-{
-       /*
-       unsigned char data[7] = {0};
-       memcpy(data, pPlain, nPlainLen > 7 ? 7 : nPlainLen);
-       */
-
-       int i;
-       for (i = nPlainLen; i < 7; i++)
-               pPlain[i] = 0;
-
-       static unsigned char magic[] = {0x4B, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25};
-       des_key_schedule ks;
-       //setup_des_key(data, ks);
-       setup_des_key(pPlain, ks);
-       des_ecb_encrypt((des_cblock*)magic, (des_cblock*)pHash, ks, DES_ENCRYPT);
-}
-
-void HashLMCHALL(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)
-{
-       unsigned char pass[14];
-       unsigned char pre_lmresp[21];
-       static unsigned char magic[] = {0x4B, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25};
-       static unsigned char spoofed_challange[] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88}; 
-       des_key_schedule ks;
-
-       memset (pass,0,sizeof(pass));
-       memset (pre_lmresp,0,sizeof(pre_lmresp));
-
-       memcpy (pass,pPlain, nPlainLen);
-
-       setup_des_key(pass, ks);
-       des_ecb_encrypt((des_cblock*)magic, (des_cblock*)pre_lmresp, ks, DES_ENCRYPT);
-
-       setup_des_key(&pass[7], ks);
-       des_ecb_encrypt((des_cblock*)magic, (des_cblock*)&pre_lmresp[8], ks, DES_ENCRYPT);
-
-       setup_des_key(pre_lmresp, ks);
-       des_ecb_encrypt((des_cblock*)spoofed_challange, (des_cblock*)pHash, ks, DES_ENCRYPT);
-
-       setup_des_key(&pre_lmresp[7], ks);
-       des_ecb_encrypt((des_cblock*)spoofed_challange, (des_cblock*)&pHash[8], ks, DES_ENCRYPT);
-
-       setup_des_key(&pre_lmresp[14], ks);
-       des_ecb_encrypt((des_cblock*)spoofed_challange, (des_cblock*)&pHash[16], ks, DES_ENCRYPT);
-
-} 
-
-void HashHALFLMCHALL(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)
-{      
-       unsigned char pre_lmresp[8];
-       static unsigned char magic[] = {0x4B, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25};
-       static unsigned char salt[] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88};
-
-       des_key_schedule ks;
-       unsigned char plain[8] = {0};   
-       memcpy(plain, pPlain, nPlainLen);
-       setup_des_key(plain, ks);
-       des_ecb_encrypt((des_cblock*)magic, (des_cblock*)pre_lmresp, ks, DES_ENCRYPT);
-
-       setup_des_key(pre_lmresp, ks);
-       des_ecb_encrypt((des_cblock*)salt, (des_cblock*)pHash, ks, DES_ENCRYPT);
-} 
-
-
-
-void HashNTLMCHALL(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)
-{
-  unsigned char UnicodePlain[MAX_PLAIN_LEN];
-  static unsigned char spoofed_challange[] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88}; 
-  
-  int len = (nPlainLen < 127) ? nPlainLen : 127;
-  int i;
-  
-  for (i = 0; i < len; i++)
-  {
-    UnicodePlain[i * 2] = pPlain[i];
-    UnicodePlain[i * 2 + 1] = 0x00;
-  }
-
-  des_key_schedule ks;
-  unsigned char lm[21];
-
-  MD4(UnicodePlain, len * 2, lm);
-  lm[16] = lm[17] = lm[18] = lm[19] = lm[20] = 0;
-
-  setup_des_key(lm, ks);
-  des_ecb_encrypt((des_cblock*)spoofed_challange, (des_cblock*)pHash, ks, DES_ENCRYPT);
-
-  setup_des_key(&lm[7], ks);
-  des_ecb_encrypt((des_cblock*)spoofed_challange, (des_cblock*)&pHash[8], ks, DES_ENCRYPT);
-
-  setup_des_key(&lm[14], ks);
-  des_ecb_encrypt((des_cblock*)spoofed_challange, (des_cblock*)&pHash[16], ks, DES_ENCRYPT);
-}
-
-
-void HashORACLE(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)
-{
-       char ToEncrypt[256];
-       char temp[256];
-       char username[256];
-
-       DES_cblock iv,iv2;
-       DES_key_schedule ks1,ks2;
-       unsigned char deskey_fixed[]={ 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef};
-       int i,j;
-
-       strcpy (username, "SYS");
-       int userlen = 3;
-       
-//     strupr ((char*) pPlain);
-       memset (ToEncrypt,0,sizeof(ToEncrypt));
-
-       for (i=1,j=0; j<userlen; i++,j++)
-       {
-               ToEncrypt[i] = username[j];
-               i++;
-       }
-
-       for (j=0; j<nPlainLen; i++,j++)
-       {
-               ToEncrypt[i] = pPlain[j];
-               i++;
-       }
-
-       i=i-1;
-       memset (iv,0,8);
-       memset (iv2,0,8);
-       DES_set_key((DES_cblock*) deskey_fixed, &ks1);
-       DES_ncbc_encrypt((unsigned char*) ToEncrypt, (unsigned char*) temp, i, &ks1, &iv, DES_ENCRYPT);
-       DES_set_key((DES_cblock*) &iv, &ks2);
-       DES_ncbc_encrypt((unsigned char*) ToEncrypt, (unsigned char*) temp, i, &ks2, &iv2, DES_ENCRYPT);
-       memcpy (pHash,iv2,8);
-}
-
-void HashNTLM(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)
-{
-       unsigned char UnicodePlain[MAX_PLAIN_LEN * 2];
-       int i;
-       for (i = 0; i < nPlainLen; i++)
-       {
-               UnicodePlain[i * 2] = pPlain[i];
-               UnicodePlain[i * 2 + 1] = 0x00;
-       }
-
-       MD4(UnicodePlain, nPlainLen * 2, pHash);
-}
-
-void HashMD2(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)
-{
-       MD2(pPlain, nPlainLen, pHash);
-}
-
-void HashMD4(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)
-{
-       MD4(pPlain, nPlainLen, pHash);
-}
-
-void HashMD5(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)
-{
-       MD5(pPlain, nPlainLen, pHash);
-}
-
-void HashSHA1(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)
-{
-       SHA1(pPlain, nPlainLen, pHash);
-}
-
-void HashRIPEMD160(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)
-{
-       RIPEMD160(pPlain, nPlainLen, pHash);
-}
-
-void HashMSCACHE(unsigned char *pPlain, int nPlainLen, unsigned char* pHash)
-{
-       char unicode_pwd[256];
-       char unicode_user[256];
-       static unsigned char username[] = "administrator";
-       static int userlen = 13;
-       unsigned char   final1[MD4_DIGEST_LENGTH];
-       MD4_CTX ctx;
-       int i;
-
-//     strcpy (username, "administrator");
-//     userlen = 13;
-
-       for (i=0; i<nPlainLen; i++)
-       {
-               unicode_pwd[i*2] = pPlain[i];
-               unicode_pwd[i*2+1] = 0x00;
-       }
-
-       for (i=0; i<userlen; i++)
-       {
-               unicode_user[i*2] = username[i];
-               unicode_user[i*2+1] = 0x00;
-       }
-
-       MD4_Init(&ctx);
-       MD4_Update(&ctx,unicode_pwd,nPlainLen*2);
-       MD4_Final(final1,&ctx);
-
-       MD4_Init(&ctx);
-       MD4_Update(&ctx,final1,MD4_DIGEST_LENGTH);
-       MD4_Update(&ctx,(unsigned char*) unicode_user,userlen*2);
-       MD4_Final(pHash,&ctx);
-
-       /*
-       unsigned char unicode_pwd[256];
-       for (int i=0; i<nPlainLen; i++)
-       {
-               unicode_pwd[i*2] = pPlain[i];
-               unicode_pwd[i*2+1] = 0x00;
-       }*/     
-       /*
-       unsigned char *buf = (unsigned char*)calloc(MSCACHE_HASH_SIZE + nSaltLength, sizeof(unsigned char));    
-       HashNTLM(pPlain, nPlainLen, buf, NULL);
-       //MD4(unicode_pwd, nPlainLen*2, buf);
-       memcpy(buf + MSCACHE_HASH_SIZE, pSalt, nSaltLength);
-       MD4(buf, MSCACHE_HASH_SIZE + nSaltLength, pHash); 
-       free(buf);
-       */
-}
-
-//*********************************************************************************
-// Code for MySQL password hashing
-//*********************************************************************************
-
-inline void mysql_hash_password_323(unsigned long *result, const char *password) 
-{
-  register unsigned long nr=1345345333L, add=7, nr2=0x12345671L;
-  unsigned long tmp;
-  for (; *password ; password++) 
-  {
-    if (*password == ' ' || *password == '\t') continue;
-       tmp= (unsigned long) (unsigned char) *password;
-       nr^= (((nr & 63)+add)*tmp)+ (nr << 8);
-       nr2+=(nr2 << 8) ^ nr;
-       add+=tmp;
-  }
-  result[0]=nr & (((unsigned long) 1L << 31) -1L); /* Don't use sign bit (str2int) */;
-  result[1]=nr2 & (((unsigned long) 1L << 31) -1L);
-  return;
-}
-
-void HashMySQL323(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)
-{
-       unsigned long hash_pass[2];     
-       unsigned char* f = (unsigned char*) hash_pass;
-
-       unsigned char* pass = (unsigned char*) calloc (nPlainLen+4,sizeof(unsigned char));
-       memcpy(pass,pPlain,nPlainLen);
-
-       mysql_hash_password_323(hash_pass, (char*) pass);
-       pHash[0]=*(f+3); pHash[1]=*(f+2); pHash[2]=*(f+1); pHash[3]=*(f+0);
-       pHash[4]=*(f+7); pHash[5]=*(f+6); pHash[6]=*(f+5); pHash[7]=*(f+4);
-
-       free (pass);
-}
-
-void HashMySQLSHA1(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)
-{
-       unsigned char hash_stage1[SHA_DIGEST_LENGTH];
-       SHA_CTX ctx;
-
-       SHA1_Init(&ctx);
-       SHA1_Update(&ctx, (unsigned char *) pPlain, nPlainLen);
-       SHA1_Final(hash_stage1, &ctx);
-       SHA1_Init(&ctx);
-       SHA1_Update(&ctx, hash_stage1, SHA_DIGEST_LENGTH);
-       SHA1_Final(pHash, &ctx);
-}
-
-//*********************************************************************************
-// Code for PIX password hashing
-//*********************************************************************************
-static char itoa64[] =          /* 0 ... 63 => ascii - 64 */
-        "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
-
-void _crypt_to64(char *s, unsigned long v, int n)
-{
-        while (--n >= 0) {
-                *s++ = itoa64[v&0x3f];
-                v >>= 6;
-        }
-}
-
-void HashPIX(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)
-{
-       char temp[MD5_DIGEST_LENGTH+1];
-       unsigned char final[MD5_DIGEST_LENGTH];
-       char* pass = (char*) calloc (nPlainLen+MD5_DIGEST_LENGTH,sizeof(char));
-
-       memcpy (pass,pPlain,nPlainLen);
-
-       MD5_CTX ctx;
-       MD5_Init(&ctx);
-       MD5_Update(&ctx, (unsigned char *) pass, MD5_DIGEST_LENGTH);
-       MD5_Final(final, &ctx);
-
-       char* p = (char*) temp;
-       _crypt_to64(p,*(unsigned long*) (final+0),4); p += 4;
-       _crypt_to64(p,*(unsigned long*) (final+4),4); p += 4;
-       _crypt_to64(p,*(unsigned long*) (final+8),4); p += 4;
-       _crypt_to64(p,*(unsigned long*) (final+12),4); p += 4;
-       *p=0;
-
-       memcpy(pHash,temp,MD5_DIGEST_LENGTH);
-
-       free (pass);
-}
diff --git a/Common/rt api/tmp/HashAlgorithm.h b/Common/rt api/tmp/HashAlgorithm.h
deleted file mode 100644 (file)
index b617f9f..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
-   RainbowCrack - a general propose implementation of Philippe Oechslin's faster time-memory trade-off technique.
-
-   Copyright (C) Zhu Shuanglei <shuanglei@hotmail.com>
-*/
-
-#ifndef _HASHALGORITHM_H
-#define _HASHALGORITHM_H
-
-void HashLM(unsigned char* pPlain, int nPlainLen, unsigned char* pHash);
-void HashNTLM(unsigned char* pPlain, int nPlainLen, unsigned char* pHash);
-void HashMD2(unsigned char* pPlain, int nPlainLen, unsigned char* pHash);
-void HashMD4(unsigned char* pPlain, int nPlainLen, unsigned char* pHash);
-void HashMD5(unsigned char* pPlain, int nPlainLen, unsigned char* pHash);
-void HashSHA1(unsigned char* pPlain, int nPlainLen, unsigned char* pHash);
-void HashRIPEMD160(unsigned char* pPlain, int nPlainLen, unsigned char* pHash);
-void HashMSCACHE(unsigned char *pPlain, int nPlainLen, unsigned char* pHash);
-//****************************************************************************
-// MySQL Password Hashing
-//****************************************************************************
-void HashMySQL323(unsigned char* pPlain, int nPlainLen, unsigned char* pHash);
-void HashMySQLSHA1(unsigned char* pPlain, int nPlainLen, unsigned char* pHash);
-
-//****************************************************************************
-// Cisco PIX Password Hashing
-//****************************************************************************
-void HashPIX(unsigned char* pPlain, int nPlainLen, unsigned char* pHash);
-
-//****************************************************************************
-// (HALF) LM CHALL hashing
-void HashLMCHALL(unsigned char* pPlain, int nPlainLen, unsigned char* pHash);
-void HashHALFLMCHALL(unsigned char* pPlain, int nPlainLen, unsigned char* pHash);
-
-// From mao
-void HashNTLMCHALL(unsigned char* pPlain, int nPlainLen, unsigned char* pHash);
-void HashORACLE(unsigned char* pPlain, int nPlainLen, unsigned char* pHash);
-
-#endif
diff --git a/Common/rt api/tmp/HashRoutine.cpp b/Common/rt api/tmp/HashRoutine.cpp
deleted file mode 100644 (file)
index b61ae63..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
-   RainbowCrack - a general propose implementation of Philippe Oechslin's faster time-memory trade-off technique.
-
-   Copyright (C) Zhu Shuanglei <shuanglei@hotmail.com>
-*/
-
-#ifdef _WIN32
-       #pragma warning(disable : 4786)
-#endif
-
-#include "HashRoutine.h"
-#include "HashAlgorithm.h"
-
-//////////////////////////////////////////////////////////////////////
-
-CHashRoutine::CHashRoutine()
-{
-       // Notice: MIN_HASH_LEN <= nHashLen <= MAX_HASH_LEN
-
-       AddHashRoutine("lm",   HashLM,   8);
-       AddHashRoutine("md5",  HashMD5,  16);
-       AddHashRoutine("sha1", HashSHA1, 20);
-       AddHashRoutine("ntlm", HashNTLM, 16);
-}      
-
-CHashRoutine::~CHashRoutine()
-{
-}
-
-void CHashRoutine::AddHashRoutine(string sHashRoutineName, HASHROUTINE pHashRoutine, int nHashLen)
-{
-       vHashRoutineName.push_back(sHashRoutineName);
-       vHashRoutine.push_back(pHashRoutine);
-       vHashLen.push_back(nHashLen);
-}
-
-string CHashRoutine::GetAllHashRoutineName()
-{
-       string sRet;
-       int i;
-       for (i = 0; i < vHashRoutineName.size(); i++)
-               sRet += vHashRoutineName[i] + " ";
-
-       return sRet;
-}
-
-void CHashRoutine::GetHashRoutine(string sHashRoutineName, HASHROUTINE& pHashRoutine, int& nHashLen)
-{
-       int i;
-       for (i = 0; i < vHashRoutineName.size(); i++)
-       {
-               if (sHashRoutineName == vHashRoutineName[i])
-               {
-                       pHashRoutine = vHashRoutine[i];
-                       nHashLen = vHashLen[i];
-                       return;
-               }
-       }
-
-       pHashRoutine = NULL;
-       nHashLen = 0;
-}
diff --git a/Common/rt api/tmp/HashRoutine.h b/Common/rt api/tmp/HashRoutine.h
deleted file mode 100644 (file)
index 681fa78..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
-   RainbowCrack - a general propose implementation of Philippe Oechslin's faster time-memory trade-off technique.
-
-   Copyright (C) Zhu Shuanglei <shuanglei@hotmail.com>
-*/
-
-#ifndef _HASHROUTINE_H
-#define _HASHROUTINE_H
-
-#include <string>
-#include <vector>
-using namespace std;
-
-typedef void (*HASHROUTINE)(unsigned char* pPlain, int nPlainLen, unsigned char* pHash);
-
-class CHashRoutine  
-{
-public:
-       CHashRoutine();
-       virtual ~CHashRoutine();
-
-private:
-       vector<string>          vHashRoutineName;
-       vector<HASHROUTINE>     vHashRoutine;
-       vector<int>                     vHashLen;
-       void AddHashRoutine(string sHashRoutineName, HASHROUTINE pHashRoutine, int nHashLen);
-
-public:
-       string GetAllHashRoutineName();
-       void GetHashRoutine(string sHashRoutineName, HASHROUTINE& pHashRoutine, int& nHashLen);
-};
-
-#endif