1
0
mirror of https://github.com/hashcat/hashcat.git synced 2025-05-11 03:18:47 +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' - '.github/workflows/build.yml'
jobs: jobs:
build-linux: build:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
shared: [0, 1] shared: [0, 1]
name: Build Linux (${{ matrix.shared == 0 && 'Static' || 'Shared' }}) include:
runs-on: ubuntu-latest - 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: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- 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 }}
build-macos: - name: Install dependencies (Windows only)
strategy: if: matrix.os_name_lowercase == 'windows'
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
uses: msys2/setup-msys2@v2 uses: msys2/setup-msys2@v2
with: with:
update: true update: true
@ -97,14 +72,22 @@ jobs:
libiconv libiconv
libiconv-devel libiconv-devel
make make
- uses: actions/checkout@v3
- name: Build - name: Build
if: matrix.os_name_lowercase == 'windows'
shell: msys2 {0} shell: msys2 {0}
env: env:
SHARED: ${{ matrix.shared }} SHARED: ${{ matrix.shared }}
run: make run: make
- name: Build
if: matrix.os_name_lowercase != 'windows'
env:
SHARED: ${{ matrix.shared }}
run: make
- name: Generate artifacts - name: Generate artifacts
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v4
with: with:
name: hashcat-windows-${{ matrix.shared == 0 && 'static' || 'shared' }} name: hashcat-${{ matrix.os_name_lowercase }}-${{ matrix.shared == 0 && 'static' || 'shared' }}
path: ${{ env.include_paths }} path: ${{ env.include_paths }}

View File

@ -11,6 +11,42 @@
#include "dynloader.h" #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) int hiprtc_make_options_array_from_string (char *string, char **options)
{ {
char *saveptr = NULL; char *saveptr = NULL;
@ -41,14 +77,23 @@ int hiprtc_init (void *hashcat_ctx)
#if defined (_WIN) #if defined (_WIN)
hiprtc->lib = hc_dlopen ("hiprtc.dll"); 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"); if (hiprtc->lib == NULL) hiprtc->lib = hc_dlopen ("amdhip64.dll");
#elif defined (__APPLE__) #elif defined (__APPLE__)
hiprtc->lib = hc_dlopen ("fixme.dylib"); hiprtc->lib = hc_dlopen ("fixme.dylib");
#elif defined (__CYGWIN__) #elif defined (__CYGWIN__)
hiprtc->lib = hc_dlopen ("hiprtc.dll"); hiprtc->lib = hc_dlopen ("hiprtc.dll");
// Check for HIP SDK installation from ENV
if (hiprtc->lib == NULL) hiprtc->lib = hc_dlopen ("C:/Program Files/AMD/ROCm/5.5/bin/hiprtc0505.dll"); 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"); if (hiprtc->lib == NULL) hiprtc->lib = hc_dlopen ("amdhip64.dll");
#else #else
hiprtc->lib = hc_dlopen ("libhiprtc.so"); hiprtc->lib = hc_dlopen ("libhiprtc.so");