martin carpenter


most popular
2012/05/05, updated 2012/12/15
ubuntu unity lens for vim

john the ripper, cuda, ubuntu


tags: ubuntu cracking cuda

I was curious how well GPU hashing on my low-end (60 USD) graphics card GPU would compare with my significantly higher-end CPU (i7 960) for password hashing.


install nVidia CUDA drivers and SDK

Proprietary driver installs from Ubuntu need to be enabled in the Software Center. Then the "Additional Drivers" program (jockey-gtk or jockey-txt from the command line) can be used to activate the required version.

I tried all of the currently available nVidia drivers from Ubuntu, including the bleeding edge 304 and 310 "experimental" versions. None of these will work with the CUDA 5 SDK (latest at time of writing). So I reverted to the CUDA 4.2 SDK but retained the 310 drivers (allegedly the 295 non-experimental drivers will work fine too). You will need to reboot after activating a new driver install. None of the currently available CUDA toolkits is officially supported under Ubuntu 12 but they seem to work just fine.

You can probably do something smart by removing all traces of Ubuntu's nVidia packages from your system and installing the latest drivers direct from nVidia in order to use CUDA 5 but I didn't want to stray too far from a stock OS install.

build and install john

Although the Ubuntu repository contains a JtR package it's getting a bit old. And it isn't CUDA enabled. So we need to build from source.

me@home:~$ wget
me@home:~$ tar zxf john-1.7.9-jumbo-7.tar.gz
me@home:~$ cd john-1.7.9-jumbo-7
me@home:~/john-1.7.9-jumbo-7$ make clean linux-x86-64-cuda


The first command may take a little while to complete.

me@home:~/john-1.7.9-jumbo-7$ ./run/john -test

The second should list your video card specs. If it does not then this is problematic. Fix this.

me@home:~/john-1.7.9-jumbo-7$ ./run/john --list=cuda-devices
1 CUDA devices found:

CUDA Device #0
    Name:                          GeForce GT 220
    Compute capability:            sm_12
    Number of multiprocessors:     6
    Clock rate:                    1328 Mhz
    Total global memory:           1.0 GB
    Total shared memory per block: 16.0 kB
    Total constant memory:         64.0 kB
    Kernel execution timeout:      Yes
    Concurrent copy and execution: Yes
    Concurrent kernels support:    No
    Warp size:                     32



Cipher names take a trailing -cuda so you will need to use the --format flag:

me@home:~/john-1.7.9-jumbo-7$ ./run/john --format=raw-sha256-cuda hashes.txt
Loaded 2 password hashes with no different salts (Raw SHA-256 [CUDA (inefficient, development use mostly)])


Despite the fact that JtR's CUDA code comes with "inefficient, development use mostly" warnings and that my card is distinctly not top of the range it runs SHA-256 approximately three times faster than a single i7 960 CPU thread. In sustained use video card temperature settled at a steady 48C compared to a standard operating temperature of 35C. Window redraw performance became sluggish (but not unbearably slow) but all virtual terminals were unusable due to "noise".