How to brute-force passwords using GPU and CPU in Linux

Drivers for graphics card and CPU to brute-force password

If you wonder how to crack passwords with GPU and CPU in Linux than continue reading. This article shows what drivers and programs to install so that hashcat and similar brute-force programs can use a GPU and CPU to crack passwords.

Hashcat uses OpenCL. According to Wikipedia, OpenCL (Open Computing Language) is a framework for writing programs that execute across heterogeneous platforms consisting of central processing units (CPUs), graphics processing units (GPUs), digital signal processors (DSPs), field-programmable gate arrays (FPGAs) and other processors or hardware accelerators. OpenCL specifies programming languages (based on C99 and C++11) for programming these devices and application programming interfaces (APIs) to control the platform and execute programs on the compute devices. OpenCL provides a standard interface for parallel computing using task- and data-based parallelism.

OpenCL is an open standard maintained by the non-profit technology consortium Khronos Group. Conformant implementations are available from Altera, AMD, Apple (OpenCL along with OpenGL is deprecated for Apple hardware, in favor of Metal 2), ARM, Creative, IBM, Imagination, Intel, Nvidia, Qualcomm, Samsung, Vivante, Xilinx, and ZiiLABS.

That is, due to such universality of OpenCL, programs for password recovery, including hashcat, can work with any hardware that support OpenCL.

AMD, NVIDIA, and Intel GPU support OpenCL.

Information on supported Intel processors can be found at (support for “Intel Graphics Compute Runtime for oneAPI Level Zero and OpenCL” appeared with Gen8) and /content/www/ru/ru/support/articles/000005524/graphics-drivers.html (OpenCL support by different generations and processor models).

AMD, NVIDIA video cards also mostly support OpenCL, except for very old ones.

OpenCL requires driver installation and tools for interacting with OpenCL. This article will help you to intall OpenCL on Linux. Similar instructions for Windows are given in the article “Hashcat manual: how to use the program for cracking passwords” (see the “Drivers for hashcat” section).

So, the requirements for hashcat to work with OpenCL are as follows:

  • For AMD graphics cards, you need: “RadeonOpenCompute (ROCm)” Software Platform (1.6.180 or later)
  • Intel processors require: "OpenCL Runtime for Intel Core and Intel Xeon Processors" (16.1.1 or later)
  • For NVIDIA graphics cards, you must: "NVIDIA Driver" (367.x or later)

For older processors (before Broadwell), the "OpenCL 2.0 GPU Driver Package for Linux" (Iris, Iris Pro) is used.

This article will show you how to install everything you need to use OpenCL on NVIDIA graphics cards and modern Intel processors. Instructions will be given on the example of Kali Linux (should also be suitable for Debian, Linux Mint, Ubuntu and their derivatives) and Arch Linux (BlackArch).

How to enable OpenCL on Kali Linux (Debian, Linux Mint, Ubuntu) for hashcat

Enabling OpenCL for NVIDIA

Start with a full system upgrade and then reboot:

sudo apt update && sudo apt full-upgrade -y

After we updated the system, we need to check the nouveau kernel modules (Open Source Nvidia drivers, they will conflict with proprietary ones)

lsmod | grep -i nouveau

If the previous command outputed something, for example:

nouveau 1499136 1
mxm_wmi 16384 1 nouveau
wmi 16384 2 mxm_wmi,nouveau
video 40960 1 nouveau

this means that nouveau is in use. Therefore, you must add them to the blacklist:

echo -e "blacklist nouveau\noptions nouveau modeset=0\nalias nouveau off" | sudo tee /etc/modprobe.d/blacklist-nouveau.conf

After changing the kernel parameters, we need to update our initramfs and reboot.

update-initramfs -u && reboot

After rebooting and verifying that the nouveau modules are not loaded, we proceed to install the OpenCL ICD bootloader, drivers, and the CUDA toolkit.

sudo apt install -y ocl-icd-libopencl1 nvidia-driver nvidia-cuda-toolkit

During driver installation, the system creates new kernel modules, so another reboot is required.

Checking installed drivers

Now our system should be ready, we need to check that the drivers are loaded correctly. We can quickly verify this by running the nvidia-smi tool.


The output shows that our driver and GPU are fine – we can proceed to crack passwords. Before continuing, let's check again and make sure hashcat and CUDA work together.

hashcat -I


If you get the clGetDeviceIDs(): CL_DEVICE_NOT_FOUND error marked Platform ID Vendor: Mesa, then run:

sudo apt remove mesa-opencl-icd

Enabling OpenCL for Intel

If your CPU supports OpenCL, then install the following packages:

sudo apt install firmware-misc-nonfree intel-opencl-icd

Let's look at the list of devices again (a new device should be added):

hashcat -I

And run the benchmark again:

hashcat -b -D 1,2 --force

How to enable OpenCL on Arch Linux (BlackArch) for hashcat

Enabling OpenCL for NVIDIA

Remove xf86-video-nouveau if it’s installed:

sudo pacman -R xf86-video-nouveau

Install the NVIDIA Proprietary Driver:

sudo pacman -S nvidia nvidia-utils

Install the CUDA driver and other necessary packages, as well as hashcat:

sudo pacman -S opencl-nvidia opencl-headers cuda hashcat

Enabling OpenCL for Intel

sudo pacman -S linux-firmware intel-compute-runtime pocl

Now check the list of devices:

hashcat -I

Launch the benchmark:

hashcat -b -D 1,2 --force

beignet package

beignet is an OpenCL implementation for Intel IvyBridge and Haswell iGPUs. This package is currently deprecated and should be replaced by intel-compute-runtime. I have beignet installed in my system, then an additional OpenCL device appears – like on Kali Linux, where 3 OpenCL devices are also visible. But this device is unstable with Hashcat.

You can test how beignet behaves on your system. Perhaps for older processors this is the only option.

OpenCL for AMD

If you own an AMD card, please share with other readers your experience installing the AMD driver with OpenCL support. Write your commands for installation in the comments and I will add a new section to the article. If possible, take screenshots and/or benchmarks.

See also:

Last Updated on

Recommended for you:

Leave a Reply

Your email address will not be published.