File hashcat.spec of Package hashcat

#
# spec file for package hashcat
#
# Copyright (c) 2025 SUSE LLC and contributors
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%global lname	libhashcat7_1_2

Name:           hashcat
Version:        7.1.2
Release:        2.3
Summary:        CPU-based password recovery utility
License:        GPL-2.0-or-later AND MIT
Group:          Productivity/Security
URL:            https://hashcat.net/
Source:         https://hashcat.net/files/%name-%version.tar.gz
Source2:        https://hashcat.net/files/%name-%version.tar.gz.asc
#  Key ID: 2048R/8A16544F. Fingerprint: A708 3322 9D04 0B41 99CC 0052 3C17 DA8B 8A16 544F
Source3:        %name.keyring
Source9:        %name-rpmlintrc
Patch1:         system-libs.patch
BuildRequires:  dos2unix
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  gmp-devel
BuildRequires:  pkgconfig
BuildRequires:  python3-devel
BuildRequires:  xxhash-devel
%if 0%{?suse_version} >= 1690
BuildRequires:  pkgconfig(lzma-sdk)
%else
%global sylzma USE_SYSTEM_LZMA=0
Provides:       bundled(lzma-sdk) = 24.09
%endif
BuildRequires:  pkgconfig(minizip)
BuildRequires:  pkgconfig(zlib)
ExclusiveArch:  %ix86 x86_64

%description
Hashcat is a password recovery utility, supporting seven
unique modes of testing for over 100 optimized hashing algorithms.

%package -n %lname
Summary:        Implementation of the hashcat engine
Group:          System/Libraries

%description -n %lname
Hashcat is a password recovery utility, supporting seven
unique modes of testing for over 100 optimized hashing algorithms.

%package devel
Summary:        Header files for making hashcat plugins
Group:          Development/Libraries/C and C++
Requires:       %lname = %version

%description devel
Hashcat is a password recovery utility, supporting seven
unique modes of testing for over 100 optimized hashing algorithms.

This subpackage contains the header files.

%prep
%autosetup -p1
find . -name .lock -type f -delete

%build
%global margs DOCUMENT_FOLDER="%_docdir/%name" our_CFLAGS="%optflags" LIBRARY_FOLDER="%_libdir" BUILD_MODE=cross %{?sylzma}
%make_build %margs

%install
%make_install %margs

b="%buildroot"
ln -s libhashcat.so.%version "$b/%_libdir/libhashcat.so"

# fix placement of arch-dep files
mkdir "$b/%_libdir/%name"
mv "$b/%_datadir/%name/modules" "$b/%_libdir/%name/"
ln -s "%_libdir/%name/modules" "$b/%_datadir/%name/"
mv "$b/%_datadir/%name/bridges" "$b/%_libdir/%name/"
ln -s "%_libdir/%name/bridges" "$b/%_datadir/%name/"

# script-without-shebang: add shebang to python scripts
for file in \
  /usr/bin/bitlocker2hashcat.py \
  /usr/bin/keybag2hashcat.py \
  /usr/bin/shiro1-to-hashcat.py \
  /usr/bin/veeamvbk2hashcat.py
do
  sed -i '1i#!/usr/bin/python3' "$b$file"
done

# env-script-interpreter: replace /usr/bin/env <interpreter> with <interpreter>
# perl scripts
find "$b/%_bindir" -type f -name '*.pl' -exec \
  sed -i '1s|^#!\s*/usr/bin/env\s\+\(.*\)$|#!/usr/bin/\1|' {} +
# python scripts
%python3_fix_shebang

# hidden-file-or-dir: remove .gitkeep files
find "$b/%_libdir/%name" -type f -name .gitkeep -delete

# wrong-script-end-of-line-encoding /usr/bin/shiro1-to-hashcat.py
dos2unix "$b/%_bindir/shiro1-to-hashcat.py"

# spurious-executable-perm: remove executable bit from non-executable files
find "$b/%_docdir/%name" -type f -exec chmod -x {} \;

%fdupes %buildroot/%_prefix

%ldconfig_scriptlets -n %lname

