1
0
mirror of https://github.com/hashcat/hashcat.git synced 2025-05-09 10:28:48 +00:00

Merge branch 'master' into patch-1

This commit is contained in:
Jens Steube 2025-05-08 08:23:31 +02:00 committed by GitHub
commit 58d9ba4c8b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 75 additions and 47 deletions

View File

@ -41,53 +41,28 @@ on:
- '.github/workflows/build.yml'
jobs:
build-linux:
build:
strategy:
fail-fast: false
matrix:
shared: [0, 1]
name: Build Linux (${{ matrix.shared == 0 && 'Static' || 'Shared' }})
runs-on: ubuntu-latest
include:
- os: ubuntu-latest
os_name: Linux
os_name_lowercase: linux
- os: macos-latest
os_name: MacOS
os_name_lowercase: macos
- os: windows-latest
os_name: Windows
os_name_lowercase: windows
name: Build ${{ matrix.os_name }} (${{ matrix.shared == 0 && 'Static' || 'Shared' }})
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Build
env:
SHARED: ${{ matrix.shared }}
run: make
- name: Generate artifacts
uses: actions/upload-artifact@v3
with:
name: hashcat-linux-${{ matrix.shared == 0 && 'static' || 'shared' }}
path: ${{ env.include_paths }}
- uses: actions/checkout@v4
build-macos:
strategy:
fail-fast: false
matrix:
shared: [0, 1]
name: Build macOS (${{ matrix.shared == 0 && 'Static' || 'Shared' }})
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Build
env:
SHARED: ${{ matrix.shared }}
run: make
- name: Generate artifacts
uses: actions/upload-artifact@v3
with:
name: hashcat-macos-${{ matrix.shared == 0 && 'static' || 'shared' }}
path: ${{ env.include_paths }}
build-windows:
strategy:
fail-fast: false
matrix:
shared: [0, 1]
name: Build Windows (${{ matrix.shared == 0 && 'Static' || 'Shared' }})
runs-on: windows-latest
steps:
- name: Install libiconv
- name: Install dependencies (Windows only)
if: matrix.os_name_lowercase == 'windows'
uses: msys2/setup-msys2@v2
with:
update: true
@ -97,14 +72,22 @@ jobs:
libiconv
libiconv-devel
make
- uses: actions/checkout@v3
- name: Build
if: matrix.os_name_lowercase == 'windows'
shell: msys2 {0}
env:
SHARED: ${{ matrix.shared }}
run: make
- name: Build
if: matrix.os_name_lowercase != 'windows'
env:
SHARED: ${{ matrix.shared }}
run: make
- name: Generate artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: hashcat-windows-${{ matrix.shared == 0 && 'static' || 'shared' }}
name: hashcat-${{ matrix.os_name_lowercase }}-${{ matrix.shared == 0 && 'static' || 'shared' }}
path: ${{ env.include_paths }}

View File

@ -11,6 +11,42 @@
#include "dynloader.h"
char* hiprtcDllPath(char* hipSDKPath)
{
/*
AMD HIP RTC DLLs is stored at "C:\Program Files\ROCm\X.Y\bin\hiprtc0X0Y.dll"
Tried using regex to simplify, but had compilation issues on mingw64 (linker
had troubles with pcre.h)
This function can return complete dll path based on major release version
X.Y parsed from the ENV variable HIP_PATH.
*/
// Identifying major release version X.Y
char* majorVersion = malloc(strlen("X.Y")+1);
memcpy(majorVersion, hipSDKPath + (strlen(hipSDKPath) - 4), 3);
memcpy(majorVersion+0x3, "\0", 1);
// Preparing DLL name "hiprtc0X0Y.dll"
char* hiprtcDllName = malloc(strlen("hiprtcXXXX.dll")+1);
memcpy(hiprtcDllName, "hiprtc0", strlen("hiprtc0"));
memcpy(hiprtcDllName + 0x7, majorVersion, 1);
memcpy(hiprtcDllName + 0x8, "0", 1);
memcpy(hiprtcDllName + 0x9, majorVersion + 2, 1);
memcpy(hiprtcDllName + 0xa, ".dll\0", 5);
// Preparing complete path as "C:\Program Files\ROCm\X.Y\bin\hiprtc0X0Y.dll" to
// return to the caller.
char* hiprtcDllPath = malloc(strlen(hipSDKPath) + strlen("bin/") + strlen("hiprtcXXXX.dll") + 1);
strcpy(hiprtcDllPath, hipSDKPath);
strcat(hiprtcDllPath, "bin\\");
strcat(hiprtcDllPath, hiprtcDllName);
return(hiprtcDllPath);
}
int hiprtc_make_options_array_from_string (char *string, char **options)
{
char *saveptr = NULL;
@ -41,14 +77,23 @@ int hiprtc_init (void *hashcat_ctx)
#if defined (_WIN)
hiprtc->lib = hc_dlopen ("hiprtc.dll");
if (hiprtc->lib == NULL) hiprtc->lib = hc_dlopen ("C:/Program Files/AMD/ROCm/5.5/bin/hiprtc0505.dll");
// Check for HIP SDK installation from ENV
const char* hipSDKPath = getenv("HIP_PATH");
if (hipSDKPath != NULL && hiprtc->lib == NULL)
{
hiprtc->lib = hc_dlopen (hiprtcDllPath(hipSDKPath));
}
if (hiprtc->lib == NULL) hiprtc->lib = hc_dlopen ("amdhip64.dll");
#elif defined (__APPLE__)
hiprtc->lib = hc_dlopen ("fixme.dylib");
#elif defined (__CYGWIN__)
hiprtc->lib = hc_dlopen ("hiprtc.dll");
if (hiprtc->lib == NULL) hiprtc->lib = hc_dlopen ("C:/Program Files/AMD/ROCm/5.5/bin/hiprtc0505.dll");
// Check for HIP SDK installation from ENV
const char* hipSDKPath = getenv("HIP_PATH");
if (hipSDKPath != NULL && hiprtc->lib == NULL)
{
hiprtc->lib = hc_dlopen (hiprtcDllPath(hipSDKPath));
}
if (hiprtc->lib == NULL) hiprtc->lib = hc_dlopen ("amdhip64.dll");
#else
hiprtc->lib = hc_dlopen ("libhiprtc.so");