Initial commit
[hashcat.git] / docs / BUILD.md
1 oclHashcat build documentation
2 =
3 # Revision:
4 * 1.0
5
6 # Authors:
7 * Gabriele Gristina <<matrix@hashcat.net>>
8 * Christoph Heuwieser <<dropdead@hashcat.net>>
9
10 # Dependencies
11
12 To compile **oclHashcat** the following third party libraries are required:
13
14     ADL_SDK v8.0 - http://developer.amd.com/tools-and-sdks/graphics-development/display-library-adl-sdk/
15     cuda v7.5 - https://developer.nvidia.com/cuda-downloads
16     GDK v352_55 - https://developer.nvidia.com/gpu-deployment-kit
17     NVIDIA Driver v352.21 - https://www.nvidia.com/download/driverResults.aspx/86390/en-us
18     NVAPI R352 - https://developer.nvidia.com/nvapi
19     AMD-APP-SDK v3.0 - http://developer.amd.com/tools-and-sdks/opencl-zone/amd-accelerated-parallel-processing-app-sdk/
20     
21 To be able to compile the ocl binaries, it is required to have the latest stable driver from AMD installed.
22 (fglxr must be installed and initialized)
23
24     http://support.amd.com/
25
26 The next thing to do is download all the third party libraries listed above and put files into */opt/hashcat-deps/tmp* directory.
27
28 The following files are needed inside the */opt/hashcat-deps/tmp* directory:
29     
30     ADL_SDK8.zip
31     R352-developer.zip
32     cuda_7.5.18_linux.run
33     NVIDIA-Linux-x86_64-352.21.run
34     gdk_linux_amd64_352_55_release.run
35     AMDAPPSDK-3.0-linux64.tar.bz2
36
37 Now just execute the following script to complete the installation of dependencies (check for an updated version in **docs/deps.sh**):
38
39     #!/bin/bash
40     # Author: Gabriele Gristina <matrix@hashcat.net>
41     # Revision: 1.0
42     
43     ## global vars
44     DEPS="make gcc-4.9 g++-4.9 gcc-4.9-multilib g++-4.9-multilib libc6-dev-i386 mingw-w64 build-essential unzip"
45     DOWNLOAD_DEPS="ADL_SDK8.zip R352-developer.zip cuda_7.5.18_linux.run NVIDIA-Linux-x86_64-352.21.run gdk_linux_amd64_352_55_release.run AMDAPPSDK-3.0-linux64.tar.bz2"
46     
47     ## root check
48     if [ $(id -u) -ne 0 ]; then
49         echo "! Must be root"
50         exit 1
51     fi
52     
53     ## cleanup 'hashcat-deps' directories
54     rm -rf /opt/hashcat-deps/{adl-sdk,cuda-7.5,NVIDIA-Linux-x86_64-352.21,nvidia-gdk,amd-app-sdk} && \
55     mkdir -p /opt/hashcat-deps/{tmp,adl-sdk,cuda-7.5,NVIDIA-Linux-x86_64-352.21,nvidia-gdk,amd-app-sdk} && \
56     cd /opt/hashcat-deps/tmp
57     
58     if [ $? -ne 0 ]; then
59         echo "! Cannot create hashcat-deps directories."
60         exit 1
61     fi
62     
63     ## check dependencies
64     i=0
65     for d in ${DOWNLOAD_DEPS}; do
66         if [ ! -f "${d}" ]; then
67                 echo "! ${d} not found."
68                 ((i++))
69         fi
70     done
71     
72     if [ ${i} -gt 0 ]; then
73         echo "! Please download manually into the directory /opt/hashcat-deps/tmp"
74         exit 1
75     fi
76     
77     ## installing needed packages
78     for pkg in ${DEPS}; do
79         apt-get -y install ${pkg}
80         if [ $? -ne 0 ]; then
81                 echo "! failed to install ${pkg}"
82                 exit 1
83         fi
84     done
85     
86     ## extract ADL SDK
87     unzip ADL_SDK8.zip -d /opt/hashcat-deps/adl-sdk-8
88     ret=$?
89     
90     if [[ ${ret} -ne 0 ]] && [[ ${ret} -ne 1 ]]; then
91         echo "! failed to extract ADL SDK"
92         exit 1
93     fi
94     
95     rm -rf /opt/hashcat-deps/adl-sdk && ln -s /opt/hashcat-deps/adl-sdk-8 /opt/hashcat-deps/adl-sdk
96
97     if [ $? -ne 0 ]; then
98         echo "! failed to setup ADL SDK link"
99         exit 1
100     fi
101     
102     ## extract NVAPI
103     unzip R352-developer.zip -d /opt/hashcat-deps/
104     ret=$?
105     
106     if [[ ${ret} -ne 0 ]] && [[ ${ret} -ne 1 ]]; then
107         echo "! failed to extract NVAPI"
108         exit 1
109     fi
110     
111     ## install CUDA SDK
112     chmod +x cuda_7.5.18_linux.run && \
113     ./cuda_7.5.18_linux.run -toolkit -silent -override --toolkitpath=/opt/hashcat-deps/cuda-7.5
114     
115     if [ $? -ne 0 ]; then
116         echo "! failed to install CUDA SDK"
117         exit 1
118     fi
119     
120     ## install NVIDIA Driver
121     chmod +x NVIDIA-Linux-x86_64-352.21.run && \
122     ./NVIDIA-Linux-x86_64-352.21.run -x && \
123     mv NVIDIA-Linux-x86_64-352.21 /opt/hashcat-deps/ && \
124     cd /opt/hashcat-deps/NVIDIA-Linux-x86_64-352.21 && \
125     ln -s libnvidia-ml.so.352.21 libnvidia-ml.so && \
126     ln -s libcuda.so.352.21 libcuda.so && \
127     cd 32 && \
128     ln -s libnvidia-ml.so.352.21 libnvidia-ml.so && \
129     ln -s libcuda.so.352.21 libcuda.so && \
130     cd /opt/hashcat-deps/tmp
131     
132     if [ $? -ne 0 ]; then
133         echo "! failed to install NVIDIA Driver"
134         exit 1
135     fi
136     
137     ## install NVIDIA GPU Deployment Kit
138     chmod +x gdk_linux_amd64_352_55_release.run && \
139     ./gdk_linux_amd64_352_55_release.run --silent --installdir=/opt/hashcat-deps/nvidia-gdk
140     
141     if [ $? -ne 0 ]; then
142         echo "! failed to install NVIDIA GPU Deployment Kit"
143         exit 1
144     fi
145     
146     ## extract AMD APP SDK
147     tar xjf AMDAPPSDK-3.0-linux64.tar.bz2 && \
148     ./AMD-APP-SDK-v3.0.130.135-GA-linux64.sh --noexec --target /opt/hashcat-deps/amd-app-sdk-v3.0.130.135
149     
150     if [ $? -ne 0 ]; then
151         echo "! failed to extract AMD APP SDK"
152         exit 1
153     fi
154     
155     rm -rf /opt/hashcat-deps/amd-app-sdk && ln -s /opt/hashcat-deps/amd-app-sdk-v3.0.130.135 /opt/hashcat-deps/amd-app-sdk
156
157     if [ $? -ne 0 ]; then
158         echo "! failed to setup ADL SDK link"
159         exit 1
160     fi
161     
162     echo "> oclHashcat dependencies have been resolved."
163     
164 # Building oclHashcat
165 First get a copy of **oclHashcat** repository
166
167 ```sh
168 $ git clone https://github.com/hashcat/oclHashcat.git
169 ```
170
171 Now simply jump in and type "make all"
172
173 ```sh
174 $ cd oclHashcat
175 $ make all
176 ```
177
178 Useful tricks:
179 - build only *Linux* binaries
180 ```sh
181 $ make linux
182 ```
183 - build only *Windows* binaries
184 ```sh
185 $ make windows
186 ```
187 - build only *AMD kernel* binaries
188 ```sh
189 $ make amd_all
190 ```
191 - build only *NVIDIA kernel* binaries
192 ```sh
193 $ make nv_all
194 ```
195
196 =
197 Enjoy your fresh **oclHashcat** binaries ;)