%files
%doc README.md
%_bindir/hashcat
%_docdir/%name/
%_libdir/%name/
%_datadir/%name/
# conversion scripts
%_bindir/*2hashcat.*
%_bindir/radmin3_to_hashcat.pl
%_bindir/shiro1-to-hashcat.py

%files -n %lname
%_libdir/libhashcat.so.%version

%files devel
%_includedir/hashcat/
%_libdir/libhashcat.so

%changelog
* Sun Aug 24 2025 Jan Engelhardt <jengelh@inai.de>
- Update to release 7.1.2
  * New algorithms: AS/400 DES, AS/400 SHA1, Cisco-ISE SHA256,
    LUKS2-Argon2i KDF, KeePass KDBX v4, SAP CODVN H SHA512,
    sm3crypt, BLAKE2b-256, MD6, sha224
- Edit system-libs.patch to make use of system-provided lzma-sdk
* Wed Aug 20 2025 Bernhard Wiedemann <bwiedemann@suse.com>
- Use BUILD_MODE=cross to not optimize for build machine CPU (boo#1248352)
* Thu Aug  7 2025 Eyad Issa <eyadlorenzo@gmail.com>
- Use %%global instead of %%define
- Remove python3-devel from recommends
* Wed Aug  6 2025 Eyad Issa <eyadlorenzo@gmail.com>
- Use %%python3_fix_shebang to replace python path with the right
  one
* Tue Aug  5 2025 Eyad Issa <eyadlorenzo@gmail.com>
- Add missing bin files to %%files
- Move bridges files to /usr/lib/hashcat/bridges and symlink
  the old location
- Remove -j1 from make invocation
- Fix rpmlint warnings
- Bump provided bundled(lzma-sdk) to 24.07
- Add python3-devel to BuildRequires to satisfy some modules
  build requirements
* Tue Aug  5 2025 Eyad Issa <eyadlorenzo@gmail.com>
- Shorten %%description
- Add python3-devel to Recommends:
- Update to release 7.0.0
  * Full release notes at
    /usr/share/doc/packages/hashcat/docs/releases_notes_v7.0.0.md
  * Assimilation Bridge: Integrate external resources like CPUs,
    FPGAs, embedded interpreters, and more into the cracking
    pipeline.
  * Python Bridge Plugin: Rapidly implement hash-matching logic in
    Python. No recompilation needed, supports multithreading and
    rule engine by default.
  * Virtual Backend Devices: Internally partitions physical GPUs
    into multiple logical devices for better bridge integration and
    async workloads.
  * Hash-Mode Autodetection: Omit the -m flag and let Hashcat
    detect the hash-mode, or use --identify to list possibilities.
  * 58 new application-specific hash types, including Argon2,
    MetaMask, Microsoft Online Account, SNMPv3, GPG, OpenSSH, and
    LUKS2
  * 17 new generic hash constructions used in real-world web apps
    and protocols
  * 11 new primitives added to the crypto library, improving reuse
    and plugin development
  * 20 new tools to extract hashes from popular sources, including
    APFS, Virtualbox, BitLocker, and various wallet formats
  * Complete refactor of the autotuning engine for better device
    utilization
  * Major rewrite of memory management to eliminate previous 4GB
    allocation caps and enable full memory usage across devices
* Thu Jun  6 2024 Jan Engelhardt <jengelh@inai.de>
- Amend system-libs.patch; system lzma-sdk (24.xx) is too new;
  go back to using bundled lzma-sdk.
* Sun May  7 2023 Andreas Stieger <Andreas.Stieger@gmx.de>
- Update to 6.2.6:
  * many new hash-modes and bug fixes
- add upstream signing key and verify source signature
* Wed Feb 23 2022 Jan Engelhardt <jengelh@inai.de>
- Update to release 6.2.5
  * This release adds improved HIP compatibility, several new
    hash-modes, and bug fixes.
* Sat May 15 2021 Jan Engelhardt <jengelh@inai.de>
- Update to release 6.2.1
  * Build procedure changes allowing not to use unrar
* Fri May 14 2021 Martin Hauke <mardnh@gmx.de>
- Use correct lname
* Fri May 14 2021 Martin Hauke <mardnh@gmx.de>
- Update to version 6.2.0
  * This release is mostly about expanding support for new
    algorithms and fixing bugs.
  * Full changelog: https://hashcat.net/forum/thread-10103.html
* Sun Nov 22 2020 Jan Engelhardt <jengelh@inai.de>
- OpenCL required at runtime [boo#1177190]
* Tue Sep  8 2020 Jan Engelhardt <jengelh@inai.de>
- Update to release 6.1.1
  * new hash-mode plugin interface, new backend API interface,
    new algorithms
- Add system-libs.patch
* Thu Mar 14 2019 Jan Engelhardt <jengelh@inai.de>
- Update license field.
* Wed Feb  6 2019 Jan Engelhardt <jengelh@inai.de>
- Add fdupes call.
- License file was shipped twice, ditch one copy.
* Wed Jan 16 2019 Robert Frohl <rfrohl@suse.com>
- hashcat v5.1.0:
  This release is mostly about expanding support for new algorithms and fixing bugs.
  Full changelog: https://hashcat.net/forum/thread-7983.html
- Remove flags.diff
* Thu Jun 30 2016 jengelh@inai.de
- Update to new upstream release oclhashcat-3.00
- Drop 0001-fixes-issue-10-compiler-warning-for-possible-memory-.patch
  (no longer applicable), add flags.diff.
* Sun Dec  6 2015 jengelh@inai.de
- Initial package for build.opensuse.org (version 2.00)
openSUSE Build Service is sponsored by