depot/third_party/nixpkgs/pkgs/tools/security/hashcat/default.nix
Default email 9c6ee729d6 Project import generated by Copybara.
GitOrigin-RevId: 6cee3b5893090b0f5f0a06b4cf42ca4e60e5d222
2023-07-15 19:15:38 +02:00

69 lines
1.8 KiB
Nix

{ lib, stdenv
, addOpenGLRunpath
, config
, cudaPackages ? {}
, cudaSupport ? config.cudaSupport or false
, fetchurl
, makeWrapper
, opencl-headers
, ocl-icd
, xxHash
}:
stdenv.mkDerivation rec {
pname = "hashcat";
version = "6.2.6";
src = fetchurl {
url = "https://hashcat.net/files/hashcat-${version}.tar.gz";
sha256 = "sha256-sl4Qd7zzSQjMjxjBppouyYsEeyy88PURRNzzuh4Leyo=";
};
nativeBuildInputs = [
makeWrapper
] ++ lib.optionals cudaSupport [
addOpenGLRunpath
];
buildInputs = [ opencl-headers xxHash ];
makeFlags = [
"PREFIX=${placeholder "out"}"
"COMPTIME=1337"
"VERSION_TAG=${version}"
"USE_SYSTEM_OPENCL=1"
"USE_SYSTEM_XXHASH=1"
];
preFixup = ''
for f in $out/share/hashcat/OpenCL/*.cl; do
# Rewrite files to be included for compilation at runtime for opencl offload
sed "s|#include \"\(.*\)\"|#include \"$out/share/hashcat/OpenCL/\1\"|g" -i "$f"
sed "s|#define COMPARE_\([SM]\) \"\(.*\.cl\)\"|#define COMPARE_\1 \"$out/share/hashcat/OpenCL/\2\"|g" -i "$f"
done
'';
postFixup = let
LD_LIBRARY_PATH = builtins.concatStringsSep ":" ([
"${ocl-icd}/lib"
] ++ lib.optionals cudaSupport [
"${cudaPackages.cudatoolkit}/lib"
]);
in ''
wrapProgram $out/bin/hashcat \
--prefix LD_LIBRARY_PATH : ${lib.escapeShellArg LD_LIBRARY_PATH}
'' + lib.optionalString cudaSupport ''
for program in $out/bin/hashcat $out/bin/.hashcat-wrapped; do
isELF "$program" || continue
addOpenGLRunpath "$program"
done
'';
meta = with lib; {
description = "Fast password cracker";
homepage = "https://hashcat.net/hashcat/";
license = licenses.mit;
platforms = platforms.linux;
maintainers = with maintainers; [ kierdavis zimbatm ];
};
}