+++ /dev/null
-../../../Common/rt api/ChainWalkContext.cpp
\ No newline at end of file
+++ /dev/null
-../../../Common/rt api/ChainWalkContext.h
\ No newline at end of file
+++ /dev/null
-../../../Common/rt api/HashAlgorithm.cpp
\ No newline at end of file
+++ /dev/null
-../../../Common/rt api/HashAlgorithm.h
\ No newline at end of file
+++ /dev/null
-../../../Common/rt api/HashRoutine.cpp
\ No newline at end of file
+++ /dev/null
-../../../Common/rt api/HashRoutine.h
\ No newline at end of file
BOINC_API_DIR = $(BOINC_DIR)/api
BOINC_LIB_DIR = $(BOINC_DIR)/lib
COMMON_LIB_DIR = /usr/lib
+INCLUDES = -I../../../Common/rt\ api -I$(BOINC_DIR) -I$(BOINC_LIB_DIR) -I$(BOINC_API_DIR)
+COMMON_API_PATH = ../../../Common/rt\ api
OPTIMIZATION = -O3
CXXFLAGS = -g \
-static -static-libgcc \
- -I$(BOINC_DIR) \
- -I$(BOINC_LIB_DIR) \
- -I$(BOINC_API_DIR) \
-Wall \
-c \
-DBOINC \
+ $(INCLUDES) \
$(OPTIMIZATION)
-LFLAGS = -static -static-libgcc -Wall $(OPTIMIZATION) -L$(BOINC_API_DIR) \
+LFLAGS = -static -static-libgcc -Wall $(INCLUDES) $(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
rebuild: clean all
-ChainWalkContext.o: ChainWalkContext.h ChainWalkContext.cpp HashRoutine.h Public.h
- $(CXX) $(CXXFLAGS) ChainWalkContext.cpp
+ChainWalkContext.o: $(COMMON_API_PATH)/ChainWalkContext.h $(COMMON_API_PATH)/ChainWalkContext.cpp $(COMMON_API_PATH)/HashRoutine.h $(COMMON_API_PATH)/Public.h
+ $(CXX) $(CXXFLAGS) $(COMMON_API_PATH)/ChainWalkContext.cpp
-des_enc.o: des_enc.c des_locl.h spr.h
- $(CXX) $(CXXFLAGS) des_enc.c
+des_enc.o: $(COMMON_API_PATH)/des_enc.c $(COMMON_API_PATH)/des_locl.h $(COMMON_API_PATH)/spr.h
+ $(CXX) $(CXXFLAGS) $(COMMON_API_PATH)/des_enc.c
-des_setkey.o: des_setkey.c des_locl.h podd.h sk.h
- $(CXX) $(CXXFLAGS) des_setkey.c
+des_setkey.o: $(COMMON_API_PATH)/des_setkey.c $(COMMON_API_PATH)/des_locl.h $(COMMON_API_PATH)/podd.h $(COMMON_API_PATH)/sk.h
+ $(CXX) $(CXXFLAGS) $(COMMON_API_PATH)/des_setkey.c
-distrrtgen.o: distrrtgen.cpp distrrtgen.h ChainWalkContext.h Public.h
+distrrtgen.o: distrrtgen.cpp distrrtgen.h $(COMMON_API_PATH)/ChainWalkContext.h $(COMMON_API_PATH)/Public.h
$(CXX) $(CXXFLAGS) distrrtgen.cpp
-ecb_enc.o: ecb_enc.c des_locl.h spr.h
- $(CXX) $(CXXFLAGS) ecb_enc.c
+ecb_enc.o: $(COMMON_API_PATH)/ecb_enc.c $(COMMON_API_PATH)/des_locl.h $(COMMON_API_PATH)/spr.h
+ $(CXX) $(CXXFLAGS) $(COMMON_API_PATH)/ecb_enc.c
-HashAlgorithm.o: HashAlgorithm.h HashAlgorithm.cpp Public.h md4.h md5.h
- $(CXX) $(CXXFLAGS) HashAlgorithm.cpp
+HashAlgorithm.o: $(COMMON_API_PATH)/HashAlgorithm.h $(COMMON_API_PATH)/HashAlgorithm.cpp $(COMMON_API_PATH)/Public.h $(COMMON_API_PATH)/md4.h $(COMMON_API_PATH)/md5.h
+ $(CXX) $(CXXFLAGS) $(COMMON_API_PATH)/HashAlgorithm.cpp
-HashRoutine.o: HashRoutine.h HashRoutine.cpp global.h HashAlgorithm.h
- $(CXX) $(CXXFLAGS) HashRoutine.cpp
+HashRoutine.o: $(COMMON_API_PATH)/HashRoutine.h $(COMMON_API_PATH)/HashRoutine.cpp $(COMMON_API_PATH)/global.h $(COMMON_API_PATH)/HashAlgorithm.h
+ $(CXX) $(CXXFLAGS) $(COMMON_API_PATH)/HashRoutine.cpp
-md4.o: md4.h md4.cpp global.h
- $(CXX) $(CXXFLAGS) md4.cpp
+md4.o: $(COMMON_API_PATH)/md4.h $(COMMON_API_PATH)/md4.cpp $(COMMON_API_PATH)/global.h
+ $(CXX) $(CXXFLAGS) $(COMMON_API_PATH)/md4.cpp
-md5.o: md5.h md5.cpp global.h
- $(CXX) $(CXXFLAGS) md5.cpp
+md5.o: $(COMMON_API_PATH)/md5.h $(COMMON_API_PATH)/md5.cpp $(COMMON_API_PATH)/global.h
+ $(CXX) $(CXXFLAGS) $(COMMON_API_PATH)/md5.cpp
-Public.o: Public.h Public.cpp global.h
- $(CXX) $(CXXFLAGS) Public.cpp
+Public.o: $(COMMON_API_PATH)/Public.h $(COMMON_API_PATH)/Public.cpp $(COMMON_API_PATH)/global.h
+ $(CXX) $(CXXFLAGS) $(COMMON_API_PATH)/Public.cpp
+++ /dev/null
-../../../Common/rt api/Public.cpp
\ No newline at end of file
+++ /dev/null
-../../../Common/rt api/Public.h
\ No newline at end of file
+++ /dev/null
-../../../Common/rt api/des.h
\ No newline at end of file
+++ /dev/null
-../../../Common/rt api/des_enc.c
\ No newline at end of file
+++ /dev/null
-../../../Common/rt api/des_locl.h
\ No newline at end of file
+++ /dev/null
-../../../Common/rt api/des_setkey.c
\ No newline at end of file
ļ»æ
-Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual Studio 2008
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "distrrtgen", "distrrtgen.vcproj", "{A3BDF5F8-4D0A-4B27-B1D9-7E77CBDA86C7}"
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "distrrtgen", "distrrtgen.vcxproj", "{A3BDF5F8-4D0A-4B27-B1D9-7E77CBDA86C7}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "index_calculator", "..\index_calculator\index_calculator.vcproj", "{C7A957CF-9FDC-4C72-9C3E-7C029E915D1E}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "index_calculator", "..\index_calculator\index_calculator.vcxproj", "{C7A957CF-9FDC-4C72-9C3E-7C029E915D1E}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rti2rto", "..\..\standalone\rti2rto\rti2rto.vcproj", "{E0FBC06A-C902-4468-A614-CBF9F591AA7C}"
EndProject
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rcracki", "..\..\standalone\rcracki\rcracki.vcproj", "{966DA4B4-E13C-449D-9A93-303C6FEA25C4}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "chain_checker", "..\chain_checker\chain_checker.vcproj", "{74C09EAC-2EA2-4548-9B61-0FEE56147DFE}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "chain_checker", "..\chain_checker\chain_checker.vcxproj", "{74C09EAC-2EA2-4548-9B61-0FEE56147DFE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{A3BDF5F8-4D0A-4B27-B1D9-7E77CBDA86C7}</ProjectGuid>
+ <RootNamespace>distrrtgen</RootNamespace>
+ <Keyword>Win32Proj</Keyword>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>NotSet</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>NotSet</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>NotSet</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>NotSet</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
+ <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
+ <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
+ <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
+ <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
+ <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
+ <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
+ <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
+ <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
+ <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">C:\lib\boinc\Win32\Release;$(LibraryPath)</LibraryPath>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>../../../common/rt api;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>BOINC;WIN32;_DEBUG;_MT;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>true</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>libcmtd.lib;libcpmtd.lib;kernel32.lib;user32.lib;ole32.lib;delayimp.lib;C:\lib\boinc\Win32\Debug\libboinc_staticcrt.lib;C:\lib\boinc\Win32\Debug\libboincapi_staticcrt.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <AdditionalIncludeDirectories>..\..\..\Common\rt api;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>BOINC;WIN32;NDEBUG;_MT;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>odbc32.lib;odbccp32.lib;libcmt.lib;libcpmt.lib;C:\lib\boinc\Win32\Release\2010\libboinc_staticcrt.lib;C:\lib\boinc\Win32\Release\2010\libboincapi_staticcrt.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <SubSystem>Windows</SubSystem>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Midl>
+ <TargetEnvironment>X64</TargetEnvironment>
+ </Midl>
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>/boinc/lib;/boinc/api;/boinc/zip;/boinc/client/win;/boinc/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_MT;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>true</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>libcmtd.lib;libcpmtd.lib;kernel32.lib;user32.lib;ole32.lib;delayimp.lib;C:\lib\boinc\x64\Debug\libboinc_staticcrt.lib;C:\lib\boinc\x64\Debug\libboincapi_staticcrt.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Midl>
+ <TargetEnvironment>X64</TargetEnvironment>
+ </Midl>
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <AdditionalIncludeDirectories>/boinc/lib;/boinc/api;/boinc/zip;/boinc/client/win;/boinc/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_MT;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+ <FunctionLevelLinking>false</FunctionLevelLinking>
+ <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>odbc32.lib;odbccp32.lib;libcmt.lib;libcpmt.lib;C:\lib\boinc\x64\Release\libboinc_staticcrt.lib;C:\lib\boinc\x64\Release\libboincapi_staticcrt.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Windows</SubSystem>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\Common\rt api\ChainWalkContext.cpp" />
+ <ClCompile Include="..\..\..\Common\rt api\des_enc.c" />
+ <ClCompile Include="..\..\..\Common\rt api\des_setkey.c" />
+ <ClCompile Include="distrrtgen.cpp" />
+ <ClCompile Include="..\..\..\Common\rt api\ecb_enc.c" />
+ <ClCompile Include="..\..\..\Common\rt api\HashAlgorithm.cpp" />
+ <ClCompile Include="..\..\..\Common\rt api\HashRoutine.cpp" />
+ <ClCompile Include="..\..\..\Common\rt api\md4.cpp" />
+ <ClCompile Include="..\..\..\Common\rt api\md5.cpp" />
+ <ClCompile Include="..\..\..\Common\rt api\Public.cpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\Common\rt api\ChainWalkContext.h" />
+ <ClInclude Include="..\..\..\Common\rt api\des.h" />
+ <ClInclude Include="..\..\..\Common\rt api\des_locl.h" />
+ <ClInclude Include="..\..\..\Common\rt api\global.h" />
+ <ClInclude Include="distrrtgen.h" />
+ <ClInclude Include="..\..\..\Common\rt api\HashAlgorithm.h" />
+ <ClInclude Include="..\..\..\Common\rt api\HashRoutine.h" />
+ <ClInclude Include="..\..\..\Common\rt api\md4.h" />
+ <ClInclude Include="..\..\..\Common\rt api\md5.h" />
+ <ClInclude Include="..\..\..\Common\rt api\podd.h" />
+ <ClInclude Include="..\..\..\Common\rt api\Public.h" />
+ <ClInclude Include="..\..\..\Common\rt api\sk.h" />
+ <ClInclude Include="..\..\..\Common\rt api\spr.h" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file
--- /dev/null
+ļ»æ<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\Common\rt api\ChainWalkContext.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\Common\rt api\des_enc.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\Common\rt api\des_setkey.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="distrrtgen.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\Common\rt api\ecb_enc.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\Common\rt api\HashAlgorithm.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\Common\rt api\HashRoutine.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\Common\rt api\md4.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\Common\rt api\md5.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\Common\rt api\Public.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\Common\rt api\ChainWalkContext.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\Common\rt api\des.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\Common\rt api\des_locl.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="distrrtgen.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\Common\rt api\HashAlgorithm.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\Common\rt api\HashRoutine.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\Common\rt api\md4.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\Common\rt api\md5.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\Common\rt api\podd.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\Common\rt api\Public.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\Common\rt api\sk.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\Common\rt api\spr.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\Common\rt api\global.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+</Project>
\ No newline at end of file
--- /dev/null
+ļ»æ<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+</Project>
\ No newline at end of file
+++ /dev/null
-../../../Common/rt api/ecb_enc.c
\ No newline at end of file
+++ /dev/null
-../../../Common/rt api/global.h
\ No newline at end of file
+++ /dev/null
-../../../Common/rt api/md4.cpp
\ No newline at end of file
+++ /dev/null
-../../../Common/rt api/md4.h
\ No newline at end of file
+++ /dev/null
-../../../Common/rt api/md5.cpp
\ No newline at end of file
+++ /dev/null
-../../../Common/rt api/md5.h
\ No newline at end of file
+++ /dev/null
-../../../Common/rt api/podd.h
\ No newline at end of file
+++ /dev/null
-../../../Common/rt api/sk.h
\ No newline at end of file
+++ /dev/null
-../../../Common/rt api/spr.h
\ No newline at end of file
--- /dev/null
+// This file is part of BOINC.
+// http://boinc.berkeley.edu
+// Copyright (C) 2008 University of California
+//
+// BOINC is free software; you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License
+// as published by the Free Software Foundation,
+// either version 3 of the License, or (at your option) any later version.
+//
+// BOINC 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 Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
+
+// This program serves as both
+// - An example BOINC application, illustrating the use of the BOINC API
+// - A program for testing various features of BOINC
+//
+// NOTE: this file exists as both
+// boinc/apps/upper_case.C
+// and
+// boinc_samples/example_app/uc2.C
+// If you update one, please update the other!
+
+// The program converts a mixed-case file to upper case:
+// read "in", convert to upper case, write to "out"
+//
+// command line options
+// -run_slow: sleep 1 second after each character
+// -cpu_time N: use about N CPU seconds after copying files
+// -early_exit: exit(10) after 30 chars
+// -early_crash: crash after 30 chars
+//
+
+#ifdef _WIN32
+#include "boinc_win.h"
+#else
+#include "config.h"
+#include <cstdio>
+#include <cctype>
+#include <ctime>
+#include <cstring>
+#include <cstdlib>
+#include <csignal>
+#include <unistd.h>
+#endif
+
+#include <string>
+#include <fstream>
+#include <iostream>
+#include "str_util.h"
+#include "util.h"
+#include "filesys.h"
+#include "boinc_api.h"
+#include "Public.h"
+// Rainbowcrack code
+#include "ChainWalkContext.h"
+//typedef unsigned int uint32;
+//typedef unsigned __int64 uint64;
+#include "rcuda.h"
+#include "rcuda_ext.h"
+
+
+using std::string;
+
+/*
+bool early_exit = false;
+bool early_crash = false;
+bool early_sleep = false;
+double cpu_time = 20, comp_result;
+*/
+int QuickSortPartition(RainbowChainCP* pChain, int nLow, int nHigh)
+{
+ int nRandomIndex = nLow + ((unsigned int)rand() * (RAND_MAX + 1) + (unsigned int)rand()) % (nHigh - nLow + 1);
+ RainbowChainCP TempChain;
+ TempChain = pChain[nLow];
+ pChain[nLow] = pChain[nRandomIndex];
+ pChain[nRandomIndex] = TempChain;
+
+ TempChain = pChain[nLow];
+ uint64 nPivotKey = pChain[nLow].nIndexE;
+ while (nLow < nHigh)
+ {
+ while (nLow < nHigh && pChain[nHigh].nIndexE >= nPivotKey)
+ nHigh--;
+ pChain[nLow] = pChain[nHigh];
+ while (nLow < nHigh && pChain[nLow].nIndexE <= nPivotKey)
+ nLow++;
+ pChain[nHigh] = pChain[nLow];
+ }
+ pChain[nLow] = TempChain;
+ return nLow;
+}
+
+void QuickSort(RainbowChainCP* pChain, int nLow, int nHigh)
+{
+ if (nLow < nHigh)
+ {
+ int nPivotLoc = QuickSortPartition(pChain, nLow, nHigh);
+ QuickSort(pChain, nLow, nPivotLoc - 1);
+ QuickSort(pChain, nPivotLoc + 1, nHigh);
+ }
+}
+
+int main(int argc, char **argv) {
+ int retval;
+ double fd;
+ char output_path[512], chkpt_path[512];
+ FILE* state;
+ retval = boinc_init();
+ if (retval) {
+ fprintf(stderr, "boinc_init returned %d\n", retval);
+ exit(retval);
+ }
+
+
+ // get size of input file (used to compute fraction done)
+ //
+ //file_size(input_path, fsize);
+
+ // See if there's a valid checkpoint file.
+ // If so seek input file and truncate output file
+ //
+
+
+ if(argc < 10)
+ {
+ fprintf(stderr, "Not enough parameters");
+ return -1;
+ }
+ string sHashRoutineName, sCharsetName, sSalt, sCheckPoints;
+ uint32 nRainbowChainCount, nPlainLenMin, nPlainLenMax, nRainbowTableIndex, nRainbowChainLen;
+ uint64 nChainStart;
+ sHashRoutineName = argv[1];
+ sCharsetName = argv[2];
+ nPlainLenMin = atoi(argv[3]);
+ nPlainLenMax = atoi(argv[4]);
+ nRainbowTableIndex = atoi(argv[5]);
+ nRainbowChainLen = atoi(argv[6]);
+ nRainbowChainCount = atoi(argv[7]);
+#ifdef _WIN32
+
+ nChainStart = _atoi64(argv[8]);
+
+#else
+ nChainStart = atoll(argv[8]);
+#endif
+ sCheckPoints = argv[9];
+ vector<int> vCPPositions;
+ char *cp = strtok((char *)sCheckPoints.c_str(), ",");
+ while(cp != NULL)
+ {
+ vCPPositions.push_back(atoi(cp));
+ cp = strtok(NULL, ",");
+ }
+ if(argc == 11)
+ {
+ sSalt = argv[10];
+ }
+ //std::cout << "Starting ChainGenerator" << std::endl;
+ // Setup CChainWalkContext
+ //std::cout << "ChainGenerator started." << std::endl;
+
+ if (!CChainWalkContext::SetHashRoutine(sHashRoutineName))
+ {
+ fprintf(stderr, "hash routine %s not supported\n", sHashRoutineName.c_str());
+ return 1;
+ }
+ //std::cout << "Hash routine validated" << std::endl;
+
+ if (!CChainWalkContext::SetPlainCharset(sCharsetName, nPlainLenMin, nPlainLenMax))
+ {
+ std::cerr << "charset " << sCharsetName << " not supported" << std::endl;
+ return 2;
+ }
+ //std::cout << "Plain charset validated" << std::endl;
+
+ if (!CChainWalkContext::SetRainbowTableIndex(nRainbowTableIndex))
+ {
+ std::cerr << "invalid rainbow table index " << nRainbowTableIndex << std::endl;
+ return 3;
+ }
+ //std::cout << "Rainbowtable index validated" << std::endl;
+
+ if(sHashRoutineName == "mscache")// || sHashRoutineName == "lmchall" || sHashRoutineName == "halflmchall")
+ {
+ // Convert username to unicode
+ const char *szSalt = sSalt.c_str();
+ int salt_length = strlen(szSalt);
+ unsigned char cur_salt[256];
+ for (int i=0; i<salt_length; i++)
+ {
+ cur_salt[i*2] = szSalt[i];
+ cur_salt[i*2+1] = 0x00;
+ }
+ CChainWalkContext::SetSalt(cur_salt, salt_length*2);
+ }
+ else if(sHashRoutineName == "halflmchall")
+ { // The salt is hardcoded into the hash routine
+ // CChainWalkContext::SetSalt((unsigned char*)&salt, 8);
+ }
+ else if(sHashRoutineName == "oracle")
+ {
+ CChainWalkContext::SetSalt((unsigned char *)sSalt.c_str(), sSalt.length());
+ }
+ //std::cout << "Opening chain file" << std::endl;
+
+
+ // Open file
+// fclose(fopen(sFilename.c_str(), "a"));
+// FILE* file = fopen(sFilename.c_str(), "r+b");
+ boinc_resolve_filename("result", output_path, sizeof(output_path));
+ fclose(boinc_fopen(output_path, "a"));
+ FILE *outfile = boinc_fopen(output_path, "r+b");
+
+ if (outfile == NULL)
+ {
+ std::cerr << "failed to create " << output_path << std::endl;
+ return 4;
+ }
+
+
+ // Check existing chains
+ unsigned int nDataLen = (unsigned int)GetFileLen(outfile);
+ unsigned int nFileLen;
+
+ // Round to boundary
+ nDataLen = nDataLen / 18 * 18;
+ if ((int)nDataLen == nRainbowChainCount * 18)
+ {
+ std::cerr << "precomputation of this rainbow table already finished" << std::endl;
+ fclose(outfile);
+ return 0;
+ }
+
+ fseek(outfile, nDataLen, SEEK_SET);
+ size_t nReturn;
+ CChainWalkContext cwc;
+ uint64 nIndex[2];
+
+// std::cout << "Starting to generate chains" << std::endl;
+ int maxCalcBuffSize = rcuda::GetChainsBufferSize(5000);
+ uint64 *calcBuff = new uint64[2*maxCalcBuffSize];
+ int ii;
+
+ CudaCWCExtender ex(&cwc);
+ rcuda::RCudaTask cuTask;
+ std::vector<unsigned char> stPlain;
+ ex.Init();
+time_t tStart, tStartFinal, tEndFinal;
+time_t tEnd;
+ tStartFinal = time(NULL);
+ for(int nCurrentCalculatedChains = nDataLen / 18, calcSize; nCurrentCalculatedChains < nRainbowChainCount; )
+ {
+ fd = (double)nCurrentCalculatedChains / (double)nRainbowChainCount;
+ boinc_fraction_done(fd);
+
+ cuTask.hash = ex.GetHash();
+ cuTask.startIdx = nChainStart + nCurrentCalculatedChains;
+ cuTask.idxCount = std::min<int>(nRainbowChainCount - nCurrentCalculatedChains, maxCalcBuffSize);
+ cuTask.stPlainSize = ex.IndexToStartPlain(0, stPlain);
+ cuTask.stPlain = &stPlain[0];
+ cuTask.dimVec = ex.GetPlainDimVec();
+ cuTask.dimVecSize = ex.GetPlainDimVecSize()/3;
+ cuTask.charSet = ex.GetCharSet();
+ cuTask.charSetSize = ex.GetCharSetSize();
+ cuTask.cpPositions = &vCPPositions[0];
+ cuTask.cpPosSize = vCPPositions.size();
+ cuTask.reduceOffset = ex.GetReduceOffset();
+ cuTask.plainSpaceTotal = ex.GetPlainSpaceTotal();
+ cuTask.rainbowChainLen = nRainbowChainLen;
+ for(int ii = 0; ii < cuTask.idxCount; ii++) {
+ calcBuff[2*ii] = cuTask.startIdx + ii;
+ calcBuff[2*ii+1] = 0;
+ }
+
+ tStart = time(NULL);
+
+ calcSize = rcuda::CalcChainsOnCUDA(&cuTask, calcBuff);
+ tEnd = time(NULL);
+ std::cerr << "CUDA time taken: " << tEnd - tStart << std::endl;
+ tStart = time(NULL);
+ if(calcSize > 0) {
+ nCurrentCalculatedChains += calcSize;
+ for(ii = 0; ii < cuTask.idxCount; ii++) {
+ nIndex[0] = cuTask.startIdx + ii;
+ nReturn = fwrite(nIndex, 1, 8, outfile);
+ nReturn += fwrite(calcBuff+(2*ii), 1, 8, outfile);
+ nReturn += fwrite(calcBuff+(2*ii+1), 1, 2, outfile);
+ if(nReturn != 18) {
+ std::cerr << "disk write fail" << std::endl;
+ fclose(outfile);
+ return 9;
+ }
+ }
+ } else {
+ std::cerr << "Calculations on CUDA failed!" << std::endl;
+ fclose(outfile);
+ return 0;
+ }
+ }
+ tEndFinal = time(NULL);
+ std::cerr << "Time taken: " << tEndFinal - tStartFinal << " secs" << std::endl;
+ delete [] calcBuff;
+#ifdef _DEBUG
+ std::cout << "Generation completed" << std::endl;
+#endif
+ fseek(outfile, 0, SEEK_SET);
+ nFileLen = GetFileLen(outfile);
+ nRainbowChainCount = nFileLen / 18;
+
+ RainbowChainCP* pChain = (RainbowChainCP*)new unsigned char[sizeof(RainbowChainCP) * nRainbowChainCount];
+
+ if (pChain != NULL)
+ {
+ // Load file
+#ifdef _DEBUG
+ std::cout << "Sorting file" << std::endl;
+#endif
+ fseek(outfile, 0, SEEK_SET);
+ for(int i = 0; i < nRainbowChainCount; i++)
+ {
+ if(fread(&pChain[i], 1, 16, outfile) != 16)
+ {
+ printf("disk read fail\n");
+ return 9;
+ }
+ if(fread(&pChain[i].nCheckPoint, 1, sizeof(pChain[i].nCheckPoint), outfile) != 2)
+ {
+ printf("disk read fail\n");
+ return 9;
+ }
+ }
+
+ // Sort file
+ QuickSort(pChain, 0, nRainbowChainCount - 1);
+
+ // Write file
+ fseek(outfile, 0, SEEK_SET);
+ for(int i = 0; i < nRainbowChainCount; i++)
+ {
+ fwrite(&pChain[i], 1, 16, outfile);
+ fwrite(&pChain[i].nCheckPoint, 2, 1, outfile);
+ }
+ delete[] pChain;
+ }
+
+ fclose(outfile);
+
+ // main loop - read characters, convert to UC, write
+ //
+
+ boinc_fraction_done(1);
+ boinc_finish(0);
+}
+
+#ifdef _WIN32
+int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR Args, int WinMode) {
+ LPSTR command_line;
+ char* argv[100];
+ int argc;
+
+ command_line = GetCommandLine();
+ argc = parse_command_line( command_line, argv );
+ return main(argc, argv);
+}
+#endif
+
+const char *BOINC_RCSID_33ac47a071 = "$Id: upper_case.C 12135 2007-02-21 20:04:14Z davea $";
+
--- /dev/null
+ļ»æ
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "distrrtgen", "distrrtgen.vcproj", "{A3BDF5F8-4D0A-4B27-B1D9-7E77CBDA86C7}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {A3BDF5F8-4D0A-4B27-B1D9-7E77CBDA86C7}.Debug|Win32.ActiveCfg = Debug|Win32
+ {A3BDF5F8-4D0A-4B27-B1D9-7E77CBDA86C7}.Debug|Win32.Build.0 = Debug|Win32
+ {A3BDF5F8-4D0A-4B27-B1D9-7E77CBDA86C7}.Release|Win32.ActiveCfg = Release|Win32
+ {A3BDF5F8-4D0A-4B27-B1D9-7E77CBDA86C7}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
--- /dev/null
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="distrrtgen"
+ ProjectGUID="{A3BDF5F8-4D0A-4B27-B1D9-7E77CBDA86C7}"
+ RootNamespace="distrrtgen"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="0"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine=""
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="/boinc/lib;/boinc/api;"/boinc/zip";"/boinc/client/win";"/boinc/";../../rt api"
+ PreprocessorDefinitions="WIN32;_DEBUG;_MT;_CONSOLE"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="libcmtd.lib libcpmtd.lib kernel32.lib user32.lib ole32.lib delayimp.lib ..\lib_debug\libboinc_staticcrt.lib ..\lib_debug\libboincapi_staticcrt.lib c:/openssl/lib/libeay32.lib cuda.lib cudart.lib"
+ LinkIncremental="0"
+ AdditionalLibraryDirectories="$(CUDA_LIB_PATH)\..\Win32"
+ IgnoreAllDefaultLibraries="true"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="0"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="2"
+ EnableIntrinsicFunctions="true"
+ FavorSizeOrSpeed="1"
+ WholeProgramOptimization="true"
+ AdditionalIncludeDirectories="/boinc/lib;/boinc/api;/boinc/zip;/boinc/client/win;/boinc/;"C:\Users\mwj\git\Common\rt api""
+ PreprocessorDefinitions="WIN32;NDEBUG;_MT;_CONSOLE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ EnableEnhancedInstructionSet="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="odbc32.lib odbccp32.lib libcmt.lib libcpmt.lib C:\lib\boinc\Win32\Release\libboinc_staticcrt.lib C:\lib\boinc\Win32\Release\libboincapi_staticcrt.lib cuda.lib cudart.lib"
+ LinkIncremental="0"
+ AdditionalLibraryDirectories="$(CUDA_LIB_PATH)\..\Win32"
+ IgnoreAllDefaultLibraries="true"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath="..\..\..\Common\rt api\ChainWalkContext.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\Common\rt api\des_enc.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\Common\rt api\des_setkey.c"
+ >
+ </File>
+ <File
+ RelativePath=".\distrrtgen.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\Common\rt api\ecb_enc.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\Common\rt api\HashAlgorithm.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\Common\rt api\HashRoutine.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\Common\rt api\md4.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\Common\rt api\md5.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\Common\rt api\Public.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\rcuda.cu"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="\93$(CUDA_BIN_PATH)\nvcc.exe\94 --compile -m32 --output-file "$(OutDir)\$(InputName).obj" "$(InputFileName)"
"
+ Outputs="$(OutDir)\$(InputName).obj"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="\93$(CUDA_BIN_PATH)\nvcc.exe\94 --compile -m32 --output-file "$(OutDir)\$(InputName).obj" "$(InputFileName)"
"
+ Outputs="$(OutDir)\$(InputName).obj"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\rcuda_ext.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath="..\..\..\Common\rt api\ChainWalkContext.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\Common\rt api\des.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\Common\rt api\des_locl.h"
+ >
+ </File>
+ <File
+ RelativePath=".\distrrtgen.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\Common\rt api\HashAlgorithm.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\Common\rt api\HashRoutine.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\Common\rt api\md4.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\Common\rt api\md5.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\Common\rt api\podd.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\Common\rt api\Public.h"
+ >
+ </File>
+ <File
+ RelativePath=".\rcuda.h"
+ >
+ </File>
+ <File
+ RelativePath=".\rcuda_ext.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\Common\rt api\sk.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\Common\rt api\spr.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
--- /dev/null
+#include <stdio.h>
+#include <cuda.h>
+#include "rcuda.h"
+
+#define GRID_X_L2 6
+#define GRID_Y_L2 6
+#define BLOCK_X_L2 7
+#define GRID_X_SIZE (1<<GRID_X_L2)
+#define GRID_Y_SIZE (1<<GRID_Y_L2)
+#define BLOCK_X_SIZE (1<<BLOCK_X_L2)
+#define KERN_CHAIN_SIZE 100
+#define SHIDX(x) ((x)<<4)
+
+
+__device__ __constant__ unsigned int h[4] = { 0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476 };
+__device__ __constant__ unsigned char r[64] = { \
+ 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, \
+ 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, \
+ 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, \
+ 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21 };
+__device__ __constant__ unsigned char g[64] = { \
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, \
+ 1, 6, 11, 0, 5, 10, 15, 4, 9, 14, 3, 8, 13, 2, 7, 12, \
+ 5, 8, 11, 14, 1, 4, 7, 10, 13, 0, 3, 6, 9, 12, 15, 2, \
+ 0, 7, 14, 5, 12, 3, 10, 1, 8, 15, 6, 13, 4, 11, 2, 9 };
+__device__ __constant__ unsigned int ac[64] = { \
+ 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee, \
+ 0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501, \
+ 0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be, \
+ 0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821, \
+ \
+ 0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa, \
+ 0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8, \
+ 0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed, \
+ 0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a, \
+ \
+ 0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c, \
+ 0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70, \
+ 0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x04881d05, \
+ 0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665, \
+ \
+ 0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039, \
+ 0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1, \
+ 0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1, \
+ 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391 };
+
+__device__ __constant__ unsigned int testData[16] = { \
+ 0x79706d63, 0x6d627667, 0x00000080, 0x00000000, \
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, \
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, \
+ 0x00000000, 0x00000000, 0x00000040, 0x00000000 };
+
+__device__ unsigned int FF(unsigned int a, unsigned int b, unsigned int c, unsigned int d, int i, const unsigned int* data) {
+ unsigned int ret;
+ ret = a + ((b&c)|((~b)&d)) + ac[i] + data[SHIDX(g[i])];
+ ret = (ret<<r[i])|(ret>>(32-r[i]));
+ ret += b;
+ return ret;
+}
+
+__device__ unsigned int GG(unsigned int a, unsigned int b, unsigned int c, unsigned int d, int i, const unsigned int* data) {
+ unsigned int ret;
+ ret = a + ((b&d)|(c&(~d))) + ac[i] + data[SHIDX(g[i])];
+ ret = (ret<<r[i])|(ret>>(32-r[i]));
+ ret += b;
+ return ret;
+}
+
+__device__ unsigned int HH(unsigned int a, unsigned int b, unsigned int c, unsigned int d, int i, const unsigned int* data) {
+ unsigned int ret;
+ ret = a + (b^c^d) + ac[i] + data[SHIDX(g[i])];
+ ret = (ret<<r[i])|(ret>>(32-r[i]));
+ ret += b;
+ return ret;
+}
+
+__device__ unsigned int II(unsigned int a, unsigned int b, unsigned int c, unsigned int d, int i, const unsigned int* data) {
+ unsigned int ret;
+ ret = a + (c^(b|(~d))) + ac[i] + data[SHIDX(g[i])];
+ ret = (ret<<r[i])|(ret>>(32-r[i]));
+ ret += b;
+ return ret;
+}
+
+__device__ void MD5(unsigned int* dataHash) {
+ unsigned int a = h[0], b = h[1], c = h[2], d = h[3], x;
+ int ii;
+
+ // Round 1
+ for(ii = 0; ii < 16; ii++) {
+ x = b;
+ b = FF(a, b, c, d, ii, dataHash);
+ a = d; d = c; c = x;
+ }
+
+ // Round 2
+ for(; ii < 32; ii++) {
+ x = b;
+ b = GG(a, b, c, d, ii, dataHash);
+ a = d; d = c; c = x;
+ }
+
+ // Round 3
+ for(; ii < 48; ii++) {
+ x = b;
+ b = HH(a, b, c, d, ii, dataHash);
+ a = d; d = c; c = x;
+ }
+
+ // Round 4
+ for(; ii < 64; ii++) {
+ x = b;
+ b = II(a, b, c, d, ii, dataHash);
+ a = d; d = c; c = x;
+ }
+
+ dataHash[SHIDX(0)] = a + h[0];
+ dataHash[SHIDX(1)] = b + h[1];
+ dataHash[SHIDX(2)] = c + h[2];
+ dataHash[SHIDX(3)] = d + h[3];
+}
+
+
+#define PLAIN_MAX_SIZE 20
+
+__device__ unsigned __int64 *dataHeap;
+__device__ unsigned char *plStart;
+__device__ uint3 *plDimVec;
+__device__ unsigned char *plChrSet;
+__device__ int *plCpPos;
+__device__ int plCpPosSize;
+__device__ unsigned __int64 reduceOffset;
+__device__ unsigned __int64 plainSpaceTotal;
+__device__ unsigned __int64 rPlainSpaceTotal;
+
+
+__global__ void RTGenMD5Kernel(unsigned int chainStart, unsigned int chainStop) {
+ unsigned int *hData;
+ uint3 dimItem;
+ unsigned int uiVal, uiMul, uiDiv, idx;
+ unsigned __int64 uiVal64, uiMul64, uiDiv64, idx64;
+ unsigned int nPos, size, ii, jj, kk;
+ unsigned int cpcheck, checkpoint;
+ unsigned int plain;
+
+ __shared__ unsigned int shData[SHIDX(BLOCK_X_SIZE)];
+
+ if(threadIdx.x == 0) {
+ nPos = ((((blockIdx.y<<GRID_X_L2) + blockIdx.x)<<BLOCK_X_L2) + threadIdx.x) << 1;
+ for(ii = 0; ii < BLOCK_X_SIZE; ii++, nPos+=2) {
+ hData = shData + ((ii>>4)<<8)+(ii&15);
+ hData[SHIDX(0)] = dataHeap[nPos];
+ hData[SHIDX(1)] = dataHeap[nPos]>>32;
+ hData[SHIDX(2)] = dataHeap[nPos+1];
+ }
+ }
+ __syncthreads();
+
+ hData = shData + ((threadIdx.x>>4)<<8)+(threadIdx.x&15);
+
+ idx64 = hData[SHIDX(1)];
+ idx64 = (idx64<<32) | hData[SHIDX(0)];
+ cpcheck = hData[SHIDX(2)];
+ checkpoint = cpcheck&0x0000ffff;
+ cpcheck = cpcheck>>16;
+
+ for(nPos = chainStart; nPos < chainStop; nPos++) {
+ // transform to the plain text
+ plain = 0x80;
+ jj = (PLAIN_MAX_SIZE>>2)+1;
+ for(ii = 0; idx64 > 0xfffffff0ull && ii < PLAIN_MAX_SIZE; ii++) {
+ uiVal64 = idx64 + plStart[ii];
+ uiVal64--;
+ dimItem = plDimVec[ii];
+ uiMul64 = (unsigned __int64)dimItem.y<<32;
+ idx64 = __umul64hi(uiVal64, uiMul64);
+ uiDiv64 = uiVal64 - idx64*(unsigned __int64)dimItem.x;
+ uiVal = __umulhi((unsigned int)uiDiv64, dimItem.y);
+ uiDiv = (unsigned int)uiDiv64 - uiVal * dimItem.x;
+ idx64 += uiVal;
+ if(uiDiv >= dimItem.x) {
+ uiDiv -= dimItem.x;
+ idx64++;
+ }
+ plain = (plain<<8) | plChrSet[dimItem.z + uiDiv];
+ if((ii&3) == 2) {
+ hData[SHIDX(jj--)] = plain;
+ plain = 0;
+ }
+ }
+ for(idx = (unsigned int)idx64; idx != 0 && ii < PLAIN_MAX_SIZE; ii++) {
+ uiVal = idx + plStart[ii];
+ uiVal--;
+ dimItem = plDimVec[ii];
+ idx = __umulhi(uiVal, dimItem.y);
+ uiDiv = uiVal - idx*dimItem.x;
+ if(uiDiv >= dimItem.x) {
+ uiDiv -= dimItem.x;
+ idx++;
+ }
+ plain = (plain<<8) | plChrSet[dimItem.z + uiDiv];
+ if((ii&3) == 2) {
+ hData[SHIDX(jj--)] = plain;
+ plain = 0;
+ }
+ }
+
+ // prepare for MD5
+ size = ii;
+ ii = ((((3-(ii&3))<<3)-1)&0x1f)+1;
+ plain = plain<<ii;
+ for(jj++, kk = 0; jj <= (PLAIN_MAX_SIZE>>2)+1; plain = hData[SHIDX(jj++)], kk++)
+ hData[SHIDX(kk)] = (plain>>ii)|(hData[SHIDX(jj)]<<(32-ii));
+ hData[SHIDX(kk)] = plain>>ii;
+ for(kk++; kk < 14; kk++)
+ hData[SHIDX(kk)] = 0;
+ hData[SHIDX(kk++)] = size<<3;
+ hData[SHIDX(kk)] = 0;
+
+ // hash
+ MD5(hData);
+
+ idx64 = hData[SHIDX(1)];
+ idx64 = (idx64<<32) | hData[SHIDX(0)];
+ idx64 += reduceOffset + nPos;
+ uiDiv64 = __umul64hi(idx64, rPlainSpaceTotal);
+ idx64 -= uiDiv64*plainSpaceTotal;
+ if(idx64 >= plainSpaceTotal)
+ idx64 -= plainSpaceTotal;
+
+ if(cpcheck < plCpPosSize && nPos == plCpPos[cpcheck]) {
+ checkpoint |= ((unsigned int)idx64&1) << cpcheck;
+ cpcheck++;
+ }
+ }
+
+ hData[SHIDX(0)] = idx64;
+ hData[SHIDX(1)] = idx64>>32;
+ hData[SHIDX(2)] = (cpcheck<<16)|(checkpoint&0x0000ffff);
+ __syncthreads();
+
+ if(threadIdx.x == 0) {
+ nPos = ((((blockIdx.y<<GRID_X_L2) + blockIdx.x)<<BLOCK_X_L2) + threadIdx.x) << 1;
+ for(ii = 0; ii < BLOCK_X_SIZE; ii++, nPos+=2) {
+ hData = shData + ((ii>>4)<<8)+(ii&15);
+ dataHeap[nPos] = ((unsigned __int64)hData[SHIDX(1)]<<32)|(unsigned __int64)hData[SHIDX(0)];
+ dataHeap[nPos+1] = hData[SHIDX(2)];
+ }
+ }
+ __syncthreads();
+}
+
+
+extern "C" int CalcChainsOnCUDA(const rcuda::RCudaTask* task, unsigned __int64 *resultBuff) {
+ cudaError_t cuErr;
+ char buff[PLAIN_MAX_SIZE];
+ unsigned __int64 *data;
+ unsigned char *stPlain;
+ uint3 *dimVec;
+ unsigned char *charSet;
+ int *cpPos;
+ unsigned __int64 uiVal64;
+ time_t tStart, tEnd;
+ if(task->hash != rcuda::RHASH_MD5)
+ return 0;
+
+ memset(buff, 0, PLAIN_MAX_SIZE);
+ cudaMalloc((void**)&data, task->idxCount*2*sizeof(unsigned __int64));
+ cudaMalloc((void**)&stPlain, PLAIN_MAX_SIZE);
+ cudaMalloc((void**)&dimVec, task->dimVecSize*sizeof(uint3));
+ cudaMalloc((void**)&charSet, task->charSetSize);
+ cudaMalloc((void**)&cpPos, task->cpPosSize*sizeof(int));
+
+ cudaMemcpy(data, resultBuff, task->idxCount*2*sizeof(unsigned __int64), cudaMemcpyHostToDevice);
+ cudaMemcpy(stPlain, buff, PLAIN_MAX_SIZE, cudaMemcpyHostToDevice);
+ cudaMemcpy(stPlain, task->stPlain, min(task->stPlainSize, PLAIN_MAX_SIZE), cudaMemcpyHostToDevice);
+ cudaMemcpy(dimVec, task->dimVec, task->dimVecSize*sizeof(uint3), cudaMemcpyHostToDevice);
+ cudaMemcpy(charSet, task->charSet, task->charSetSize, cudaMemcpyHostToDevice);
+ cudaMemcpy(cpPos, task->cpPositions, task->cpPosSize*sizeof(int), cudaMemcpyHostToDevice);
+
+ cudaMemcpyToSymbol(dataHeap, &data, sizeof(data));
+ cudaMemcpyToSymbol(plStart, &stPlain, sizeof(stPlain));
+ cudaMemcpyToSymbol(plDimVec, &dimVec, sizeof(dimVec));
+ cudaMemcpyToSymbol(plChrSet, &charSet, sizeof(charSet));
+ cudaMemcpyToSymbol(plCpPos, &cpPos, sizeof(cpPos));
+ cudaMemcpyToSymbol(plCpPosSize, &task->cpPosSize, sizeof(task->cpPosSize));
+ cudaMemcpyToSymbol(reduceOffset, &task->reduceOffset, sizeof(task->reduceOffset));
+ cudaMemcpyToSymbol(plainSpaceTotal, &task->plainSpaceTotal, sizeof(task->plainSpaceTotal));
+ uiVal64 = (unsigned __int64)-1/task->plainSpaceTotal;
+ cudaMemcpyToSymbol(rPlainSpaceTotal, &uiVal64, sizeof(uiVal64));
+
+ int grSizeX = (task->idxCount-1)/BLOCK_X_SIZE + 1;
+ int grSizeY = (grSizeX-1)/GRID_X_SIZE + 1;
+ grSizeX = GRID_X_SIZE;
+ dim3 numBlocks(grSizeX, grSizeY);
+ cuErr = cudaSuccess;
+ tStart = time(NULL);
+ for(int idx = 0; idx < task->rainbowChainLen-1 && cuErr == cudaSuccess; idx+=KERN_CHAIN_SIZE) {
+ RTGenMD5Kernel<<<numBlocks, BLOCK_X_SIZE>>>(idx, min(idx+KERN_CHAIN_SIZE, task->rainbowChainLen-1));
+ cuErr = cudaGetLastError();
+ if(cuErr == cudaSuccess)
+ cuErr = cudaThreadSynchronize();
+
+ }
+ tEnd = time(NULL);
+ fprintf(stderr, "Kernel run time: %i\n", (tEnd - tStart));
+
+ if(cuErr == cudaSuccess)
+ cudaMemcpy(resultBuff, data, task->idxCount*2*sizeof(unsigned __int64), cudaMemcpyDeviceToHost);
+ else
+ fprintf(stderr, "Error happened: %d (%s)\n", cuErr, cudaGetErrorString(cuErr));
+
+ cudaFree(cpPos);
+ cudaFree(charSet);
+ cudaFree(dimVec);
+ cudaFree(stPlain);
+ cudaFree(data);
+ return cuErr==cudaSuccess? task->idxCount : -1;
+}
+
+extern "C" int GetChainsBufferSize(int minSize) {
+ int grSizeX = (minSize-1)/BLOCK_X_SIZE + 1;
+ int grSizeY = (grSizeX-1)/GRID_X_SIZE + 1;
+ grSizeX = GRID_X_SIZE;
+ return grSizeX*grSizeY*BLOCK_X_SIZE;
+}
--- /dev/null
+#ifndef RCUDA_H
+#define RCUDA_H
+
+namespace rcuda {
+
+enum RHash { RHASH_UNDEF = -1, RHASH_LM, RHASH_MD4, RHASH_MD5, RHASH_SHA1, RHASH_NTLM };
+
+struct RCudaTask {
+ RHash hash;
+ unsigned __int64 startIdx;
+ int idxCount;
+ unsigned char* stPlain;
+ int stPlainSize;
+ unsigned int* dimVec;
+ int dimVecSize;
+ unsigned char* charSet;
+ int charSetSize;
+ int *cpPositions;
+ int cpPosSize;
+ unsigned __int64 reduceOffset;
+ unsigned __int64 plainSpaceTotal;
+ unsigned int rainbowChainLen;
+};
+
+extern "C" int CalcChainsOnCUDA(const RCudaTask* task, unsigned __int64 *resultBuff);
+extern "C" int GetChainsBufferSize(int minSize);
+
+}
+
+#endif //RCUDA_H
--- /dev/null
+//============================================================================
+// Name : rcuda_ext.cpp
+// Author : Jan Kyska
+// Version : 0.9
+// Description : A code to access internals of the CChainWalkContext
+// for the CUDA generator of FreeRainbowTables
+//============================================================================
+
+#include "rcuda_ext.h"
+#include <algorithm>
+#include <string>
+#include <time.h>
+#include <fstream>
+#include <iostream>
+
+CudaCWCExtender::CudaCWCExtender(CChainWalkContext *cwc) {
+ this->cwc = cwc;
+ hash = rcuda::RHASH_UNDEF;
+}
+
+void CudaCWCExtender::Init(void) {
+ std::string hashName;
+ int ii, jj;
+
+ plainDimVec.clear();
+ plainCharSet.clear();
+
+ hashName = CChainWalkContext::m_sHashRoutineName;
+ std::transform(hashName.begin(), hashName.end(), hashName.begin(), tolower);
+ if(hashName.compare("lm") == 0)
+ hash = rcuda::RHASH_LM;
+ else if(hashName.compare("md4") == 0)
+ hash = rcuda::RHASH_MD4;
+ else if(hashName.compare("md5") == 0)
+ hash = rcuda::RHASH_MD5;
+ else if(hashName.compare("sha1") == 0)
+ hash = rcuda::RHASH_SHA1;
+ else if(hashName.compare("ntlm") == 0)
+ hash = rcuda::RHASH_NTLM;
+ else
+ hash = rcuda::RHASH_UNDEF;
+
+ for(ii = 0; ii < (int)CChainWalkContext::m_vCharset.size(); ii++) {
+ stCharset &chs = CChainWalkContext::m_vCharset[ii];
+ int chSetOffset = plainCharSet.size();
+ plainCharSet.append((char*)chs.m_PlainCharset, chs.m_nPlainCharsetLen);
+ for(jj = 0; jj < chs.m_nPlainLenMax; jj++) {
+ plainDimVec.push_back((unsigned int)chs.m_nPlainCharsetLen);
+ plainDimVec.push_back((unsigned int)-1/(unsigned int)chs.m_nPlainCharsetLen);
+ plainDimVec.push_back((unsigned int)chSetOffset);
+ }
+ }
+}
+
+int CudaCWCExtender::IndexToStartPlain(const uint64 nIndex, std::vector<unsigned char>& stPlain) {
+ int nPlainLen, nCharsetLen;
+ int ii, jj;
+
+ stPlain.clear();
+ stPlain.reserve(0x20);
+ nPlainLen = 0;
+ for(ii = CChainWalkContext::m_nPlainLenMaxTotal - 1; ii >= CChainWalkContext::m_nPlainLenMinTotal - 1; ii--) {
+ if(nIndex >= CChainWalkContext::m_nPlainSpaceUpToX[ii]) {
+ nPlainLen = ii + 1;
+ break;
+ }
+ }
+ if(nPlainLen == 0)
+ nPlainLen = CChainWalkContext::m_nPlainLenMinTotal;
+ uint64 nIndexOfX = nIndex - CChainWalkContext::m_nPlainSpaceUpToX[nPlainLen - 1];
+
+ // Slow version, but never mind
+ for(ii = nPlainLen - 1; ii >= 0; ii--) {
+ nCharsetLen = 0;
+ for(jj = 0; jj < (int)CChainWalkContext::m_vCharset.size(); jj++) {
+ stCharset &chs = CChainWalkContext::m_vCharset[jj];
+ nCharsetLen += chs.m_nPlainLenMax;
+ if(ii < nCharsetLen) { // We found the correct charset
+ stPlain.push_back(nIndexOfX % chs.m_nPlainCharsetLen + 1);
+ nIndexOfX /= chs.m_nPlainCharsetLen;
+ }
+ }
+ }
+ return stPlain.size();
+}
--- /dev/null
+#ifndef RCUDA_EXT_H
+#define RCUDA_EXT_H
+
+#include "rcuda.h"
+#include "ChainWalkContext.h"
+
+class CudaCWCExtender {
+public:
+ CudaCWCExtender(CChainWalkContext *cwc);
+ void Init(void);
+ int IndexToStartPlain(const uint64 nIndex, std::vector<unsigned char>& stPlain);
+
+ inline rcuda::RHash GetHash(void) { return hash; }
+ inline unsigned int* GetPlainDimVec(void) { return &plainDimVec[0]; }
+ inline int GetPlainDimVecSize(void) { return plainDimVec.size(); }
+ inline unsigned char* GetCharSet(void) { return (unsigned char*)plainCharSet.c_str(); }
+ inline int GetCharSetSize(void) { return plainCharSet.size(); }
+ inline uint64 GetPlainSpaceTotal(void) { return CChainWalkContext::m_nPlainSpaceTotal; }
+ inline uint64 GetRainbowTableIndex(void) { return CChainWalkContext::m_nRainbowTableIndex; }
+ inline uint64 GetReduceOffset(void) { return CChainWalkContext::m_nReduceOffset; }
+
+protected:
+ CChainWalkContext *cwc;
+ rcuda::RHash hash;
+ std::vector<unsigned int> plainDimVec;
+ std::string plainCharSet;
+};
+
+#endif //RCUDA_EXT_H
--- /dev/null
+ļ»æ
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "distrrtgen", "..\distrrtgen\distrrtgen.vcxproj", "{A3BDF5F8-4D0A-4B27-B1D9-7E77CBDA86C7}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Debug|x64 = Debug|x64
+ Release|Win32 = Release|Win32
+ Release|x64 = Release|x64
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {A3BDF5F8-4D0A-4B27-B1D9-7E77CBDA86C7}.Debug|Win32.ActiveCfg = Debug|Win32
+ {A3BDF5F8-4D0A-4B27-B1D9-7E77CBDA86C7}.Debug|Win32.Build.0 = Debug|Win32
+ {A3BDF5F8-4D0A-4B27-B1D9-7E77CBDA86C7}.Debug|x64.ActiveCfg = Debug|x64
+ {A3BDF5F8-4D0A-4B27-B1D9-7E77CBDA86C7}.Debug|x64.Build.0 = Debug|x64
+ {A3BDF5F8-4D0A-4B27-B1D9-7E77CBDA86C7}.Release|Win32.ActiveCfg = Release|Win32
+ {A3BDF5F8-4D0A-4B27-B1D9-7E77CBDA86C7}.Release|Win32.Build.0 = Release|Win32
+ {A3BDF5F8-4D0A-4B27-B1D9-7E77CBDA86C7}.Release|x64.ActiveCfg = Release|x64
+ {A3BDF5F8-4D0A-4B27-B1D9-7E77CBDA86C7}.Release|x64.Build.0 = Release|x64
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
[rcracki_mt ChangeLog]
+0.6.5.1 (25 Oct 2010, 15:50:10):
+* rti2 fixes courtesy of PowerBlade
+
0.6.5 (24 Oct 2010, 18:21:25):
* code changes to allow building via mingw and avoid VC++
* linux thread priority set to nice value of 2
if(pReader->GetChainsLeft() <= 0) // No more data
break;
pReader->ReadChains(nDataRead, (RainbowChain*)pChain);
+
nDataRead *= 8; // Convert from chains read to bytes
}
else
m_fTotalDiskAccessTime += fTime;
int nRainbowChainCountRead = nDataRead / 16;
+
if(doRti2Format) {
nRainbowChainCountRead = nDataRead / 8;
}
+
// Verify table chunk
if (!fVerified)
{
--- /dev/null
+/*
+ * rcracki_mt 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>
+ *
+ * This file is part of rcracki_mt.
+ *
+ * rcracki_mt 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.
+ *
+ * rcracki_mt 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 rcracki_mt. 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 <openssl/des.h>
+//#include <openssl/md2.h>
+#include <openssl/md4.h>
+#include <openssl/sha.h>
+//#include <openssl/ripemd.h>
+#include "fast_md5.h"
+#include "md4.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)
+{
+ 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_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);
+}
+
+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;
+#if defined(_WIN32) && !defined(__GNUC__)
+ strcpy_s(username, sizeof(username), "SYS");
+#else
+ strcpy(username, "SYS");
+#endif
+ int userlen = 3;
+#if defined(_WIN32) && !defined(__GNUC__)
+ _strupr((char*) pPlain);
+#else
+ strupr((char*) pPlain);
+#endif
+ 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_NEW(UnicodePlain, nPlainLen * 2, pHash);
+}
+
+/*
+void HashMD2(unsigned char* pPlain, int nPlainLen, unsigned char* 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 HashMD5(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)
+{
+ fast_MD5(pPlain, nPlainLen, pHash);
+}
+void HashDoubleMD5(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)
+{
+ fast_MD5(pPlain, nPlainLen, pHash);
+ unsigned char hash[16];
+ memcpy(hash, pHash, 16);
+ fast_MD5(hash, 16, pHash);
+}
+
+void HashSHA1(unsigned char* pPlain, int nPlainLen, unsigned char* 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)
+{
+ 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)
+{
+ 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_NEW( (unsigned char*)unicode_pwd, nPlainLen*2, final1 );
+
+ 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);*/
+ fast_MD5((unsigned char *) pass, MD5_DIGEST_LENGTH, final);
+
+ 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);
+}
+
+#if !defined(_WIN32) || defined(__GNUC__)
+char *strupr(char *s1)
+{
+ char *p = s1;
+ while(*p)
+ {
+ *p = (char) toupper(*p);
+ p++;
+ }
+ return s1;
+}
+#endif
--- /dev/null
+/*
+ * rcracki_mt 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>
+ *
+ * This file is part of rcracki_mt.
+ *
+ * rcracki_mt 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.
+ *
+ * rcracki_mt 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 rcracki_mt. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#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 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 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);
+
+#if !defined(_WIN32) || defined(__GNUC__)
+char *strupr(char *s1);
+#endif
+#endif
--- /dev/null
+/*
+ * rcracki_mt 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>
+ *
+ * This file is part of rcracki_mt.
+ *
+ * rcracki_mt 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.
+ *
+ * rcracki_mt 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 rcracki_mt. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#if defined(_WIN32) && !defined(__GNUC__)
+ #pragma warning(disable : 4786 4267 4018)
+#endif
+
+#include "HashRoutine.h"
+#include "HashAlgorithm.h"
+
+//////////////////////////////////////////////////////////////////////
+
+CHashRoutine::CHashRoutine()
+{
+ // Notice: MIN_HASH_LEN <= nHashLen <= MAX_HASH_LEN
+
+
+ AddHashRoutine("lm", HashLM, 8);
+ AddHashRoutine("ntlm", HashNTLM, 16);
+// AddHashRoutine("md2", HashMD2, 16);
+ AddHashRoutine("md4", HashMD4, 16);
+ AddHashRoutine("md5", HashMD5, 16);
+ AddHashRoutine("doublemd5", HashDoubleMD5, 16);
+ AddHashRoutine("sha1", HashSHA1, 20);
+// AddHashRoutine("ripemd160", HashRIPEMD160, 20);
+ AddHashRoutine("mysql323", HashMySQL323, 8);
+ AddHashRoutine("mysqlsha1", HashMySQLSHA1, 20);
+ AddHashRoutine("ciscopix", HashPIX, 16);
+ AddHashRoutine("mscache", HashMSCACHE, 16);
+ AddHashRoutine("halflmchall", HashHALFLMCHALL, 8);
+
+ // Added from mao
+ AddHashRoutine("lmchall", HashLMCHALL, 24);
+ AddHashRoutine("ntlmchall", HashNTLMCHALL, 24);
+ AddHashRoutine("oracle", HashORACLE, 8);
+}
+
+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;
+ UINT4 i;
+ for (i = 0; i < vHashRoutineName.size(); i++)
+ sRet += vHashRoutineName[i] + " ";
+
+ return sRet;
+}
+
+void CHashRoutine::GetHashRoutine(string sHashRoutineName, HASHROUTINE& pHashRoutine, int& nHashLen)
+{
+ UINT4 i;
+ for (i = 0; i < vHashRoutineName.size(); i++)
+ {
+ if (sHashRoutineName == vHashRoutineName[i])
+ {
+ pHashRoutine = vHashRoutine[i];
+ nHashLen = vHashLen[i];
+ return;
+ }
+ }
+
+ pHashRoutine = NULL;
+ nHashLen = 0;
+}
--- /dev/null
+/*
+ * rcracki_mt 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>
+ *
+ * This file is part of rcracki_mt.
+ *
+ * rcracki_mt 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.
+ *
+ * rcracki_mt 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 rcracki_mt. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _HASHROUTINE_H
+#define _HASHROUTINE_H
+
+#include <string>
+#include <vector>
+
+#include "global.h"
+
+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
--- /dev/null
+/*
+ * rcracki_mt is a multithreaded implementation and fork of the original
+ * RainbowCrack
+ *
+ * Copyright Bitweasil
+ * Copyright 2009, 2010 Daniƫl Niggebrugge <niggebrugge@fox-it.com>
+ * Copyright 2009, 2010 James Nobis <frt@quelrod.net>
+ *
+ * This file is part of rcracki_mt.
+ *
+ * rcracki_mt 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.
+ *
+ * rcracki_mt 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 rcracki_mt. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * This code implements the MD4 message-digest algorithm.
+ * "Just the reference implementation, single stage. Hardly "optimized." Though a good bit faster than libssl's MD4, as it isn't doing nearly the same amount of work." - Bitweasil
+ *
+ * little bit optimized (or at least attempted) for NTLM (unicode) by neinbrucke
+ */
+
+
+//#include <cstdlib>
+//#include <cstring>
+#include "md4.h"
+
+/* MD4 Defines as per RFC reference implementation */
+#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
+#define G(x, y, z) (((x) & (y)) | ((x) & (z)) | ((y) & (z)))
+#define H(x, y, z) ((x) ^ (y) ^ (z))
+#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
+#define FF(a, b, c, d, x, s) { \
+ (a) += F ((b), (c), (d)) + (x); \
+ (a) = ROTATE_LEFT ((a), (s)); \
+ }
+#define GG(a, b, c, d, x, s) { \
+ (a) += G ((b), (c), (d)) + (x) + (UINT4)0x5a827999; \
+ (a) = ROTATE_LEFT ((a), (s)); \
+ }
+#define HH(a, b, c, d, x, s) { \
+ (a) += H ((b), (c), (d)) + (x) + (UINT4)0x6ed9eba1; \
+ (a) = ROTATE_LEFT ((a), (s)); \
+ }
+#define S11 3
+#define S12 7
+#define S13 11
+#define S14 19
+#define S21 3
+#define S22 5
+#define S23 9
+#define S24 13
+#define S31 3
+#define S32 9
+#define S33 11
+#define S34 15
+/* End MD4 Defines */
+
+void MD4_NEW( unsigned char * pData, int length, unsigned char * pDigest)
+{
+ // access data as 4-byte word
+ #define uData ((UINT4 *)pData)
+ #define uDigest ((UINT4 *)pDigest)
+
+ // pad word and append bit at appropriate location
+ #define MD4_pad_w0() (0x00000080)
+ #define MD4_pad_w1(data) (((data) & 0x000000FF) | 0x00008000)
+ #define MD4_pad_w2(data) (((data) & 0x0000FFFF) | 0x00800000)
+ #define MD4_pad_w3(data) (((data) & 0x00FFFFFF) | 0x80000000)
+
+ // For the hash working space
+ //__attribute__((aligned(16))) UINT4 data[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+ //__declspec(align(16)) UINT4 data[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+ UINT4 data[MD4_DIGEST_LENGTH] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+
+ // For the output result
+ UINT4 a,b,c,d;
+
+ switch (length)
+ {
+ case 0:
+ {
+ data[ 0] = MD4_pad_w0();
+
+ data[14] = 0;
+ }
+ break;
+ case 1:
+ {
+ data[ 0] = MD4_pad_w1(uData[0]);
+
+ data[14] = 1 << 3;
+ }
+ break;
+ case 2:
+ {
+ data[ 0] = MD4_pad_w2(uData[0]);
+
+ data[14] = 2 << 3;
+ }
+ break;
+ case 3:
+ {
+ data[ 0] = MD4_pad_w3(uData[0]);
+
+ data[14] = 3 << 3;
+ }
+ break;
+ case 4:
+ {
+ data[ 0] = uData[0];
+ data[ 1] = MD4_pad_w0();
+
+ data[14] = 4 << 3;
+ }
+ break;
+ case 5:
+ {
+ data[ 0] = uData[0];
+ data[ 1] = MD4_pad_w1(uData[1]);
+
+ data[14] = 5 << 3;
+ }
+ break;
+ case 6:
+ {
+ data[ 0] = uData[0];
+ data[ 1] = MD4_pad_w2(uData[1]);
+
+ data[14] = 6 << 3;
+ }
+ break;
+ case 7:
+ {
+ data[ 0] = uData[0];
+ data[ 1] = MD4_pad_w3(uData[1]);
+
+ data[14] = 7 << 3;
+ }
+ break;
+ case 8:
+ {
+ data[ 0] = uData[0];
+ data[ 1] = uData[1];
+ data[ 2] = MD4_pad_w0();
+
+ data[14] = 8 << 3;
+ }
+ break;
+ case 9:
+ {
+ data[ 0] = uData[0];
+ data[ 1] = uData[1];
+ data[ 2] = MD4_pad_w1(uData[2]);
+
+ data[14] = 9 << 3;
+ }
+ break;
+ case 10:
+ {
+ data[ 0] = uData[0];
+ data[ 1] = uData[1];
+ data[ 2] = MD4_pad_w2(uData[2]);
+
+ data[14] = 10 << 3;
+ }
+ break;
+ case 11:
+ {
+ data[ 0] = uData[0];
+ data[ 1] = uData[1];
+ data[ 2] = MD4_pad_w3(uData[2]);
+
+ data[14] = 11 << 3;
+ }
+ break;
+ case 12:
+ {
+ data[ 0] = uData[0];
+ data[ 1] = uData[1];
+ data[ 2] = uData[2];
+ data[ 3] = MD4_pad_w0();
+
+ data[14] = 12 << 3;
+ }
+ break;
+ case 13:
+ {
+ data[ 0] = uData[0];
+ data[ 1] = uData[1];
+ data[ 2] = uData[2];
+ data[ 3] = MD4_pad_w1(uData[3]);
+
+ data[14] = 13 << 3;
+ }
+ break;
+ case 14:
+ {
+ data[ 0] = uData[0];
+ data[ 1] = uData[1];
+ data[ 2] = uData[2];
+ data[ 3] = MD4_pad_w2(uData[3]);
+
+ data[14] = 14 << 3;
+ }
+ break;
+ case 15:
+ {
+ data[ 0] = uData[0];
+ data[ 1] = uData[1];
+ data[ 2] = uData[2];
+ data[ 3] = MD4_pad_w3(uData[3]);
+
+ data[14] = 15 << 3;
+ }
+ break;
+
+ default:
+ {
+ length = length % 32; // lenght >= 32 not suported
+
+ int word = length >> 2;
+
+ int i = 0;
+ while (i < word) {
+ data[i] = uData[i];
+ i++;
+ }
+
+ switch (length & 0x3) {
+ case 0:
+ {
+ data[word] = MD4_pad_w0();
+ }
+ break;
+ case 1:
+ {
+ data[word] = MD4_pad_w1(uData[word]);
+ }
+ break;
+ case 2:
+ {
+ data[word] = MD4_pad_w2(uData[word]);
+ }
+ break;
+ case 3:
+ {
+ data[word] = MD4_pad_w3(uData[word]);
+ }
+ break;
+ }
+
+ data[14] = length << 3;
+ }
+ break;
+ }
+
+ a = 0x67452301;
+ b = 0xefcdab89;
+ c = 0x98badcfe;
+ d = 0x10325476;
+
+ /* Round 1 */
+ FF (a, b, c, d, data[ 0], S11); /* 1 */
+ FF (d, a, b, c, data[ 1], S12); /* 2 */
+ FF (c, d, a, b, data[ 2], S13); /* 3 */
+ FF (b, c, d, a, data[ 3], S14); /* 4 */
+ FF (a, b, c, d, data[ 4], S11); /* 5 */
+ FF (d, a, b, c, data[ 5], S12); /* 6 */
+ FF (c, d, a, b, data[ 6], S13); /* 7 */
+ FF (b, c, d, a, data[ 7], S14); /* 8 */
+ FF (a, b, c, d, 0, S11); /* 9 */
+ FF (d, a, b, c, 0, S12); /* 10 */
+ FF (c, d, a, b, 0, S13); /* 11 */
+ FF (b, c, d, a, 0, S14); /* 12 */
+ FF (a, b, c, d, 0, S11); /* 13 */
+ FF (d, a, b, c, 0, S12); /* 14 */
+ FF (c, d, a, b, data[14], S13); /* 15 */
+ FF (b, c, d, a, 0, S14); /* 16 */
+
+ /* Round 2 */
+ GG (a, b, c, d, data[ 0], S21); /* 17 */
+ GG (d, a, b, c, data[ 4], S22); /* 18 */
+ GG (c, d, a, b, 0, S23); /* 19 */
+ GG (b, c, d, a, 0, S24); /* 20 */
+ GG (a, b, c, d, data[ 1], S21); /* 21 */
+ GG (d, a, b, c, data[ 5], S22); /* 22 */
+ GG (c, d, a, b, 0, S23); /* 23 */
+ GG (b, c, d, a, 0, S24); /* 24 */
+ GG (a, b, c, d, data[ 2], S21); /* 25 */
+ GG (d, a, b, c, data[ 6], S22); /* 26 */
+ GG (c, d, a, b, 0, S23); /* 27 */
+ GG (b, c, d, a, data[14], S24); /* 28 */
+ GG (a, b, c, d, data[ 3], S21); /* 29 */
+ GG (d, a, b, c, data[ 7], S22); /* 30 */
+ GG (c, d, a, b, 0, S23); /* 31 */
+ GG (b, c, d, a, 0, S24); /* 32 */
+
+ /* Round 3 */
+ HH (a, b, c, d, data[ 0], S31); /* 33 */
+ HH (d, a, b, c, 0, S32); /* 34 */
+ HH (c, d, a, b, data[ 4], S33); /* 35 */
+ HH (b, c, d, a, 0, S34); /* 36 */
+ HH (a, b, c, d, data[ 2], S31); /* 37 */
+ HH (d, a, b, c, 0, S32); /* 38 */
+ HH (c, d, a, b, data[ 6], S33); /* 39 */
+ HH (b, c, d, a, data[14], S34); /* 40 */
+ HH (a, b, c, d, data[ 1], S31); /* 41 */
+ HH (d, a, b, c, 0, S32); /* 42 */
+ HH (c, d, a, b, data[ 5], S33); /* 43 */
+ HH (b, c, d, a, 0, S34); /* 44 */
+ HH (a, b, c, d, data[ 3], S31); /* 45 */
+ HH (d, a, b, c, 0, S32); /* 46 */
+ HH (c, d, a, b, data[ 7], S33); /* 47 */
+ HH (b, c, d, a, 0, S34); /* 48 */
+
+ // Finally, add initial values, as this is the only pass we make.
+ a += 0x67452301;
+ b += 0xefcdab89;
+ c += 0x98badcfe;
+ d += 0x10325476;
+
+ uDigest[0] = a;
+ uDigest[1] = b;
+ uDigest[2] = c;
+ uDigest[3] = d;
+}
--- /dev/null
+/*
+ * rcracki_mt is a multithreaded implementation and fork of the original
+ * RainbowCrack
+ *
+ * Copyright Bitweasil
+ * Copyright 2009, 2010 Daniƫl Niggebrugge <niggebrugge@fox-it.com>
+ * Copyright 2009, 2010 James Nobis <frt@quelrod.net>
+ *
+ * This file is part of rcracki_mt.
+ *
+ * rcracki_mt 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.
+ *
+ * rcracki_mt 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 rcracki_mt. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef MD4_H
+#define MD4_H
+
+#include "global.h"
+
+#define MD4_DIGEST_LENGTH 16
+
+//Main function
+void MD4_NEW( unsigned char * buf, int len, unsigned char * pDigest);
+
+#endif /* !MD4_H */
bool boinc_ReadLinesFromFile(string sPathName, vector<string>& vLine)
{
vLine.clear();
- char input_path[512];
+ vLine.push_back("byte = []");
+ vLine.push_back("alpha = [ABCDEFGHIJKLMNOPQRSTUVWXYZ]");
+ vLine.push_back("alpha-space = [ABCDEFGHIJKLMNOPQRSTUVWXYZ ]");
+ vLine.push_back("alpha-numeric = [ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]");
+ vLine.push_back("alpha-numeric-space = [ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ]");
+ vLine.push_back("alpha-numeric-symbol14 = [ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\x21\x40\x23\x24\x25\x5E\x26\x2A\x28\x29\x2D\x5F\x2B\x3D]");
+ vLine.push_back("alpha-numeric-symbol14-space= [ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\x21\x40\x23\x24\x25\x5E\x26\x2A\x28\x29\x2D\x5F\x2B\x3D\x20]");
+ vLine.push_back("all = [ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\x21\x40\x23\x24\x25\x5E\x26\x2A\x28\x29\x2D\x5F\x2B\x3D\x7E\x60\x5B\x5D\x7B\x7D\x7C\x5C\x3A\x3B\x22\x27\x3C\x3E\x2C\x2E\x3F\x2F]");
+ vLine.push_back("all-space = [ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\x21\x40\x23\x24\x25\x5E\x26\x2A\x28\x29\x2D\x5F\x2B\x3D\x7E\x60\x5B\x5D\x7B\x7D\x7C\x5C\x3A\x3B\x22\x27\x3C\x3E\x2C\x2E\x3F\x2F\x20]");
+ vLine.push_back("alpha-numeric-symbol32-space = [ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\x21\x40\x23\x24\x25\x5E\x26\x2A\x28\x29\x2D\x5F\x2B\x3D\x7E\x60\x5B\x5D\x7B\x7D\x7C\x5C\x3A\x3B\x22\x27\x3C\x3E\x2C\x2E\x3F\x2F\x20]");
+ vLine.push_back("lm-frt-cp437 = [\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2A\x2B\x2C\x2D\x2E\x2F\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3A\x3B\x3C\x3D\x3E\x3F\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4A\x4B\x4C\x4D\x4E\x4F\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5A\x5B\x5C\x5D\x5E\x5F\x60\x7B\x7C\x7D\x7E\x80\x8E\x8F\x90\x92\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA5\xE0\xE1\xE2\xE3\xE4\xE6\xE7\xE8\xE9\xEA\xEB\xEE]");
+ vLine.push_back("lm-frt-cp850 = [\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2A\x2B\x2C\x2D\x2E\x2F\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3A\x3B\x3C\x3D\x3E\x3F\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4A\x4B\x4C\x4D\x4E\x4F\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5A\x5B\x5C\x5D\x5E\x5F\x60\x7B\x7C\x7D\x7E\x80\x8E\x8F\x90\x92\x99\x9A\x9C\x9D\x9F\xA5\xB5\xB6\xB7\xBD\xBE\xC7\xCF\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xDE\xE0\xE1\xE2\xE3\xE5\xE6\xE8\xE9\xEA\xEB\xED\xEF]");
+ vLine.push_back("lm-frt-cp437-850 = [\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2A\x2B\x2C\x2D\x2E\x2F\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3A\x3B\x3C\x3D\x3E\x3F\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4A\x4B\x4C\x4D\x4E\x4F\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5A\x5B\x5C\x5D\x5E\x5F\x60\x7B\x7C\x7D\x7E\x80\x8E\x8F\x90\x92\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA5\xB5\xB6\xB7\xBD\xBE\xC7\xCF\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xDE\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xED\xEE\xEF]");
+ vLine.push_back("numeric = [0123456789]");
+ vLine.push_back("numeric-space = [0123456789 ]");
+ vLine.push_back("loweralpha = [abcdefghijklmnopqrstuvwxyz]");
+ vLine.push_back("loweralpha-space = [abcdefghijklmnopqrstuvwxyz ]");
+ vLine.push_back("loweralpha-numeric = [abcdefghijklmnopqrstuvwxyz0123456789]");
+ vLine.push_back("loweralpha-numeric-space = [abcdefghijklmnopqrstuvwxyz0123456789 ]");
+ vLine.push_back("loweralpha-numeric-symbol14 = [abcdefghijklmnopqrstuvwxyz0123456789\x21\x40\x23\x24\x25\x5E\x26\x2A\x28\x29\x2D\x5F\x2B\x3D]");
+ vLine.push_back("loweralpha-numeric-all = [abcdefghijklmnopqrstuvwxyz0123456789\x21\x40\x23\x24\x25\x5E\x26\x2A\x28\x29\x2D\x5F\x2B\x3D\x7E\x60\x5B\x5D\x7B\x7D\x7C\x5C\x3A\x3B\x22\x27\x3C\x3E\x2C\x2E\x3F\x2F]");
+ vLine.push_back("loweralpha-numeric-symbol32-space= [abcdefghijklmnopqrstuvwxyz0123456789\x21\x40\x23\x24\x25\x5E\x26\x2A\x28\x29\x2D\x5F\x2B\x3D\x7E\x60\x5B\x5D\x7B\x7D\x7C\x5C\x3A\x3B\x22\x27\x3C\x3E\x2C\x2E\x3F\x2F\x20]");
+ vLine.push_back("mixalpha = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]");
+ vLine.push_back("mixalpha-space = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ]");
+ vLine.push_back("mixalpha-numeric = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]");
+ vLine.push_back("mixalpha-numeric-space = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ]");
+ vLine.push_back("mixalpha-numeric-symbol14 = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\x21\x40\x23\x24\x25\x5E\x26\x2A\x28\x29\x2D\x5F\x2B\x3D]");
+ vLine.push_back("mixalpha-numeric-all = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\x21\x40\x23\x24\x25\x5E\x26\x2A\x28\x29\x2D\x5F\x2B\x3D\x7E\x60\x5B\x5D\x7B\x7D\x7C\x5C\x3A\x3B\x22\x27\x3C\x3E\x2C\x2E\x3F\x2F]");
+ vLine.push_back("mixalpha-numeric-symbol32-space = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\x21\x40\x23\x24\x25\x5E\x26\x2A\x28\x29\x2D\x5F\x2B\x3D\x7E\x60\x5B\x5D\x7B\x7D\x7C\x5C\x3A\x3B\x22\x27\x3C\x3E\x2C\x2E\x3F\x2F\x20]");
+ vLine.push_back("mixalpha-numeric-all-space = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\x21\x40\x23\x24\x25\x5E\x26\x2A\x28\x29\x2D\x5F\x2B\x3D\x7E\x60\x5B\x5D\x7B\x7D\x7C\x5C\x3A\x3B\x22\x27\x3C\x3E\x2C\x2E\x3F\x2F\x20]");
+
+/* char input_path[512];
boinc_resolve_filename(sPathName.c_str(), input_path, sizeof(input_path));
FILE *file = boinc_fopen(input_path, "rb");
if (!file) {
}
else
return false;
-
+ */
return true;
}
#endif
//#include "spr.h"
extern const DES_LONG des_SPtrans[8][64];
+
+
void des_encrypt1(DES_LONG *data, des_key_schedule ks, int enc)
{
register DES_LONG l,r,t,u;
#include <stdio.h>
#include "des_locl.h"
-#include "spr.h"
+//#include "spr.h"
/* char *libdes_version="libdes v 3.24 - 20-Apr-1996 - eay"; */ /* wrong */
/* char *DES_version="DES part of SSLeay 0.6.4 30-Aug-1996"; */
+extern const DES_LONG des_SPtrans[8][64];
+
char *des_options(void)
{
static int init=1;
* copied and put under another distribution licence
* [including the GNU Public Licence.]
*/
-
static const DES_LONG des_skb[8][64]={
{
/* for C bits (numbered as per FIPS 46) 1 2 3 4 5 6 */
#ifndef __SPR_H__
#define __SPR_H__
+
const DES_LONG des_SPtrans[8][64]={
{
/* nibble 0 */