1
0
mirror of https://github.com/hashcat/hashcat.git synced 2025-05-21 16:28:52 +00:00

Merge branch 'HIP' into hip

This commit is contained in:
Jens Steube 2021-07-10 21:34:09 +02:00 committed by GitHub
commit a22f8149fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2054 changed files with 200519 additions and 36658 deletions

View File

@ -12,14 +12,16 @@ environment:
CYG_SETUP: setup-x86.exe
BASH: C:\cygwin\bin\bash
CC: gcc
- MSYSTEM: MINGW64
MSYS_CACHE: C:\msys64\var\cache\pacman\pkg
BASH: C:\msys64\usr\bin\bash
CC: gcc
- MSYSTEM: MINGW32
MSYS_CACHE: C:\msys64\var\cache\pacman\pkg
BASH: C:\msys64\usr\bin\bash
CC: gcc
# Disable MINGW test. It seems AppVeyor is no longer supporting MSYS2. Not a hashcat problem.
# See BUILD_MSYS2.md for local test
#- MSYSTEM: MINGW64
# MSYS_CACHE: C:\msys64\var\cache\pacman\pkg
# BASH: C:\msys64\usr\bin\bash
# CC: gcc
#- MSYSTEM: MINGW32
# MSYS_CACHE: C:\msys64\var\cache\pacman\pkg
# BASH: C:\msys64\usr\bin\bash
# CC: gcc
# if we have too many commits at the same time, we might need to download more than just the last commit for appveyor to succeed
# otherwise we get the error: "fatal: reference is not a tree <commit>"
@ -33,15 +35,18 @@ install:
- ps: if (Test-Path Env:\CYG_ROOT) { Start-FileDownload "https://cygwin.com/$env:CYG_SETUP" -FileName "$env:CYG_SETUP" }
- if defined CYG_ROOT (%CYG_SETUP% --quiet-mode --no-shortcuts --only-site --root "%CYG_ROOT%" --site "%CYG_MIRROR%" --local-package-dir "%CYG_CACHE%" --packages "%CYG_PACKAGES%" --upgrade-also)
# (temporary?) problem with msys/pacman/objc/ada (see https://github.com/msys2/msys2/wiki/FAQ)
- if defined MSYSTEM (%BASH% -lc "pacman -Rns --noconfirm mingw-w64-{i686,x86_64}-gcc-ada mingw-w64-{i686,x86_64}-gcc-objc")
- if defined MSYSTEM (%BASH% -lc "pacman -Suuy --noconfirm")
#- if defined MSYSTEM (%BASH% -lc "pacman -Rns --noconfirm mingw-w64-{i686,x86_64}-gcc-ada mingw-w64-{i686,x86_64}-gcc-objc")
# temporary fix for MSYS revoked/new signing keys:
#- if defined MSYSTEM (%BASH% -lc "curl https://pastebin.com/raw/e0y4Ky9U | bash")
#- if defined MSYSTEM (%BASH% -lc "pacman -Suuy --noconfirm")
# the following line is not a duplicate line:
# it is necessary to upgrade the MSYS base files and after that all the packages
# the 2 separate commands/lines are required because a new shell is necessary for each step
- if defined MSYSTEM (%BASH% -lc "pacman -Suuy --noconfirm")
#- if defined MSYSTEM (%BASH% -lc "pacman -Suuy --noconfirm")
#- if defined MSYSTEM (%BASH% -lc "pacman -S --needed --noconfirm git make gcc libiconv-devel")
build_script:
- if defined BASH (%BASH% -lc "cd $(cygpath ${APPVEYOR_BUILD_FOLDER}) && git submodule update --init && make")
- if defined BASH (%BASH% -lc "cd $(cygpath ${APPVEYOR_BUILD_FOLDER}) && make")
test_script:
# some file globbing tests
@ -64,3 +69,4 @@ only_commits:
- include/*
- OpenCL/inc_*
- Makefile
- .appveyor.yml

57
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@ -0,0 +1,57 @@
---
name: Bug report
about: Something is not working as expected
title: ''
labels: bug
assignees: ''
---
**GitHub is for bugs and features - not for support**
For support, please use the hashcat forums https://hashcat.net/forum/
**Check the FAQ**
Some items that might appear to be issues are not issues. Please review the hashcat FAQ https://hashcat.net/wiki/doku.php?id=frequently_asked_questions before submitting a bug report.
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Please provide us with all files required to reproduce the bug locally on our development systems. For instance: hash files, wordlists, rule files, ...
**Expected behavior**
A clear and concise description of what you expected to happen.
**Hardware/Compute device (please complete the following information):**
- Compute device name: [e.g. RTX2080Ti]
- OpenCL/CUDA driver name: [e.g. NVIDIA DRIVER]
- OpenCL/CUDA driver version: [e.g. 465.21]
- OpenCL/CUDA driver source: [e.g. runtime installer/.exe installer]
**Hashcat version (please complete the following information):**
- OS: [e.g. Linux]
- Distribution: [e.g. Ubuntu 18.04]
- Version: [e.g. 6.2.0]
**Diagnostic output compute devices:**
```
For NV: Post nvidia-smi output. This tool also exist on Windows
For AMD ROCm: Post rocm-smi and rocminfo output
```
```
Post clinfo output
```
```
Post hashcat -I output
```
```
On Linux: post lspci output
```
**Additional context**
Add any other context about the problem here. For instance, it was working with hashcat version X.X.X (also please post output from older versions).

View File

@ -0,0 +1,32 @@
---
name: Feature Request - Add new algorithm
about: Add support for new hash-mode (-m)
title: ''
labels: new algorithm
assignees: ''
---
**Is your request based on a publicly known cryptographic schema and where can we find information about?**
For instance:
- The hashing function XY is a public known hash algorithm on Wikipedia.
- The password protection for the application XY was made public by security researcher XY and there's a paper called ...
- The cryptographic schema used in protocol XY can be found in the OSS code on it's GitHub repository.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered. For instance, other standalone crackers which already support this algorithm.
**Provide an example hash/database/file and a known correct password**
The most easy way to produce this is to simply generate a new one using the application itself.
**Explain how the cryptographic schema is implemented**
The best way is with a proof of concept code in any computer language or pseudo code you like.
**Describe the known limitations of the algorithm**
Many applications limit the password and/or salt to a specific minimum and maximum length.
**Where do you typically find the algorithm**
In case you are requesting a cryptographic primitive, name some of the Applications/OS in which it is being used.
**Additional context**
Add any other context or screenshots about the feature request here.

View File

@ -0,0 +1,31 @@
---
name: Feature Request - other
about: Features that are not requests for new algorithms
title: ''
labels: 'new feature'
assignees: ''
---
**GitHub is for bugs and features - not for support**
For support, please use the hashcat forums https://hashcat.net/forum/
**Check the FAQ**
Some items that might appear to be issues are not issues. Please review the hashcat FAQ https://hashcat.net/wiki/doku.php?id=frequently_asked_questions before submitting a bug report.
**Describe the feature**
A clear and concise description of what the feature is.
**Current behavior**
Please give a reproducible example of the current behavior, if possible.
**Expected behavior**
A clear and concise description of what you expected to happen, ideally with mock output.
**Hashcat version (please complete the following information):**
- OS: [e.g. Linux]
- Distribution: [e.g. Ubuntu 18.04]
- Version: [e.g. 6.2.0]
**Additional context**
Add any other context or screenshots about the feature request here.

57
.github/ISSUE_TEMPLATE/other_issue.md vendored Normal file
View File

@ -0,0 +1,57 @@
---
name: Other issue
about: Minor issues that are not bugs or features, but should be addressed
title: ''
labels: 'help wanted'
assignees: ''
---
**GitHub is for bugs and features - not for support**
For support, please use the hashcat forums https://hashcat.net/forum/
**Check the FAQ**
Some items that might appear to be issues are not issues. Please review the hashcat FAQ https://hashcat.net/wiki/doku.php?id=frequently_asked_questions before submitting a bug report.
**Describe the issue**
A clear and concise description of what the issue is.
**To Reproduce**
Please provide us with all files required to reproduce the issue locally on our development systems. For instance: hash files, wordlists, rule files, ...
**Expected behavior**
A clear and concise description of what you expected to happen.
**Hardware/Compute device (please complete the following information):**
- Compute device name: [e.g. RTX2080Ti]
- OpenCL/CUDA driver name: [e.g. NVIDIA DRIVER]
- OpenCL/CUDA driver version: [e.g. 465.21]
- OpenCL/CUDA driver source: [e.g. runtime installer/.exe installer]
**Hashcat version (please complete the following information):**
- OS: [e.g. Linux]
- Distribution: [e.g. Ubuntu 18.04]
- Version: [e.g. 6.2.0]
**Diagnostic output compute devices:**
```
For NV: Post nvidia-smi output. This tool also exist on Windows
For AMD ROCm: Post rocm-smi and rocminfo output
```
```
Post clinfo output
```
```
Post hashcat -I output
```
```
On Linux: post lspci output
```
**Additional context**
Add any other context about the problem here. For instance, it was working with hashcat version X.X.X (also please post output from older versions).

View File

@ -31,8 +31,35 @@ The install target is linux FHS compatible and can be used like this:
$ make install
```
If you install it, cached kernels, session files, restore- and pot-files etc. will go to $HOME/.hashcat/
If the $HOME/.hashcat folder exists, then:
- Session related files go to: $HOME/.hashcat/sessions/
- Cached kernels go to: $HOME/.hashcat/kernels/
- Potfiles go to: $HOME/.hashcat/
Otherwise, if environment variable XDG_DATA_HOME and XDG_CACHE_HOME exists, then:
- Session related files go to: $XDG_DATA_HOME/hashcat/sessions/
- Cached kernels go to: $XDG_CACHE_HOME/hashcat/kernels/
- Potfiles go to: $XDG_DATA_HOME/hashcat/
Otherwise, if environment variable XDG_DATA_HOME exists, then:
- Session related files go to: $XDG_DATA_HOME/hashcat/sessions/
- Cached kernels go to: $HOME/.cache/hashcat
- Potfiles go to: $XDG_DATA_HOME/hashcat/
Otherwise, if environment variable XDG_CACHE_HOME exists, then:
- Session related files go to: $HOME/.local/share/hashcat/sessions/
- Cached kernels go to: $XDG_CACHE_HOME/hashcat/kernels/
- Potfiles go to: $HOME/.local/share/hashcat/
Otherwise:
- Session related files go to: $HOME/.local/share/hashcat/sessions/
- Cached kernels go to: $HOME/.cache/hashcat
- Potfiles go to: $HOME/.local/share/hashcat/
### Building hashcat for Windows (using Windows Subsystem for Linux) ###

View File

@ -1,6 +1,6 @@
# Compiling hashcat with Cygwin.
Tested on a Windows 7 SP1 x64 machine.
Tested on a Windows 10 20H2 x64 machine.
### Installation ###
@ -11,6 +11,7 @@ Make sure to install additional dependencies necessary for hashcat compilation b
```
libiconv-devel
gcc-core
gcc-g++
make
git
```

View File

@ -1,6 +1,6 @@
# Compiling hashcat with msys2.
Tested on a Windows 7 SP1 x64 machine.
Tested on a Windows 10 20H2 x64 machine.
### Installation ###

View File

@ -2,13 +2,17 @@
Tested on Windows 10 x64, should also work to build hashcat for Windows on Linux.
I had it tested with WSL2 using Ubuntu_2004.2020.424.0_x64.appx.
Make sure to have the system upgraded after install (otherwise it will fail to find the gcc-mingw-w64-x86-64 package).
### Installation ###
Enable WSL.
Press the win + r key on your keyboard simultaneously and in the "Run" popup window type bash and make sure to install additional dependencies necessary for hashcat compilation
```
sudo apt install gcc-mingw-w64-x86-64 make git
sudo apt install gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 make git
git clone https://github.com/hashcat/hashcat
git clone https://github.com/win-iconv/win-iconv
cd win-iconv/
@ -33,4 +37,4 @@ cd "C:\Users\user\hashcat"
and start hashcat by typing
```
hashcat.exe
```
```

View File

@ -0,0 +1,304 @@
/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
#include "inc_vendor.h"
#include "inc_types.h"
#include "inc_platform.h"
#include "inc_common.h"
#include "inc_cipher_aes.h"
#include "inc_cipher_aes-gcm.h"
DECLSPEC void AES_GCM_inc32 (u32 *block)
{
block[3] += 1;
}
DECLSPEC void AES_GCM_xor_block (u32 *dst, const u32 *src)
{
dst[0] ^= src[0];
dst[1] ^= src[1];
dst[2] ^= src[2];
dst[3] ^= src[3];
}
DECLSPEC void AES_GCM_gf_mult (const u32 *x, const u32 *y, u32 *z)
{
z[0] = 0;
z[1] = 0;
z[2] = 0;
z[3] = 0;
u32 t[4];
t[0] = y[0];
t[1] = y[1];
t[2] = y[2];
t[3] = y[3];
for (int i = 0; i < 4; i++)
{
const u32 tv = x[i];
for (int j = 0; j < 32; j++)
{
if ((tv >> (31 - j)) & 1)
{
z[0] ^= t[0];
z[1] ^= t[1];
z[2] ^= t[2];
z[3] ^= t[3];
}
const int m = t[3] & 1; // save lost bit
t[3] = (t[2] << 31) | (t[3] >> 1);
t[2] = (t[1] << 31) | (t[2] >> 1);
t[1] = (t[0] << 31) | (t[1] >> 1);
t[0] = 0 | (t[0] >> 1);
t[0] ^= m * 0xe1000000;
}
}
}
DECLSPEC void AES_GCM_ghash (const u32 *subkey, const u32 *in, int in_len, u32 *out)
{
int i;
int j;
for (i = 0, j = 0; i < in_len - 15; i += 16, j += 4)
{
u32 t2[4];
t2[0] = in[j + 0];
t2[1] = in[j + 1];
t2[2] = in[j + 2];
t2[3] = in[j + 3];
AES_GCM_xor_block (out, t2);
u32 tmp[4];
AES_GCM_gf_mult (out, subkey, tmp);
out[0] = tmp[0];
out[1] = tmp[1];
out[2] = tmp[2];
out[3] = tmp[3];
}
const int left = in_len - i;
if (left > 0)
{
u32 t2[4];
t2[0] = (left > 0) ? in[j + 0] : 0;
t2[1] = (left > 4) ? in[j + 1] : 0;
t2[2] = (left > 8) ? in[j + 2] : 0;
t2[3] = (left > 12) ? in[j + 3] : 0;
AES_GCM_xor_block (out, t2);
u32 tmp[4];
AES_GCM_gf_mult (out, subkey, tmp);
out[0] = tmp[0];
out[1] = tmp[1];
out[2] = tmp[2];
out[3] = tmp[3];
}
}
DECLSPEC void AES_GCM_ghash_global (const u32 *subkey, GLOBAL_AS const u32 *in, int in_len, u32 *out)
{
int i;
int j;
for (i = 0, j = 0; i < in_len - 15; i += 16, j += 4)
{
u32 t2[4];
t2[0] = in[j + 0];
t2[1] = in[j + 1];
t2[2] = in[j + 2];
t2[3] = in[j + 3];
AES_GCM_xor_block (out, t2);
u32 tmp[4];
AES_GCM_gf_mult (out, subkey, tmp);
out[0] = tmp[0];
out[1] = tmp[1];
out[2] = tmp[2];
out[3] = tmp[3];
}
const int left = in_len - i;
if (left > 0)
{
u32 t2[4];
t2[0] = (left > 0) ? in[j + 0] : 0;
t2[1] = (left > 4) ? in[j + 1] : 0;
t2[2] = (left > 8) ? in[j + 2] : 0;
t2[3] = (left > 12) ? in[j + 3] : 0;
AES_GCM_xor_block (out, t2);
u32 tmp[4];
AES_GCM_gf_mult (out, subkey, tmp);
out[0] = tmp[0];
out[1] = tmp[1];
out[2] = tmp[2];
out[3] = tmp[3];
}
}
DECLSPEC void AES_GCM_Init (const u32 *ukey, int key_len, u32 *key, u32 *subkey, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4)
{
if (key_len == 128)
{
AES128_set_encrypt_key (key, ukey, s_te0, s_te1, s_te2, s_te3);
AES192_encrypt (key, subkey, subkey, s_te0, s_te1, s_te2, s_te3, s_te4);
}
else if (key_len == 192)
{
AES192_set_encrypt_key (key, ukey, s_te0, s_te1, s_te2, s_te3);
AES192_encrypt (key, subkey, subkey, s_te0, s_te1, s_te2, s_te3, s_te4);
}
else if (key_len == 256)
{
AES256_set_encrypt_key (key, ukey, s_te0, s_te1, s_te2, s_te3);
AES256_encrypt (key, subkey, subkey, s_te0, s_te1, s_te2, s_te3, s_te4);
}
}
DECLSPEC void AES_GCM_Prepare_J0 (const u32 *iv, int iv_len, const u32 *subkey, u32 *J0)
{
if (iv_len == 12)
{
J0[0] = iv[0];
J0[1] = iv[1];
J0[2] = iv[2];
J0[3] = 0x00000001;
}
else
{
AES_GCM_ghash (subkey, iv, iv_len, J0);
u32 len_buf[4] = { 0 };
len_buf[3] = iv_len * 8;
AES_GCM_ghash (subkey, len_buf, 16, J0);
}
}
DECLSPEC void AES_GCM_gctr (const u32 *key, const u32 *iv, const u32 *in, int in_len, u32 *out, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4)
{
const u32 *xpos = in;
u32 *ypos = out;
u32 iv_buf[4];
iv_buf[0] = iv[0];
iv_buf[1] = iv[1];
iv_buf[2] = iv[2];
iv_buf[3] = iv[3];
const u32 n = in_len / 16;
for (u32 i = 0; i < n; i++)
{
AES256_encrypt (key, iv_buf, ypos, s_te0, s_te1, s_te2, s_te3, s_te4);
AES_GCM_xor_block (ypos, xpos);
xpos += 4;
ypos += 4;
AES_GCM_inc32 (iv_buf);
}
// this is not byte accurate but 4-byte accurate. needs fix?
int last = in + (in_len/4) - xpos;
if (last)
{
u32 tmp[4] = { 0 };
AES256_encrypt (key, iv_buf, tmp, s_te0, s_te1, s_te2, s_te3, s_te4);
if (last >= 1) *ypos++ = *xpos++ ^ tmp[0];
if (last >= 2) *ypos++ = *xpos++ ^ tmp[1];
if (last >= 3) *ypos++ = *xpos++ ^ tmp[2];
}
}
DECLSPEC void AES_GCM_GCTR (u32 *key, u32 *J0, const u32 *in, int in_len, u32 *out, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4)
{
u32 J0_incr[4];
J0_incr[0] = J0[0];
J0_incr[1] = J0[1];
J0_incr[2] = J0[2];
J0_incr[3] = J0[3];
AES_GCM_gctr (key, J0_incr, in, in_len, out, s_te0, s_te1, s_te2, s_te3, s_te4);
}
DECLSPEC void AES_GCM_GHASH (const u32 *subkey, const u32 *aad_buf, int aad_len, const u32 *enc_buf, int enc_len, u32 *out)
{
out[0] = 0;
out[1] = 0;
out[2] = 0;
out[3] = 0;
AES_GCM_ghash (subkey, aad_buf, aad_len, out);
AES_GCM_ghash (subkey, enc_buf, enc_len, out);
u32 len_buf[4];
len_buf[0] = aad_len * 8;
len_buf[1] = 0;
len_buf[2] = 0;
len_buf[3] = enc_len * 8;
AES_GCM_ghash (subkey, len_buf, 16, out);
}
DECLSPEC void AES_GCM_GHASH_GLOBAL (const u32 *subkey, const u32 *aad_buf, int aad_len, GLOBAL_AS const u32 *enc_buf, int enc_len, u32 *out)
{
out[0] = 0;
out[1] = 0;
out[2] = 0;
out[3] = 0;
AES_GCM_ghash (subkey, aad_buf, aad_len, out);
AES_GCM_ghash_global (subkey, enc_buf, enc_len, out);
u32 len_buf[4];
len_buf[0] = aad_len * 8;
len_buf[1] = 0;
len_buf[2] = 0;
len_buf[3] = enc_len * 8;
AES_GCM_ghash (subkey, len_buf, 16, out);
}

View File

@ -0,0 +1,21 @@
/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
#ifndef _INC_CIPHER_AES_GCM_H
#define _INC_CIPHER_AES_GCM_H
DECLSPEC void AES_GCM_inc32 (u32 *block);
DECLSPEC void AES_GCM_xor_block (u32 *dst, const u32 *src);
DECLSPEC void AES_GCM_gf_mult (const u32 *x, const u32 *y, u32 *z);
DECLSPEC void AES_GCM_ghash (const u32 *subkey, const u32 *in, int in_len, u32 *out);
DECLSPEC void AES_GCM_ghash_global (const u32 *subkey, GLOBAL_AS const u32 *in, int in_len, u32 *out);
DECLSPEC void AES_GCM_Init (const u32 *ukey, int key_len, u32 *key, u32 *subkey, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4);
DECLSPEC void AES_GCM_Prepare_J0 (const u32 *iv, int iv_len, const u32 *subkey, u32 *J0);
DECLSPEC void AES_GCM_gctr (const u32 *key, const u32 *iv, const u32 *in, int in_len, u32 *out, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4);
DECLSPEC void AES_GCM_GCTR (u32 *key, u32 *J0, const u32 *in, int in_len, u32 *out, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4);
DECLSPEC void AES_GCM_GHASH (const u32 *subkey, const u32 *aad_buf, int aad_len, const u32 *enc_buf, int enc_len, u32 *out);
DECLSPEC void AES_GCM_GHASH_GLOBAL (const u32 *subkey, const u32 *aad_buf, int aad_len, GLOBAL_AS const u32 *enc_buf, int enc_len, u32 *out);
#endif // _INC_CIPHER_AES_GCM_H

335
OpenCL/inc_cipher_rc4.cl Normal file
View File

@ -0,0 +1,335 @@
#include "inc_vendor.h"
#include "inc_types.h"
#include "inc_platform.h"
#include "inc_common.h"
#include "inc_cipher_rc4.h"
#ifdef IS_CPU
// Pattern linear
DECLSPEC u8 GET_KEY8 (LOCAL_AS u32 *S, const u8 k)
{
LOCAL_AS u8 *S8 = (LOCAL_AS u8 *) S;
return S8[k];
}
DECLSPEC void SET_KEY8 (LOCAL_AS u32 *S, const u8 k, const u8 v)
{
LOCAL_AS u8 *S8 = (LOCAL_AS u8 *) S;
S8[k] = v;
}
DECLSPEC void SET_KEY32 (LOCAL_AS u32 *S, const u8 k, const u32 v)
{
S[k] = v;
}
#else
// The goal of this pattern is to have the minimum shared memory bank conflicts as possible.
// Bank conflicts force the device to serialize the bank access and this results in performance drops.
//
// Good to know:
// NV and AMD GPU both have exactly 32 shared memory banks (at least on all modern GPU).
// These banks can't be addressed directly, but indirectly.
// Each of the 32 banks add some space to the total LOCAL buffer.
// But this space is not simply appended, but in chunks of 4 bytes:
// Bank 0 provides bytes 0..3, Bank 1 provides bytes 4..7, Bank 2 provides 8..11, and so on..
//
// We design the memory structure that each thread ID aligns with the corresponding bank ID.
// If a thread always access the same bank, then there are no bank conflicts and we reach our goal.
//
// Since we have 32 banks, we ideally operate on 32 threads.
// For NV GPU this aligns perfectly, because native threads = 32.
// For AMD GPU it does not, because native threads = 64. But we can reduce it to only 1 bank conflict per thread.
//
// The size for the S[] buffer for each thread is 256 byte, basically just the RC4 sbox.
// We want to assign 1 thread to 1 bank, so for 32 banks the total size is 8192 bytes (256 * 32 = 8192):
// LOCAL_VK u32 S[64 * FIXED_LOCAL_SIZE];
// Note that sizeof (u32) * 64 = 256 and then multiplied with the thread count.
//
// Addressing:
//
// This is the first major offset and is relevant for thread ID >= 32 (AMD or non-native thread count on NV):
// (t / 32) * 8192
// The first 8192 bytes of S[] are accessed from threads 0..31 and the next 8192 bytes from threads 32..63
// We could also use more than 64 threads but we need to make sure it's a multiple of 32.
//
// Inside this window of 8192 bytes we select the bank id from the thread id:
// (t & 31) * 4
// We need to do the * 4 because of the 4 byte chunks (see top)
//
// Because of the indirect bank ID addressing we can't write from left to right, we write from top to bottom.
// To ensure each thread stays to its assigned bank id from the previous calculation we could simply do k * 128,
// because 128 = 4 (bank chunk size) * 32 (banks).
//
// However, it's not that easy. We need to find a way to enforce a chunk size of 4.
// (k / 4) * 128
//
// Finally we can select the actual target byte from (1 out of 4) from this chunk:
// (k & 3)
#define KEY8(t,k) (((k) & 3) + (((k) / 4) * 128) + (((t) & 31) * 4) + (((t) / 32) * 8192))
DECLSPEC u8 GET_KEY8 (LOCAL_AS u32 *S, const u8 k)
{
const u64 lid = get_local_id (0);
LOCAL_AS u8 *S8 = (LOCAL_AS u8 *) S;
return S8[KEY8 (lid, k)];
}
DECLSPEC void SET_KEY8 (LOCAL_AS u32 *S, const u8 k, const u8 v)
{
const u64 lid = get_local_id (0);
LOCAL_AS u8 *S8 = (LOCAL_AS u8 *) S;
S8[KEY8 (lid, k)] = v;
}
#define KEY32(t,k) (((k) * 32) + ((t) & 31) + (((t) / 32) * 2048))
DECLSPEC void SET_KEY32 (LOCAL_AS u32 *S, const u8 k, const u32 v)
{
const u64 lid = get_local_id (0);
S[KEY32 (lid, k)] = v;
}
#undef KEY8
#undef KEY32
#endif
DECLSPEC void rc4_init_40 (LOCAL_AS u32 *S, const u32 *key)
{
u32 v = 0x03020100;
u32 a = 0x04040404;
#ifdef _unroll
#pragma unroll
#endif
for (u8 i = 0; i < 64; i++)
{
SET_KEY32 (S, i, v); v += a;
}
const u8 d0 = v8a_from_v32_S (key[0]);
const u8 d1 = v8b_from_v32_S (key[0]);
const u8 d2 = v8c_from_v32_S (key[0]);
const u8 d3 = v8d_from_v32_S (key[0]);
const u8 d4 = v8a_from_v32_S (key[1]);
u8 j = 0;
#ifdef _unroll
#pragma unroll
#endif
for (u32 i = 0; i < 255; i += 5)
{
j += GET_KEY8 (S, i + 0) + d0; rc4_swap (S, i + 0, j);
j += GET_KEY8 (S, i + 1) + d1; rc4_swap (S, i + 1, j);
j += GET_KEY8 (S, i + 2) + d2; rc4_swap (S, i + 2, j);
j += GET_KEY8 (S, i + 3) + d3; rc4_swap (S, i + 3, j);
j += GET_KEY8 (S, i + 4) + d4; rc4_swap (S, i + 4, j);
}
j += GET_KEY8 (S, 255) + d0; rc4_swap (S, 255, j);
}
DECLSPEC void rc4_init_128 (LOCAL_AS u32 *S, const u32 *key)
{
u32 v = 0x03020100;
u32 a = 0x04040404;
#ifdef _unroll
#pragma unroll
#endif
for (u8 i = 0; i < 64; i++)
{
SET_KEY32 (S, i, v); v += a;
}
u8 j = 0;
for (u32 i = 0; i < 16; i++)
{
u8 idx = i * 16;
u32 v;
v = key[0];
j += GET_KEY8 (S, idx) + v8a_from_v32_S (v); rc4_swap (S, idx, j); idx++;
j += GET_KEY8 (S, idx) + v8b_from_v32_S (v); rc4_swap (S, idx, j); idx++;
j += GET_KEY8 (S, idx) + v8c_from_v32_S (v); rc4_swap (S, idx, j); idx++;
j += GET_KEY8 (S, idx) + v8d_from_v32_S (v); rc4_swap (S, idx, j); idx++;
v = key[1];
j += GET_KEY8 (S, idx) + v8a_from_v32_S (v); rc4_swap (S, idx, j); idx++;
j += GET_KEY8 (S, idx) + v8b_from_v32_S (v); rc4_swap (S, idx, j); idx++;
j += GET_KEY8 (S, idx) + v8c_from_v32_S (v); rc4_swap (S, idx, j); idx++;
j += GET_KEY8 (S, idx) + v8d_from_v32_S (v); rc4_swap (S, idx, j); idx++;
v = key[2];
j += GET_KEY8 (S, idx) + v8a_from_v32_S (v); rc4_swap (S, idx, j); idx++;
j += GET_KEY8 (S, idx) + v8b_from_v32_S (v); rc4_swap (S, idx, j); idx++;
j += GET_KEY8 (S, idx) + v8c_from_v32_S (v); rc4_swap (S, idx, j); idx++;
j += GET_KEY8 (S, idx) + v8d_from_v32_S (v); rc4_swap (S, idx, j); idx++;
v = key[3];
j += GET_KEY8 (S, idx) + v8a_from_v32_S (v); rc4_swap (S, idx, j); idx++;
j += GET_KEY8 (S, idx) + v8b_from_v32_S (v); rc4_swap (S, idx, j); idx++;
j += GET_KEY8 (S, idx) + v8c_from_v32_S (v); rc4_swap (S, idx, j); idx++;
j += GET_KEY8 (S, idx) + v8d_from_v32_S (v); rc4_swap (S, idx, j); idx++;
}
}
DECLSPEC void rc4_swap (LOCAL_AS u32 *S, const u8 i, const u8 j)
{
u8 tmp;
tmp = GET_KEY8 (S, i);
SET_KEY8 (S, i, GET_KEY8 (S, j));
SET_KEY8 (S, j, tmp);
}
DECLSPEC u8 rc4_next_16 (LOCAL_AS u32 *S, const u8 i, const u8 j, const u32 *in, u32 *out)
{
u8 a = i;
u8 b = j;
#ifdef _unroll
#pragma unroll
#endif
for (int k = 0; k < 4; k++)
{
u32 xor4 = 0;
u32 tmp;
u8 idx;
a += 1;
b += GET_KEY8 (S, a);
rc4_swap (S, a, b);
idx = GET_KEY8 (S, a) + GET_KEY8 (S, b);
tmp = GET_KEY8 (S, idx);
xor4 |= tmp << 0;
a += 1;
b += GET_KEY8 (S, a);
rc4_swap (S, a, b);
idx = GET_KEY8 (S, a) + GET_KEY8 (S, b);
tmp = GET_KEY8 (S, idx);
xor4 |= tmp << 8;
a += 1;
b += GET_KEY8 (S, a);
rc4_swap (S, a, b);
idx = GET_KEY8 (S, a) + GET_KEY8 (S, b);
tmp = GET_KEY8 (S, idx);
xor4 |= tmp << 16;
a += 1;
b += GET_KEY8 (S, a);
rc4_swap (S, a, b);
idx = GET_KEY8 (S, a) + GET_KEY8 (S, b);
tmp = GET_KEY8 (S, idx);
xor4 |= tmp << 24;
out[k] = in[k] ^ xor4;
}
return b;
}
DECLSPEC u8 rc4_next_16_global (LOCAL_AS u32 *S, const u8 i, const u8 j, GLOBAL_AS const u32 *in, u32 *out)
{
u8 a = i;
u8 b = j;
#ifdef _unroll
#pragma unroll
#endif
for (int k = 0; k < 4; k++)
{
u32 xor4 = 0;
u32 tmp;
u8 idx;
a += 1;
b += GET_KEY8 (S, a);
rc4_swap (S, a, b);
idx = GET_KEY8 (S, a) + GET_KEY8 (S, b);
tmp = GET_KEY8 (S, idx);
xor4 |= tmp << 0;
a += 1;
b += GET_KEY8 (S, a);
rc4_swap (S, a, b);
idx = GET_KEY8 (S, a) + GET_KEY8 (S, b);
tmp = GET_KEY8 (S, idx);
xor4 |= tmp << 8;
a += 1;
b += GET_KEY8 (S, a);
rc4_swap (S, a, b);
idx = GET_KEY8 (S, a) + GET_KEY8 (S, b);
tmp = GET_KEY8 (S, idx);
xor4 |= tmp << 16;
a += 1;
b += GET_KEY8 (S, a);
rc4_swap (S, a, b);
idx = GET_KEY8 (S, a) + GET_KEY8 (S, b);
tmp = GET_KEY8 (S, idx);
xor4 |= tmp << 24;
out[k] = in[k] ^ xor4;
}
return b;
}

19
OpenCL/inc_cipher_rc4.h Normal file
View File

@ -0,0 +1,19 @@
/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
#ifndef _INC_CIPHER_RC4_H
#define _INC_CIPHER_RC4_H
DECLSPEC u8 GET_KEY8 (LOCAL_AS u32 *S, const u8 k);
DECLSPEC void SET_KEY8 (LOCAL_AS u32 *S, const u8 k, const u8 v);
DECLSPEC void SET_KEY32 (LOCAL_AS u32 *S, const u8 k, const u32 v);
DECLSPEC void rc4_init_40 (LOCAL_AS u32 *S, const u32 *key);
DECLSPEC void rc4_init_128 (LOCAL_AS u32 *S, const u32 *key);
DECLSPEC void rc4_swap (LOCAL_AS u32 *S, const u8 i, const u8 j);
DECLSPEC u8 rc4_next_16 (LOCAL_AS u32 *S, const u8 i, const u8 j, const u32 *in, u32 *out);
DECLSPEC u8 rc4_next_16_global (LOCAL_AS u32 *S, const u8 i, const u8 j, GLOBAL_AS const u32 *in, u32 *out);
#endif // _INC_CIPHER_RC4_H

View File

@ -15,6 +15,7 @@
/* -------------------------------------------------------------------- */
/* */
/* Cleaned and optimized for GPU use with hashcat by Jens Steube */
/* Added 192-bit functions by Gabriele Gristina */
#include "inc_vendor.h"
#include "inc_types.h"
@ -690,6 +691,289 @@ DECLSPEC void serpent128_decrypt (const u32 *ks, const u32 *in, u32 *out)
out[3] = d;
}
// 192 bit key
DECLSPEC void serpent192_set_key (u32 *ks, const u32 *ukey)
{
ks[ 0] = ukey[0];
ks[ 1] = ukey[1];
ks[ 2] = ukey[2];
ks[ 3] = ukey[3];
ks[ 4] = ukey[4];
ks[ 5] = ukey[5];
ks[ 6] = 1;
ks[ 7] = 0;
ks[ 8] = hc_rotl32_S ((ks[ 7] ^ ks[ 5] ^ ks[ 3] ^ ks[ 0] ^ 0x9e3779b9 ^ 0), 11);
ks[ 9] = hc_rotl32_S ((ks[ 8] ^ ks[ 6] ^ ks[ 4] ^ ks[ 1] ^ 0x9e3779b9 ^ 1), 11);
ks[ 10] = hc_rotl32_S ((ks[ 9] ^ ks[ 7] ^ ks[ 5] ^ ks[ 2] ^ 0x9e3779b9 ^ 2), 11);
ks[ 11] = hc_rotl32_S ((ks[ 10] ^ ks[ 8] ^ ks[ 6] ^ ks[ 3] ^ 0x9e3779b9 ^ 3), 11);
ks[ 12] = hc_rotl32_S ((ks[ 11] ^ ks[ 9] ^ ks[ 7] ^ ks[ 4] ^ 0x9e3779b9 ^ 4), 11);
ks[ 13] = hc_rotl32_S ((ks[ 12] ^ ks[ 10] ^ ks[ 8] ^ ks[ 5] ^ 0x9e3779b9 ^ 5), 11);
ks[ 14] = hc_rotl32_S ((ks[ 13] ^ ks[ 11] ^ ks[ 9] ^ ks[ 6] ^ 0x9e3779b9 ^ 6), 11);
ks[ 15] = hc_rotl32_S ((ks[ 14] ^ ks[ 12] ^ ks[ 10] ^ ks[ 7] ^ 0x9e3779b9 ^ 7), 11);
ks[ 16] = hc_rotl32_S ((ks[ 15] ^ ks[ 13] ^ ks[ 11] ^ ks[ 8] ^ 0x9e3779b9 ^ 8), 11);
ks[ 17] = hc_rotl32_S ((ks[ 16] ^ ks[ 14] ^ ks[ 12] ^ ks[ 9] ^ 0x9e3779b9 ^ 9), 11);
ks[ 18] = hc_rotl32_S ((ks[ 17] ^ ks[ 15] ^ ks[ 13] ^ ks[ 10] ^ 0x9e3779b9 ^ 10), 11);
ks[ 19] = hc_rotl32_S ((ks[ 18] ^ ks[ 16] ^ ks[ 14] ^ ks[ 11] ^ 0x9e3779b9 ^ 11), 11);
ks[ 20] = hc_rotl32_S ((ks[ 19] ^ ks[ 17] ^ ks[ 15] ^ ks[ 12] ^ 0x9e3779b9 ^ 12), 11);
ks[ 21] = hc_rotl32_S ((ks[ 20] ^ ks[ 18] ^ ks[ 16] ^ ks[ 13] ^ 0x9e3779b9 ^ 13), 11);
ks[ 22] = hc_rotl32_S ((ks[ 21] ^ ks[ 19] ^ ks[ 17] ^ ks[ 14] ^ 0x9e3779b9 ^ 14), 11);
ks[ 23] = hc_rotl32_S ((ks[ 22] ^ ks[ 20] ^ ks[ 18] ^ ks[ 15] ^ 0x9e3779b9 ^ 15), 11);
ks[ 24] = hc_rotl32_S ((ks[ 23] ^ ks[ 21] ^ ks[ 19] ^ ks[ 16] ^ 0x9e3779b9 ^ 16), 11);
ks[ 25] = hc_rotl32_S ((ks[ 24] ^ ks[ 22] ^ ks[ 20] ^ ks[ 17] ^ 0x9e3779b9 ^ 17), 11);
ks[ 26] = hc_rotl32_S ((ks[ 25] ^ ks[ 23] ^ ks[ 21] ^ ks[ 18] ^ 0x9e3779b9 ^ 18), 11);
ks[ 27] = hc_rotl32_S ((ks[ 26] ^ ks[ 24] ^ ks[ 22] ^ ks[ 19] ^ 0x9e3779b9 ^ 19), 11);
ks[ 28] = hc_rotl32_S ((ks[ 27] ^ ks[ 25] ^ ks[ 23] ^ ks[ 20] ^ 0x9e3779b9 ^ 20), 11);
ks[ 29] = hc_rotl32_S ((ks[ 28] ^ ks[ 26] ^ ks[ 24] ^ ks[ 21] ^ 0x9e3779b9 ^ 21), 11);
ks[ 30] = hc_rotl32_S ((ks[ 29] ^ ks[ 27] ^ ks[ 25] ^ ks[ 22] ^ 0x9e3779b9 ^ 22), 11);
ks[ 31] = hc_rotl32_S ((ks[ 30] ^ ks[ 28] ^ ks[ 26] ^ ks[ 23] ^ 0x9e3779b9 ^ 23), 11);
ks[ 32] = hc_rotl32_S ((ks[ 31] ^ ks[ 29] ^ ks[ 27] ^ ks[ 24] ^ 0x9e3779b9 ^ 24), 11);
ks[ 33] = hc_rotl32_S ((ks[ 32] ^ ks[ 30] ^ ks[ 28] ^ ks[ 25] ^ 0x9e3779b9 ^ 25), 11);
ks[ 34] = hc_rotl32_S ((ks[ 33] ^ ks[ 31] ^ ks[ 29] ^ ks[ 26] ^ 0x9e3779b9 ^ 26), 11);
ks[ 35] = hc_rotl32_S ((ks[ 34] ^ ks[ 32] ^ ks[ 30] ^ ks[ 27] ^ 0x9e3779b9 ^ 27), 11);
ks[ 36] = hc_rotl32_S ((ks[ 35] ^ ks[ 33] ^ ks[ 31] ^ ks[ 28] ^ 0x9e3779b9 ^ 28), 11);
ks[ 37] = hc_rotl32_S ((ks[ 36] ^ ks[ 34] ^ ks[ 32] ^ ks[ 29] ^ 0x9e3779b9 ^ 29), 11);
ks[ 38] = hc_rotl32_S ((ks[ 37] ^ ks[ 35] ^ ks[ 33] ^ ks[ 30] ^ 0x9e3779b9 ^ 30), 11);
ks[ 39] = hc_rotl32_S ((ks[ 38] ^ ks[ 36] ^ ks[ 34] ^ ks[ 31] ^ 0x9e3779b9 ^ 31), 11);
ks[ 40] = hc_rotl32_S ((ks[ 39] ^ ks[ 37] ^ ks[ 35] ^ ks[ 32] ^ 0x9e3779b9 ^ 32), 11);
ks[ 41] = hc_rotl32_S ((ks[ 40] ^ ks[ 38] ^ ks[ 36] ^ ks[ 33] ^ 0x9e3779b9 ^ 33), 11);
ks[ 42] = hc_rotl32_S ((ks[ 41] ^ ks[ 39] ^ ks[ 37] ^ ks[ 34] ^ 0x9e3779b9 ^ 34), 11);
ks[ 43] = hc_rotl32_S ((ks[ 42] ^ ks[ 40] ^ ks[ 38] ^ ks[ 35] ^ 0x9e3779b9 ^ 35), 11);
ks[ 44] = hc_rotl32_S ((ks[ 43] ^ ks[ 41] ^ ks[ 39] ^ ks[ 36] ^ 0x9e3779b9 ^ 36), 11);
ks[ 45] = hc_rotl32_S ((ks[ 44] ^ ks[ 42] ^ ks[ 40] ^ ks[ 37] ^ 0x9e3779b9 ^ 37), 11);
ks[ 46] = hc_rotl32_S ((ks[ 45] ^ ks[ 43] ^ ks[ 41] ^ ks[ 38] ^ 0x9e3779b9 ^ 38), 11);
ks[ 47] = hc_rotl32_S ((ks[ 46] ^ ks[ 44] ^ ks[ 42] ^ ks[ 39] ^ 0x9e3779b9 ^ 39), 11);
ks[ 48] = hc_rotl32_S ((ks[ 47] ^ ks[ 45] ^ ks[ 43] ^ ks[ 40] ^ 0x9e3779b9 ^ 40), 11);
ks[ 49] = hc_rotl32_S ((ks[ 48] ^ ks[ 46] ^ ks[ 44] ^ ks[ 41] ^ 0x9e3779b9 ^ 41), 11);
ks[ 50] = hc_rotl32_S ((ks[ 49] ^ ks[ 47] ^ ks[ 45] ^ ks[ 42] ^ 0x9e3779b9 ^ 42), 11);
ks[ 51] = hc_rotl32_S ((ks[ 50] ^ ks[ 48] ^ ks[ 46] ^ ks[ 43] ^ 0x9e3779b9 ^ 43), 11);
ks[ 52] = hc_rotl32_S ((ks[ 51] ^ ks[ 49] ^ ks[ 47] ^ ks[ 44] ^ 0x9e3779b9 ^ 44), 11);
ks[ 53] = hc_rotl32_S ((ks[ 52] ^ ks[ 50] ^ ks[ 48] ^ ks[ 45] ^ 0x9e3779b9 ^ 45), 11);
ks[ 54] = hc_rotl32_S ((ks[ 53] ^ ks[ 51] ^ ks[ 49] ^ ks[ 46] ^ 0x9e3779b9 ^ 46), 11);
ks[ 55] = hc_rotl32_S ((ks[ 54] ^ ks[ 52] ^ ks[ 50] ^ ks[ 47] ^ 0x9e3779b9 ^ 47), 11);
ks[ 56] = hc_rotl32_S ((ks[ 55] ^ ks[ 53] ^ ks[ 51] ^ ks[ 48] ^ 0x9e3779b9 ^ 48), 11);
ks[ 57] = hc_rotl32_S ((ks[ 56] ^ ks[ 54] ^ ks[ 52] ^ ks[ 49] ^ 0x9e3779b9 ^ 49), 11);
ks[ 58] = hc_rotl32_S ((ks[ 57] ^ ks[ 55] ^ ks[ 53] ^ ks[ 50] ^ 0x9e3779b9 ^ 50), 11);
ks[ 59] = hc_rotl32_S ((ks[ 58] ^ ks[ 56] ^ ks[ 54] ^ ks[ 51] ^ 0x9e3779b9 ^ 51), 11);
ks[ 60] = hc_rotl32_S ((ks[ 59] ^ ks[ 57] ^ ks[ 55] ^ ks[ 52] ^ 0x9e3779b9 ^ 52), 11);
ks[ 61] = hc_rotl32_S ((ks[ 60] ^ ks[ 58] ^ ks[ 56] ^ ks[ 53] ^ 0x9e3779b9 ^ 53), 11);
ks[ 62] = hc_rotl32_S ((ks[ 61] ^ ks[ 59] ^ ks[ 57] ^ ks[ 54] ^ 0x9e3779b9 ^ 54), 11);
ks[ 63] = hc_rotl32_S ((ks[ 62] ^ ks[ 60] ^ ks[ 58] ^ ks[ 55] ^ 0x9e3779b9 ^ 55), 11);
ks[ 64] = hc_rotl32_S ((ks[ 63] ^ ks[ 61] ^ ks[ 59] ^ ks[ 56] ^ 0x9e3779b9 ^ 56), 11);
ks[ 65] = hc_rotl32_S ((ks[ 64] ^ ks[ 62] ^ ks[ 60] ^ ks[ 57] ^ 0x9e3779b9 ^ 57), 11);
ks[ 66] = hc_rotl32_S ((ks[ 65] ^ ks[ 63] ^ ks[ 61] ^ ks[ 58] ^ 0x9e3779b9 ^ 58), 11);
ks[ 67] = hc_rotl32_S ((ks[ 66] ^ ks[ 64] ^ ks[ 62] ^ ks[ 59] ^ 0x9e3779b9 ^ 59), 11);
ks[ 68] = hc_rotl32_S ((ks[ 67] ^ ks[ 65] ^ ks[ 63] ^ ks[ 60] ^ 0x9e3779b9 ^ 60), 11);
ks[ 69] = hc_rotl32_S ((ks[ 68] ^ ks[ 66] ^ ks[ 64] ^ ks[ 61] ^ 0x9e3779b9 ^ 61), 11);
ks[ 70] = hc_rotl32_S ((ks[ 69] ^ ks[ 67] ^ ks[ 65] ^ ks[ 62] ^ 0x9e3779b9 ^ 62), 11);
ks[ 71] = hc_rotl32_S ((ks[ 70] ^ ks[ 68] ^ ks[ 66] ^ ks[ 63] ^ 0x9e3779b9 ^ 63), 11);
ks[ 72] = hc_rotl32_S ((ks[ 71] ^ ks[ 69] ^ ks[ 67] ^ ks[ 64] ^ 0x9e3779b9 ^ 64), 11);
ks[ 73] = hc_rotl32_S ((ks[ 72] ^ ks[ 70] ^ ks[ 68] ^ ks[ 65] ^ 0x9e3779b9 ^ 65), 11);
ks[ 74] = hc_rotl32_S ((ks[ 73] ^ ks[ 71] ^ ks[ 69] ^ ks[ 66] ^ 0x9e3779b9 ^ 66), 11);
ks[ 75] = hc_rotl32_S ((ks[ 74] ^ ks[ 72] ^ ks[ 70] ^ ks[ 67] ^ 0x9e3779b9 ^ 67), 11);
ks[ 76] = hc_rotl32_S ((ks[ 75] ^ ks[ 73] ^ ks[ 71] ^ ks[ 68] ^ 0x9e3779b9 ^ 68), 11);
ks[ 77] = hc_rotl32_S ((ks[ 76] ^ ks[ 74] ^ ks[ 72] ^ ks[ 69] ^ 0x9e3779b9 ^ 69), 11);
ks[ 78] = hc_rotl32_S ((ks[ 77] ^ ks[ 75] ^ ks[ 73] ^ ks[ 70] ^ 0x9e3779b9 ^ 70), 11);
ks[ 79] = hc_rotl32_S ((ks[ 78] ^ ks[ 76] ^ ks[ 74] ^ ks[ 71] ^ 0x9e3779b9 ^ 71), 11);
ks[ 80] = hc_rotl32_S ((ks[ 79] ^ ks[ 77] ^ ks[ 75] ^ ks[ 72] ^ 0x9e3779b9 ^ 72), 11);
ks[ 81] = hc_rotl32_S ((ks[ 80] ^ ks[ 78] ^ ks[ 76] ^ ks[ 73] ^ 0x9e3779b9 ^ 73), 11);
ks[ 82] = hc_rotl32_S ((ks[ 81] ^ ks[ 79] ^ ks[ 77] ^ ks[ 74] ^ 0x9e3779b9 ^ 74), 11);
ks[ 83] = hc_rotl32_S ((ks[ 82] ^ ks[ 80] ^ ks[ 78] ^ ks[ 75] ^ 0x9e3779b9 ^ 75), 11);
ks[ 84] = hc_rotl32_S ((ks[ 83] ^ ks[ 81] ^ ks[ 79] ^ ks[ 76] ^ 0x9e3779b9 ^ 76), 11);
ks[ 85] = hc_rotl32_S ((ks[ 84] ^ ks[ 82] ^ ks[ 80] ^ ks[ 77] ^ 0x9e3779b9 ^ 77), 11);
ks[ 86] = hc_rotl32_S ((ks[ 85] ^ ks[ 83] ^ ks[ 81] ^ ks[ 78] ^ 0x9e3779b9 ^ 78), 11);
ks[ 87] = hc_rotl32_S ((ks[ 86] ^ ks[ 84] ^ ks[ 82] ^ ks[ 79] ^ 0x9e3779b9 ^ 79), 11);
ks[ 88] = hc_rotl32_S ((ks[ 87] ^ ks[ 85] ^ ks[ 83] ^ ks[ 80] ^ 0x9e3779b9 ^ 80), 11);
ks[ 89] = hc_rotl32_S ((ks[ 88] ^ ks[ 86] ^ ks[ 84] ^ ks[ 81] ^ 0x9e3779b9 ^ 81), 11);
ks[ 90] = hc_rotl32_S ((ks[ 89] ^ ks[ 87] ^ ks[ 85] ^ ks[ 82] ^ 0x9e3779b9 ^ 82), 11);
ks[ 91] = hc_rotl32_S ((ks[ 90] ^ ks[ 88] ^ ks[ 86] ^ ks[ 83] ^ 0x9e3779b9 ^ 83), 11);
ks[ 92] = hc_rotl32_S ((ks[ 91] ^ ks[ 89] ^ ks[ 87] ^ ks[ 84] ^ 0x9e3779b9 ^ 84), 11);
ks[ 93] = hc_rotl32_S ((ks[ 92] ^ ks[ 90] ^ ks[ 88] ^ ks[ 85] ^ 0x9e3779b9 ^ 85), 11);
ks[ 94] = hc_rotl32_S ((ks[ 93] ^ ks[ 91] ^ ks[ 89] ^ ks[ 86] ^ 0x9e3779b9 ^ 86), 11);
ks[ 95] = hc_rotl32_S ((ks[ 94] ^ ks[ 92] ^ ks[ 90] ^ ks[ 87] ^ 0x9e3779b9 ^ 87), 11);
ks[ 96] = hc_rotl32_S ((ks[ 95] ^ ks[ 93] ^ ks[ 91] ^ ks[ 88] ^ 0x9e3779b9 ^ 88), 11);
ks[ 97] = hc_rotl32_S ((ks[ 96] ^ ks[ 94] ^ ks[ 92] ^ ks[ 89] ^ 0x9e3779b9 ^ 89), 11);
ks[ 98] = hc_rotl32_S ((ks[ 97] ^ ks[ 95] ^ ks[ 93] ^ ks[ 90] ^ 0x9e3779b9 ^ 90), 11);
ks[ 99] = hc_rotl32_S ((ks[ 98] ^ ks[ 96] ^ ks[ 94] ^ ks[ 91] ^ 0x9e3779b9 ^ 91), 11);
ks[100] = hc_rotl32_S ((ks[ 99] ^ ks[ 97] ^ ks[ 95] ^ ks[ 92] ^ 0x9e3779b9 ^ 92), 11);
ks[101] = hc_rotl32_S ((ks[100] ^ ks[ 98] ^ ks[ 96] ^ ks[ 93] ^ 0x9e3779b9 ^ 93), 11);
ks[102] = hc_rotl32_S ((ks[101] ^ ks[ 99] ^ ks[ 97] ^ ks[ 94] ^ 0x9e3779b9 ^ 94), 11);
ks[103] = hc_rotl32_S ((ks[102] ^ ks[100] ^ ks[ 98] ^ ks[ 95] ^ 0x9e3779b9 ^ 95), 11);
ks[104] = hc_rotl32_S ((ks[103] ^ ks[101] ^ ks[ 99] ^ ks[ 96] ^ 0x9e3779b9 ^ 96), 11);
ks[105] = hc_rotl32_S ((ks[104] ^ ks[102] ^ ks[100] ^ ks[ 97] ^ 0x9e3779b9 ^ 97), 11);
ks[106] = hc_rotl32_S ((ks[105] ^ ks[103] ^ ks[101] ^ ks[ 98] ^ 0x9e3779b9 ^ 98), 11);
ks[107] = hc_rotl32_S ((ks[106] ^ ks[104] ^ ks[102] ^ ks[ 99] ^ 0x9e3779b9 ^ 99), 11);
ks[108] = hc_rotl32_S ((ks[107] ^ ks[105] ^ ks[103] ^ ks[100] ^ 0x9e3779b9 ^ 100), 11);
ks[109] = hc_rotl32_S ((ks[108] ^ ks[106] ^ ks[104] ^ ks[101] ^ 0x9e3779b9 ^ 101), 11);
ks[110] = hc_rotl32_S ((ks[109] ^ ks[107] ^ ks[105] ^ ks[102] ^ 0x9e3779b9 ^ 102), 11);
ks[111] = hc_rotl32_S ((ks[110] ^ ks[108] ^ ks[106] ^ ks[103] ^ 0x9e3779b9 ^ 103), 11);
ks[112] = hc_rotl32_S ((ks[111] ^ ks[109] ^ ks[107] ^ ks[104] ^ 0x9e3779b9 ^ 104), 11);
ks[113] = hc_rotl32_S ((ks[112] ^ ks[110] ^ ks[108] ^ ks[105] ^ 0x9e3779b9 ^ 105), 11);
ks[114] = hc_rotl32_S ((ks[113] ^ ks[111] ^ ks[109] ^ ks[106] ^ 0x9e3779b9 ^ 106), 11);
ks[115] = hc_rotl32_S ((ks[114] ^ ks[112] ^ ks[110] ^ ks[107] ^ 0x9e3779b9 ^ 107), 11);
ks[116] = hc_rotl32_S ((ks[115] ^ ks[113] ^ ks[111] ^ ks[108] ^ 0x9e3779b9 ^ 108), 11);
ks[117] = hc_rotl32_S ((ks[116] ^ ks[114] ^ ks[112] ^ ks[109] ^ 0x9e3779b9 ^ 109), 11);
ks[118] = hc_rotl32_S ((ks[117] ^ ks[115] ^ ks[113] ^ ks[110] ^ 0x9e3779b9 ^ 110), 11);
ks[119] = hc_rotl32_S ((ks[118] ^ ks[116] ^ ks[114] ^ ks[111] ^ 0x9e3779b9 ^ 111), 11);
ks[120] = hc_rotl32_S ((ks[119] ^ ks[117] ^ ks[115] ^ ks[112] ^ 0x9e3779b9 ^ 112), 11);
ks[121] = hc_rotl32_S ((ks[120] ^ ks[118] ^ ks[116] ^ ks[113] ^ 0x9e3779b9 ^ 113), 11);
ks[122] = hc_rotl32_S ((ks[121] ^ ks[119] ^ ks[117] ^ ks[114] ^ 0x9e3779b9 ^ 114), 11);
ks[123] = hc_rotl32_S ((ks[122] ^ ks[120] ^ ks[118] ^ ks[115] ^ 0x9e3779b9 ^ 115), 11);
ks[124] = hc_rotl32_S ((ks[123] ^ ks[121] ^ ks[119] ^ ks[116] ^ 0x9e3779b9 ^ 116), 11);
ks[125] = hc_rotl32_S ((ks[124] ^ ks[122] ^ ks[120] ^ ks[117] ^ 0x9e3779b9 ^ 117), 11);
ks[126] = hc_rotl32_S ((ks[125] ^ ks[123] ^ ks[121] ^ ks[118] ^ 0x9e3779b9 ^ 118), 11);
ks[127] = hc_rotl32_S ((ks[126] ^ ks[124] ^ ks[122] ^ ks[119] ^ 0x9e3779b9 ^ 119), 11);
ks[128] = hc_rotl32_S ((ks[127] ^ ks[125] ^ ks[123] ^ ks[120] ^ 0x9e3779b9 ^ 120), 11);
ks[129] = hc_rotl32_S ((ks[128] ^ ks[126] ^ ks[124] ^ ks[121] ^ 0x9e3779b9 ^ 121), 11);
ks[130] = hc_rotl32_S ((ks[129] ^ ks[127] ^ ks[125] ^ ks[122] ^ 0x9e3779b9 ^ 122), 11);
ks[131] = hc_rotl32_S ((ks[130] ^ ks[128] ^ ks[126] ^ ks[123] ^ 0x9e3779b9 ^ 123), 11);
ks[132] = hc_rotl32_S ((ks[131] ^ ks[129] ^ ks[127] ^ ks[124] ^ 0x9e3779b9 ^ 124), 11);
ks[133] = hc_rotl32_S ((ks[132] ^ ks[130] ^ ks[128] ^ ks[125] ^ 0x9e3779b9 ^ 125), 11);
ks[134] = hc_rotl32_S ((ks[133] ^ ks[131] ^ ks[129] ^ ks[126] ^ 0x9e3779b9 ^ 126), 11);
ks[135] = hc_rotl32_S ((ks[134] ^ ks[132] ^ ks[130] ^ ks[127] ^ 0x9e3779b9 ^ 127), 11);
ks[136] = hc_rotl32_S ((ks[135] ^ ks[133] ^ ks[131] ^ ks[128] ^ 0x9e3779b9 ^ 128), 11);
ks[137] = hc_rotl32_S ((ks[136] ^ ks[134] ^ ks[132] ^ ks[129] ^ 0x9e3779b9 ^ 129), 11);
ks[138] = hc_rotl32_S ((ks[137] ^ ks[135] ^ ks[133] ^ ks[130] ^ 0x9e3779b9 ^ 130), 11);
ks[139] = hc_rotl32_S ((ks[138] ^ ks[136] ^ ks[134] ^ ks[131] ^ 0x9e3779b9 ^ 131), 11);
u32 a,b,c,d,e,f,g,h;
u32 t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16;
k_set( 0,a,b,c,d); sb3(a,b,c,d,e,f,g,h); k_get( 0,e,f,g,h);
k_set( 1,a,b,c,d); sb2(a,b,c,d,e,f,g,h); k_get( 1,e,f,g,h);
k_set( 2,a,b,c,d); sb1(a,b,c,d,e,f,g,h); k_get( 2,e,f,g,h);
k_set( 3,a,b,c,d); sb0(a,b,c,d,e,f,g,h); k_get( 3,e,f,g,h);
k_set( 4,a,b,c,d); sb7(a,b,c,d,e,f,g,h); k_get( 4,e,f,g,h);
k_set( 5,a,b,c,d); sb6(a,b,c,d,e,f,g,h); k_get( 5,e,f,g,h);
k_set( 6,a,b,c,d); sb5(a,b,c,d,e,f,g,h); k_get( 6,e,f,g,h);
k_set( 7,a,b,c,d); sb4(a,b,c,d,e,f,g,h); k_get( 7,e,f,g,h);
k_set( 8,a,b,c,d); sb3(a,b,c,d,e,f,g,h); k_get( 8,e,f,g,h);
k_set( 9,a,b,c,d); sb2(a,b,c,d,e,f,g,h); k_get( 9,e,f,g,h);
k_set(10,a,b,c,d); sb1(a,b,c,d,e,f,g,h); k_get(10,e,f,g,h);
k_set(11,a,b,c,d); sb0(a,b,c,d,e,f,g,h); k_get(11,e,f,g,h);
k_set(12,a,b,c,d); sb7(a,b,c,d,e,f,g,h); k_get(12,e,f,g,h);
k_set(13,a,b,c,d); sb6(a,b,c,d,e,f,g,h); k_get(13,e,f,g,h);
k_set(14,a,b,c,d); sb5(a,b,c,d,e,f,g,h); k_get(14,e,f,g,h);
k_set(15,a,b,c,d); sb4(a,b,c,d,e,f,g,h); k_get(15,e,f,g,h);
k_set(16,a,b,c,d); sb3(a,b,c,d,e,f,g,h); k_get(16,e,f,g,h);
k_set(17,a,b,c,d); sb2(a,b,c,d,e,f,g,h); k_get(17,e,f,g,h);
k_set(18,a,b,c,d); sb1(a,b,c,d,e,f,g,h); k_get(18,e,f,g,h);
k_set(19,a,b,c,d); sb0(a,b,c,d,e,f,g,h); k_get(19,e,f,g,h);
k_set(20,a,b,c,d); sb7(a,b,c,d,e,f,g,h); k_get(20,e,f,g,h);
k_set(21,a,b,c,d); sb6(a,b,c,d,e,f,g,h); k_get(21,e,f,g,h);
k_set(22,a,b,c,d); sb5(a,b,c,d,e,f,g,h); k_get(22,e,f,g,h);
k_set(23,a,b,c,d); sb4(a,b,c,d,e,f,g,h); k_get(23,e,f,g,h);
k_set(24,a,b,c,d); sb3(a,b,c,d,e,f,g,h); k_get(24,e,f,g,h);
k_set(25,a,b,c,d); sb2(a,b,c,d,e,f,g,h); k_get(25,e,f,g,h);
k_set(26,a,b,c,d); sb1(a,b,c,d,e,f,g,h); k_get(26,e,f,g,h);
k_set(27,a,b,c,d); sb0(a,b,c,d,e,f,g,h); k_get(27,e,f,g,h);
k_set(28,a,b,c,d); sb7(a,b,c,d,e,f,g,h); k_get(28,e,f,g,h);
k_set(29,a,b,c,d); sb6(a,b,c,d,e,f,g,h); k_get(29,e,f,g,h);
k_set(30,a,b,c,d); sb5(a,b,c,d,e,f,g,h); k_get(30,e,f,g,h);
k_set(31,a,b,c,d); sb4(a,b,c,d,e,f,g,h); k_get(31,e,f,g,h);
k_set(32,a,b,c,d); sb3(a,b,c,d,e,f,g,h); k_get(32,e,f,g,h);
}
DECLSPEC void serpent192_encrypt (const u32 *ks, const u32 *in, u32 *out)
{
u32 a,b,c,d,e,f,g,h;
u32 t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16;
a = in[0];
b = in[1];
c = in[2];
d = in[3];
k_xor( 0,a,b,c,d); sb0(a,b,c,d,e,f,g,h); rot(e,f,g,h);
k_xor( 1,e,f,g,h); sb1(e,f,g,h,a,b,c,d); rot(a,b,c,d);
k_xor( 2,a,b,c,d); sb2(a,b,c,d,e,f,g,h); rot(e,f,g,h);
k_xor( 3,e,f,g,h); sb3(e,f,g,h,a,b,c,d); rot(a,b,c,d);
k_xor( 4,a,b,c,d); sb4(a,b,c,d,e,f,g,h); rot(e,f,g,h);
k_xor( 5,e,f,g,h); sb5(e,f,g,h,a,b,c,d); rot(a,b,c,d);
k_xor( 6,a,b,c,d); sb6(a,b,c,d,e,f,g,h); rot(e,f,g,h);
k_xor( 7,e,f,g,h); sb7(e,f,g,h,a,b,c,d); rot(a,b,c,d);
k_xor( 8,a,b,c,d); sb0(a,b,c,d,e,f,g,h); rot(e,f,g,h);
k_xor( 9,e,f,g,h); sb1(e,f,g,h,a,b,c,d); rot(a,b,c,d);
k_xor(10,a,b,c,d); sb2(a,b,c,d,e,f,g,h); rot(e,f,g,h);
k_xor(11,e,f,g,h); sb3(e,f,g,h,a,b,c,d); rot(a,b,c,d);
k_xor(12,a,b,c,d); sb4(a,b,c,d,e,f,g,h); rot(e,f,g,h);
k_xor(13,e,f,g,h); sb5(e,f,g,h,a,b,c,d); rot(a,b,c,d);
k_xor(14,a,b,c,d); sb6(a,b,c,d,e,f,g,h); rot(e,f,g,h);
k_xor(15,e,f,g,h); sb7(e,f,g,h,a,b,c,d); rot(a,b,c,d);
k_xor(16,a,b,c,d); sb0(a,b,c,d,e,f,g,h); rot(e,f,g,h);
k_xor(17,e,f,g,h); sb1(e,f,g,h,a,b,c,d); rot(a,b,c,d);
k_xor(18,a,b,c,d); sb2(a,b,c,d,e,f,g,h); rot(e,f,g,h);
k_xor(19,e,f,g,h); sb3(e,f,g,h,a,b,c,d); rot(a,b,c,d);
k_xor(20,a,b,c,d); sb4(a,b,c,d,e,f,g,h); rot(e,f,g,h);
k_xor(21,e,f,g,h); sb5(e,f,g,h,a,b,c,d); rot(a,b,c,d);
k_xor(22,a,b,c,d); sb6(a,b,c,d,e,f,g,h); rot(e,f,g,h);
k_xor(23,e,f,g,h); sb7(e,f,g,h,a,b,c,d); rot(a,b,c,d);
k_xor(24,a,b,c,d); sb0(a,b,c,d,e,f,g,h); rot(e,f,g,h);
k_xor(25,e,f,g,h); sb1(e,f,g,h,a,b,c,d); rot(a,b,c,d);
k_xor(26,a,b,c,d); sb2(a,b,c,d,e,f,g,h); rot(e,f,g,h);
k_xor(27,e,f,g,h); sb3(e,f,g,h,a,b,c,d); rot(a,b,c,d);
k_xor(28,a,b,c,d); sb4(a,b,c,d,e,f,g,h); rot(e,f,g,h);
k_xor(29,e,f,g,h); sb5(e,f,g,h,a,b,c,d); rot(a,b,c,d);
k_xor(30,a,b,c,d); sb6(a,b,c,d,e,f,g,h); rot(e,f,g,h);
k_xor(31,e,f,g,h); sb7(e,f,g,h,a,b,c,d);
k_xor(32,a,b,c,d);
out[0] = a;
out[1] = b;
out[2] = c;
out[3] = d;
}
DECLSPEC void serpent192_decrypt (const u32 *ks, const u32 *in, u32 *out)
{
u32 a,b,c,d,e,f,g,h;
u32 t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16;
a = in[0];
b = in[1];
c = in[2];
d = in[3];
k_xor(32,a,b,c,d);
ib7(a,b,c,d,e,f,g,h); k_xor(31,e,f,g,h);
irot(e,f,g,h); ib6(e,f,g,h,a,b,c,d); k_xor(30,a,b,c,d);
irot(a,b,c,d); ib5(a,b,c,d,e,f,g,h); k_xor(29,e,f,g,h);
irot(e,f,g,h); ib4(e,f,g,h,a,b,c,d); k_xor(28,a,b,c,d);
irot(a,b,c,d); ib3(a,b,c,d,e,f,g,h); k_xor(27,e,f,g,h);
irot(e,f,g,h); ib2(e,f,g,h,a,b,c,d); k_xor(26,a,b,c,d);
irot(a,b,c,d); ib1(a,b,c,d,e,f,g,h); k_xor(25,e,f,g,h);
irot(e,f,g,h); ib0(e,f,g,h,a,b,c,d); k_xor(24,a,b,c,d);
irot(a,b,c,d); ib7(a,b,c,d,e,f,g,h); k_xor(23,e,f,g,h);
irot(e,f,g,h); ib6(e,f,g,h,a,b,c,d); k_xor(22,a,b,c,d);
irot(a,b,c,d); ib5(a,b,c,d,e,f,g,h); k_xor(21,e,f,g,h);
irot(e,f,g,h); ib4(e,f,g,h,a,b,c,d); k_xor(20,a,b,c,d);
irot(a,b,c,d); ib3(a,b,c,d,e,f,g,h); k_xor(19,e,f,g,h);
irot(e,f,g,h); ib2(e,f,g,h,a,b,c,d); k_xor(18,a,b,c,d);
irot(a,b,c,d); ib1(a,b,c,d,e,f,g,h); k_xor(17,e,f,g,h);
irot(e,f,g,h); ib0(e,f,g,h,a,b,c,d); k_xor(16,a,b,c,d);
irot(a,b,c,d); ib7(a,b,c,d,e,f,g,h); k_xor(15,e,f,g,h);
irot(e,f,g,h); ib6(e,f,g,h,a,b,c,d); k_xor(14,a,b,c,d);
irot(a,b,c,d); ib5(a,b,c,d,e,f,g,h); k_xor(13,e,f,g,h);
irot(e,f,g,h); ib4(e,f,g,h,a,b,c,d); k_xor(12,a,b,c,d);
irot(a,b,c,d); ib3(a,b,c,d,e,f,g,h); k_xor(11,e,f,g,h);
irot(e,f,g,h); ib2(e,f,g,h,a,b,c,d); k_xor(10,a,b,c,d);
irot(a,b,c,d); ib1(a,b,c,d,e,f,g,h); k_xor( 9,e,f,g,h);
irot(e,f,g,h); ib0(e,f,g,h,a,b,c,d); k_xor( 8,a,b,c,d);
irot(a,b,c,d); ib7(a,b,c,d,e,f,g,h); k_xor( 7,e,f,g,h);
irot(e,f,g,h); ib6(e,f,g,h,a,b,c,d); k_xor( 6,a,b,c,d);
irot(a,b,c,d); ib5(a,b,c,d,e,f,g,h); k_xor( 5,e,f,g,h);
irot(e,f,g,h); ib4(e,f,g,h,a,b,c,d); k_xor( 4,a,b,c,d);
irot(a,b,c,d); ib3(a,b,c,d,e,f,g,h); k_xor( 3,e,f,g,h);
irot(e,f,g,h); ib2(e,f,g,h,a,b,c,d); k_xor( 2,a,b,c,d);
irot(a,b,c,d); ib1(a,b,c,d,e,f,g,h); k_xor( 1,e,f,g,h);
irot(e,f,g,h); ib0(e,f,g,h,a,b,c,d); k_xor( 0,a,b,c,d);
out[0] = a;
out[1] = b;
out[2] = c;
out[3] = d;
}
// 256 bit key
DECLSPEC void serpent256_set_key (u32 *ks, const u32 *ukey)

View File

@ -9,6 +9,9 @@
DECLSPEC void serpent128_set_key (u32 *ks, const u32 *ukey);
DECLSPEC void serpent128_encrypt (const u32 *ks, const u32 *in, u32 *out);
DECLSPEC void serpent128_decrypt (const u32 *ks, const u32 *in, u32 *out);
DECLSPEC void serpent192_set_key (u32 *ks, const u32 *ukey);
DECLSPEC void serpent192_encrypt (const u32 *ks, const u32 *in, u32 *out);
DECLSPEC void serpent192_decrypt (const u32 *ks, const u32 *in, u32 *out);
DECLSPEC void serpent256_set_key (u32 *ks, const u32 *ukey);
DECLSPEC void serpent256_encrypt (const u32 *ks, const u32 *in, u32 *out);
DECLSPEC void serpent256_decrypt (const u32 *ks, const u32 *in, u32 *out);

View File

@ -18,6 +18,7 @@
/* -------------------------------------------------------------------- */
/* */
/* Cleaned and optimized for GPU use with hashcat by Jens Steube */
/* Added 192-bit functions by Gabriele Gristina */
#include "inc_vendor.h"
#include "inc_types.h"
@ -79,7 +80,8 @@ CONSTANT_VK u32a q_tab[2][256] =
CONSTANT_VK u32a m_tab[4][256] =
{
{ 0xBCBC3275, 0xECEC21F3, 0x202043C6, 0xB3B3C9F4, 0xDADA03DB, 0x02028B7B,
{
0xBCBC3275, 0xECEC21F3, 0x202043C6, 0xB3B3C9F4, 0xDADA03DB, 0x02028B7B,
0xE2E22BFB, 0x9E9EFAC8, 0xC9C9EC4A, 0xD4D409D3, 0x18186BE6, 0x1E1E9F6B,
0x98980E45, 0xB2B2387D, 0xA6A6D2E8, 0x2626B74B, 0x3C3C57D6, 0x93938A32,
0x8282EED8, 0x525298FD, 0x7B7BD437, 0xBBBB3771, 0x5B5B97F1, 0x474783E1,
@ -121,9 +123,10 @@ CONSTANT_VK u32a m_tab[4][256] =
0xE6E6540D, 0xDBDBF252, 0x92927BBB, 0xB7B7B602, 0x6969CA2F, 0x3939D9A9,
0xD3D30CD7, 0xA7A72361, 0xA2A2AD1E, 0xC3C399B4, 0x6C6C4450, 0x07070504,
0x04047FF6, 0x272746C2, 0xACACA716, 0xD0D07625, 0x50501386, 0xDCDCF756,
0x84841A55, 0xE1E15109, 0x7A7A25BE, 0x1313EF91 },
{ 0xA9D93939, 0x67901717, 0xB3719C9C, 0xE8D2A6A6, 0x04050707, 0xFD985252,
0x84841A55, 0xE1E15109, 0x7A7A25BE, 0x1313EF91
},
{
0xA9D93939, 0x67901717, 0xB3719C9C, 0xE8D2A6A6, 0x04050707, 0xFD985252,
0xA3658080, 0x76DFE4E4, 0x9A084545, 0x92024B4B, 0x80A0E0E0, 0x78665A5A,
0xE4DDAFAF, 0xDDB06A6A, 0xD1BF6363, 0x38362A2A, 0x0D54E6E6, 0xC6432020,
0x3562CCCC, 0x98BEF2F2, 0x181E1212, 0xF724EBEB, 0xECD7A1A1, 0x6C774141,
@ -165,9 +168,10 @@ CONSTANT_VK u32a m_tab[4][256] =
0x2BCF6E6E, 0x40507070, 0xDCEB8585, 0xFE750A0A, 0x328A9393, 0xA48DDFDF,
0xCA4C2929, 0x10141C1C, 0x2173D7D7, 0xF0CCB4B4, 0xD309D4D4, 0x5D108A8A,
0x0FE25151, 0x00000000, 0x6F9A1919, 0x9DE01A1A, 0x368F9494, 0x42E6C7C7,
0x4AECC9C9, 0x5EFDD2D2, 0xC1AB7F7F, 0xE0D8A8A8 },
{ 0xBC75BC32, 0xECF3EC21, 0x20C62043, 0xB3F4B3C9, 0xDADBDA03, 0x027B028B,
0x4AECC9C9, 0x5EFDD2D2, 0xC1AB7F7F, 0xE0D8A8A8
},
{
0xBC75BC32, 0xECF3EC21, 0x20C62043, 0xB3F4B3C9, 0xDADBDA03, 0x027B028B,
0xE2FBE22B, 0x9EC89EFA, 0xC94AC9EC, 0xD4D3D409, 0x18E6186B, 0x1E6B1E9F,
0x9845980E, 0xB27DB238, 0xA6E8A6D2, 0x264B26B7, 0x3CD63C57, 0x9332938A,
0x82D882EE, 0x52FD5298, 0x7B377BD4, 0xBB71BB37, 0x5BF15B97, 0x47E14783,
@ -209,9 +213,10 @@ CONSTANT_VK u32a m_tab[4][256] =
0xE60DE654, 0xDB52DBF2, 0x92BB927B, 0xB702B7B6, 0x692F69CA, 0x39A939D9,
0xD3D7D30C, 0xA761A723, 0xA21EA2AD, 0xC3B4C399, 0x6C506C44, 0x07040705,
0x04F6047F, 0x27C22746, 0xAC16ACA7, 0xD025D076, 0x50865013, 0xDC56DCF7,
0x8455841A, 0xE109E151, 0x7ABE7A25, 0x139113EF },
{ 0xD939A9D9, 0x90176790, 0x719CB371, 0xD2A6E8D2, 0x05070405, 0x9852FD98,
0x8455841A, 0xE109E151, 0x7ABE7A25, 0x139113EF
},
{
0xD939A9D9, 0x90176790, 0x719CB371, 0xD2A6E8D2, 0x05070405, 0x9852FD98,
0x6580A365, 0xDFE476DF, 0x08459A08, 0x024B9202, 0xA0E080A0, 0x665A7866,
0xDDAFE4DD, 0xB06ADDB0, 0xBF63D1BF, 0x362A3836, 0x54E60D54, 0x4320C643,
0x62CC3562, 0xBEF298BE, 0x1E12181E, 0x24EBF724, 0xD7A1ECD7, 0x77416C77,
@ -253,7 +258,8 @@ CONSTANT_VK u32a m_tab[4][256] =
0xCF6E2BCF, 0x50704050, 0xEB85DCEB, 0x750AFE75, 0x8A93328A, 0x8DDFA48D,
0x4C29CA4C, 0x141C1014, 0x73D72173, 0xCCB4F0CC, 0x09D4D309, 0x108A5D10,
0xE2510FE2, 0x00000000, 0x9A196F9A, 0xE01A9DE0, 0x8F94368F, 0xE6C742E6,
0xECC94AEC, 0xFDD25EFD, 0xAB7FC1AB, 0xD8A8E0D8 }
0xECC94AEC, 0xFDD25EFD, 0xAB7FC1AB, 0xD8A8E0D8
}
};
#define g1_fun128(x) \
@ -268,6 +274,31 @@ CONSTANT_VK u32a m_tab[4][256] =
mds (2, q22 (unpack_v8c_from_v32_S (x), sk)) ^ \
mds (3, q23 (unpack_v8d_from_v32_S (x), sk)))
#define g1_fun192(x) \
(mds (0, q30 (unpack_v8d_from_v32_S (x), sk)) ^ \
mds (1, q31 (unpack_v8a_from_v32_S (x), sk)) ^ \
mds (2, q32 (unpack_v8b_from_v32_S (x), sk)) ^ \
mds (3, q33 (unpack_v8c_from_v32_S (x), sk)))
#define g0_fun192(x) \
(mds (0, q30 (unpack_v8a_from_v32_S (x), sk)) ^ \
mds (1, q31 (unpack_v8b_from_v32_S (x), sk)) ^ \
mds (2, q32 (unpack_v8c_from_v32_S (x), sk)) ^ \
mds (3, q33 (unpack_v8d_from_v32_S (x), sk)))
#define g1_fun256(x) \
(mds (0, q40 (unpack_v8d_from_v32_S (x), sk)) ^ \
mds (1, q41 (unpack_v8a_from_v32_S (x), sk)) ^ \
mds (2, q42 (unpack_v8b_from_v32_S (x), sk)) ^ \
mds (3, q43 (unpack_v8c_from_v32_S (x), sk)))
#define g0_fun256(x) \
(mds (0, q40 (unpack_v8a_from_v32_S (x), sk)) ^ \
mds (1, q41 (unpack_v8b_from_v32_S (x), sk)) ^ \
mds (2, q42 (unpack_v8c_from_v32_S (x), sk)) ^ \
mds (3, q43 (unpack_v8d_from_v32_S (x), sk)))
#define f_rnd128(i) \
{ \
const u32 t0 = g0_fun128 (data[0]); \
@ -292,6 +323,30 @@ CONSTANT_VK u32a m_tab[4][256] =
data[1] = hc_rotr32_S (data[1] ^ (t2 + 2 * t3 + lk[4 * (i) + 9]), 1); \
}
#define f_rnd192(i) \
{ \
const u32 t0 = g0_fun192 (data[0]); \
const u32 t1 = g1_fun192 (data[1]); \
data[2] = hc_rotr32_S (data[2] ^ (t0 + t1 + lk[4 * (i) + 8]), 1); \
data[3] = hc_rotl32_S (data[3], 1) ^ (t0 + 2 * t1 + lk[4 * (i) + 9]); \
const u32 t2 = g0_fun192 (data[2]); \
const u32 t3 = g1_fun192 (data[3]); \
data[0] = hc_rotr32_S (data[0] ^ (t2 + t3 + lk[4 * (i) + 10]), 1); \
data[1] = hc_rotl32_S (data[1], 1) ^ (t2 + 2 * t3 + lk[4 * (i) + 11]); \
}
#define i_rnd192(i) \
{ \
const u32 t0 = g0_fun192 (data[0]); \
const u32 t1 = g1_fun192 (data[1]); \
data[2] = hc_rotl32_S (data[2], 1) ^ (t0 + t1 + lk[4 * (i) + 10]); \
data[3] = hc_rotr32_S (data[3] ^ (t0 + 2 * t1 + lk[4 * (i) + 11]), 1); \
const u32 t2 = g0_fun192 (data[2]); \
const u32 t3 = g1_fun192 (data[3]); \
data[0] = hc_rotl32_S (data[0], 1) ^ (t2 + t3 + lk[4 * (i) + 8]); \
data[1] = hc_rotr32_S (data[1] ^ (t2 + 2 * t3 + lk[4 * (i) + 9]), 1); \
}
#define f_rnd256(i) \
{ \
const u32 t0 = g0_fun256 (data[0]); \
@ -325,6 +380,11 @@ CONSTANT_VK u32a m_tab[4][256] =
#define q22(x,k) q (1, q (0, x) ^ unpack_v8c_from_v32_S (k[1])) ^ unpack_v8c_from_v32_S (k[0])
#define q23(x,k) q (1, q (1, x) ^ unpack_v8d_from_v32_S (k[1])) ^ unpack_v8d_from_v32_S (k[0])
#define q30(x,k) q (0, q (0, q (1, x) ^ unpack_v8a_from_v32_S (k[2])) ^ unpack_v8a_from_v32_S (k[1])) ^ unpack_v8a_from_v32_S (k[0])
#define q31(x,k) q (0, q (1, q (1, x) ^ unpack_v8b_from_v32_S (k[2])) ^ unpack_v8b_from_v32_S (k[1])) ^ unpack_v8b_from_v32_S (k[0])
#define q32(x,k) q (1, q (0, q (0, x) ^ unpack_v8c_from_v32_S (k[2])) ^ unpack_v8c_from_v32_S (k[1])) ^ unpack_v8c_from_v32_S (k[0])
#define q33(x,k) q (1, q (1, q (0, x) ^ unpack_v8d_from_v32_S (k[2])) ^ unpack_v8d_from_v32_S (k[1])) ^ unpack_v8d_from_v32_S (k[0])
#define q40(x,k) q (0, q (0, q (1, q (1, x) ^ unpack_v8a_from_v32_S (k[3])) ^ unpack_v8a_from_v32_S (k[2])) ^ unpack_v8a_from_v32_S (k[1])) ^ unpack_v8a_from_v32_S (k[0])
#define q41(x,k) q (0, q (1, q (1, q (0, x) ^ unpack_v8b_from_v32_S (k[3])) ^ unpack_v8b_from_v32_S (k[2])) ^ unpack_v8b_from_v32_S (k[1])) ^ unpack_v8b_from_v32_S (k[0])
#define q42(x,k) q (1, q (0, q (0, q (0, x) ^ unpack_v8c_from_v32_S (k[3])) ^ unpack_v8c_from_v32_S (k[2])) ^ unpack_v8c_from_v32_S (k[1])) ^ unpack_v8c_from_v32_S (k[0])
@ -361,6 +421,8 @@ DECLSPEC u32 mds_rem (u32 p0, u32 p1)
return p1;
}
// 128 bit key
DECLSPEC u32 h_fun128 (const u32 x, const u32 *key)
{
u32 b0, b1, b2, b3;
@ -459,20 +521,116 @@ DECLSPEC void twofish128_decrypt (const u32 *sk, const u32 *lk, const u32 *in, u
out[3] = data[1] ^ lk[3];
}
// 192 bit key
DECLSPEC u32 h_fun192 (const u32 x, const u32 *key)
{
u32 b0, b1, b2, b3;
b0 = unpack_v8a_from_v32_S (x);
b1 = unpack_v8b_from_v32_S (x);
b2 = unpack_v8c_from_v32_S (x);
b3 = unpack_v8d_from_v32_S (x);
b0 = q (1, b0) ^ unpack_v8a_from_v32_S (key[2]);
b1 = q (1, b1) ^ unpack_v8b_from_v32_S (key[2]);
b2 = q (0, b2) ^ unpack_v8c_from_v32_S (key[2]);
b3 = q (0, b3) ^ unpack_v8d_from_v32_S (key[2]);
b0 = q (0, (q (0, b0) ^ unpack_v8a_from_v32_S (key[1]))) ^ unpack_v8a_from_v32_S (key[0]);
b1 = q (0, (q (1, b1) ^ unpack_v8b_from_v32_S (key[1]))) ^ unpack_v8b_from_v32_S (key[0]);
b2 = q (1, (q (0, b2) ^ unpack_v8c_from_v32_S (key[1]))) ^ unpack_v8c_from_v32_S (key[0]);
b3 = q (1, (q (1, b3) ^ unpack_v8d_from_v32_S (key[1]))) ^ unpack_v8d_from_v32_S (key[0]);
return mds (0, b0) ^ mds (1, b1) ^ mds (2, b2) ^ mds (3, b3);
}
DECLSPEC void twofish192_set_key (u32 *sk, u32 *lk, const u32 *ukey)
{
u32 me_key[3];
me_key[0] = ukey[0];
me_key[1] = ukey[2];
me_key[2] = ukey[4];
u32 mo_key[3];
mo_key[0] = ukey[1];
mo_key[1] = ukey[3];
mo_key[2] = ukey[5];
sk[2] = mds_rem (me_key[0], mo_key[0]);
sk[1] = mds_rem (me_key[1], mo_key[1]);
sk[0] = mds_rem (me_key[2], mo_key[2]);
#ifdef _unroll
#pragma unroll
#endif
for (int i = 0; i < 40; i += 2)
{
u32 a = 0x01010101 * i;
u32 b = 0x01010101 + a;
a = h_fun192 (a, me_key);
b = h_fun192 (b, mo_key);
b = hc_rotl32_S (b, 8);
lk[i + 0] = a + b;
lk[i + 1] = hc_rotl32_S (a + 2 * b, 9);
}
}
DECLSPEC void twofish192_encrypt (const u32 *sk, const u32 *lk, const u32 *in, u32 *out)
{
u32 data[4];
data[0] = in[0] ^ lk[0];
data[1] = in[1] ^ lk[1];
data[2] = in[2] ^ lk[2];
data[3] = in[3] ^ lk[3];
f_rnd192 (0);
f_rnd192 (1);
f_rnd192 (2);
f_rnd192 (3);
f_rnd192 (4);
f_rnd192 (5);
f_rnd192 (6);
f_rnd192 (7);
out[0] = data[2] ^ lk[4];
out[1] = data[3] ^ lk[5];
out[2] = data[0] ^ lk[6];
out[3] = data[1] ^ lk[7];
}
DECLSPEC void twofish192_decrypt (const u32 *sk, const u32 *lk, const u32 *in, u32 *out)
{
u32 data[4];
data[0] = in[0] ^ lk[4];
data[1] = in[1] ^ lk[5];
data[2] = in[2] ^ lk[6];
data[3] = in[3] ^ lk[7];
i_rnd192 (7);
i_rnd192 (6);
i_rnd192 (5);
i_rnd192 (4);
i_rnd192 (3);
i_rnd192 (2);
i_rnd192 (1);
i_rnd192 (0);
out[0] = data[2] ^ lk[0];
out[1] = data[3] ^ lk[1];
out[2] = data[0] ^ lk[2];
out[3] = data[1] ^ lk[3];
}
// 256 bit key
#define g1_fun256(x) \
(mds (0, q40 (unpack_v8d_from_v32_S (x), sk)) ^ \
mds (1, q41 (unpack_v8a_from_v32_S (x), sk)) ^ \
mds (2, q42 (unpack_v8b_from_v32_S (x), sk)) ^ \
mds (3, q43 (unpack_v8c_from_v32_S (x), sk)))
#define g0_fun256(x) \
(mds (0, q40 (unpack_v8a_from_v32_S (x), sk)) ^ \
mds (1, q41 (unpack_v8b_from_v32_S (x), sk)) ^ \
mds (2, q42 (unpack_v8c_from_v32_S (x), sk)) ^ \
mds (3, q43 (unpack_v8d_from_v32_S (x), sk)))
DECLSPEC u32 h_fun256 (const u32 x, const u32 *key)
{
u32 b0, b1, b2, b3;
@ -589,8 +747,15 @@ DECLSPEC void twofish256_decrypt (const u32 *sk, const u32 *lk, const u32 *in, u
#undef g1_fun128
#undef g0_fun128
#undef g1_fun192
#undef g0_fun192
#undef g1_fun256
#undef g0_fun256
#undef f_rnd128
#undef i_rnd128
#undef f_rnd192
#undef i_rnd192
#undef f_rnd256
#undef i_rnd256
@ -602,6 +767,12 @@ DECLSPEC void twofish256_decrypt (const u32 *sk, const u32 *lk, const u32 *in, u
#undef q21
#undef q22
#undef q23
#undef q30
#undef q31
#undef q32
#undef q33
#undef q40
#undef q41
#undef q42

View File

@ -11,6 +11,10 @@ DECLSPEC u32 h_fun128 (const u32 x, const u32 *key);
DECLSPEC void twofish128_set_key (u32 *sk, u32 *lk, const u32 *ukey);
DECLSPEC void twofish128_encrypt (const u32 *sk, const u32 *lk, const u32 *in, u32 *out);
DECLSPEC void twofish128_decrypt (const u32 *sk, const u32 *lk, const u32 *in, u32 *out);
DECLSPEC u32 h_fun192 (const u32 x, const u32 *key);
DECLSPEC void twofish192_set_key (u32 *sk, u32 *lk, const u32 *ukey);
DECLSPEC void twofish192_encrypt (const u32 *sk, const u32 *lk, const u32 *in, u32 *out);
DECLSPEC void twofish192_decrypt (const u32 *sk, const u32 *lk, const u32 *in, u32 *out);
DECLSPEC u32 h_fun256 (const u32 x, const u32 *key);
DECLSPEC void twofish256_set_key (u32 *sk, u32 *lk, const u32 *ukey);
DECLSPEC void twofish256_encrypt (const u32 *sk, const u32 *lk, const u32 *in, u32 *out);

View File

@ -1435,13 +1435,12 @@ DECLSPEC u32x hc_bytealign_be (const u32x a, const u32x b, const int c)
{
u32x r = 0;
switch (c & 3)
{
case 0: r = b; break;
case 1: r = (a << 24) | (b >> 8); break;
case 2: r = (a << 16) | (b >> 16); break;
case 3: r = (a << 8) | (b >> 24); break;
}
const int cm = c & 3;
if (cm == 0) { r = b; }
else if (cm == 1) { r = (a << 24) | (b >> 8); }
else if (cm == 2) { r = (a << 16) | (b >> 16); }
else if (cm == 3) { r = (a << 8) | (b >> 24); }
return r;
}
@ -1450,13 +1449,12 @@ DECLSPEC u32 hc_bytealign_be_S (const u32 a, const u32 b, const int c)
{
u32 r = 0;
switch (c & 3)
{
case 0: r = b; break;
case 1: r = (a << 24) | (b >> 8); break;
case 2: r = (a << 16) | (b >> 16); break;
case 3: r = (a << 8) | (b >> 24); break;
}
const int cm = c & 3;
if (cm == 0) { r = b; }
else if (cm == 1) { r = (a << 24) | (b >> 8); }
else if (cm == 2) { r = (a << 16) | (b >> 16); }
else if (cm == 3) { r = (a << 8) | (b >> 24); }
return r;
}
@ -1465,13 +1463,12 @@ DECLSPEC u32x hc_bytealign (const u32x a, const u32x b, const int c)
{
u32x r = 0;
switch (c & 3)
{
case 0: r = b; break;
case 1: r = (a >> 24) | (b << 8); break;
case 2: r = (a >> 16) | (b << 16); break;
case 3: r = (a >> 8) | (b << 24); break;
}
const int cm = c & 3;
if (cm == 0) { r = b; }
else if (cm == 1) { r = (a >> 24) | (b << 8); }
else if (cm == 2) { r = (a >> 16) | (b << 16); }
else if (cm == 3) { r = (a >> 8) | (b << 24); }
return r;
}
@ -1480,13 +1477,12 @@ DECLSPEC u32 hc_bytealign_S (const u32 a, const u32 b, const int c)
{
u32 r = 0;
switch (c & 3)
{
case 0: r = b; break;
case 1: r = (a >> 24) | (b << 8); break;
case 2: r = (a >> 16) | (b << 16); break;
case 3: r = (a >> 8) | (b << 24); break;
}
const int cm = c & 3;
if (cm == 0) { r = b; }
else if (cm == 1) { r = (a >> 24) | (b << 8); }
else if (cm == 2) { r = (a >> 16) | (b << 16); }
else if (cm == 3) { r = (a >> 8) | (b << 24); }
return r;
}
@ -1849,13 +1845,12 @@ DECLSPEC u32x hc_bytealign_be (const u32x a, const u32x b, const int c)
{
u32x r = 0;
switch (c & 3)
{
case 0: r = b; break;
case 1: r = (a << 24) | (b >> 8); break;
case 2: r = (a << 16) | (b >> 16); break;
case 3: r = (a << 8) | (b >> 24); break;
}
const int cm = c & 3;
if (cm == 0) { r = b; }
else if (cm == 1) { r = (a << 24) | (b >> 8); }
else if (cm == 2) { r = (a << 16) | (b >> 16); }
else if (cm == 3) { r = (a << 8) | (b >> 24); }
return r;
}
@ -1864,13 +1859,12 @@ DECLSPEC u32 hc_bytealign_be_S (const u32 a, const u32 b, const int c)
{
u32 r = 0;
switch (c & 3)
{
case 0: r = b; break;
case 1: r = (a << 24) | (b >> 8); break;
case 2: r = (a << 16) | (b >> 16); break;
case 3: r = (a << 8) | (b >> 24); break;
}
const int cm = c & 3;
if (cm == 0) { r = b; }
else if (cm == 1) { r = (a << 24) | (b >> 8); }
else if (cm == 2) { r = (a << 16) | (b >> 16); }
else if (cm == 3) { r = (a << 8) | (b >> 24); }
return r;
}
@ -1879,13 +1873,12 @@ DECLSPEC u32x hc_bytealign (const u32x a, const u32x b, const int c)
{
u32x r = 0;
switch (c & 3)
{
case 0: r = b; break;
case 1: r = (a >> 24) | (b << 8); break;
case 2: r = (a >> 16) | (b << 16); break;
case 3: r = (a >> 8) | (b << 24); break;
}
const int cm = c & 3;
if (cm == 0) { r = b; }
else if (cm == 1) { r = (a >> 24) | (b << 8); }
else if (cm == 2) { r = (a >> 16) | (b << 16); }
else if (cm == 3) { r = (a >> 8) | (b << 24); }
return r;
}
@ -1894,13 +1887,12 @@ DECLSPEC u32 hc_bytealign_S (const u32 a, const u32 b, const int c)
{
u32 r = 0;
switch (c & 3)
{
case 0: r = b; break;
case 1: r = (a >> 24) | (b << 8); break;
case 2: r = (a >> 16) | (b << 16); break;
case 3: r = (a >> 8) | (b << 24); break;
}
const int cm = c & 3;
if (cm == 0) { r = b; }
else if (cm == 1) { r = (a >> 24) | (b << 8); }
else if (cm == 2) { r = (a >> 16) | (b << 16); }
else if (cm == 3) { r = (a >> 8) | (b << 24); }
return r;
}
@ -1985,6 +1977,515 @@ DECLSPEC int find_hash (const u32 *digest, const u32 digests_cnt, GLOBAL_AS cons
}
#endif
// Input has to be zero padded and buffer size has to be multiple of 4 and at least of length 24
// We simply ignore buffer length for the first 24 bytes for some extra speed boost :)
// Number of unrolls found by simply testing what gave best results
DECLSPEC int hc_enc_scan (const u32 *buf, const int len)
{
if (buf[0] & 0x80808080) return 1;
if (buf[1] & 0x80808080) return 1;
if (buf[2] & 0x80808080) return 1;
if (buf[3] & 0x80808080) return 1;
if (buf[4] & 0x80808080) return 1;
if (buf[5] & 0x80808080) return 1;
for (int i = 24, j = 6; i < len; i += 4, j += 1)
{
if (buf[j] & 0x80808080) return 1;
}
return 0;
}
DECLSPEC int hc_enc_scan_global (GLOBAL_AS const u32 *buf, const int len)
{
if (buf[0] & 0x80808080) return 1;
if (buf[1] & 0x80808080) return 1;
if (buf[2] & 0x80808080) return 1;
if (buf[3] & 0x80808080) return 1;
if (buf[4] & 0x80808080) return 1;
if (buf[5] & 0x80808080) return 1;
for (int i = 24, j = 6; i < len; i += 4, j += 1)
{
if (buf[j] & 0x80808080) return 1;
}
return 0;
}
// Constants and some code snippets from unicode.org's ConvertUTF.c
// Compiler can perfectly translate some of the branches and switch cases this into MOVC
// which is faster than lookup tables
#define halfShift 10
#define halfBase 0x0010000
#define halfMask 0x3FF
#define UNI_MAX_BMP 0xFFFF
#define UNI_SUR_HIGH_START 0xD800
#define UNI_SUR_HIGH_END 0xDBFF
#define UNI_SUR_LOW_START 0xDC00
#define UNI_SUR_LOW_END 0xDFFF
/*
* Magic values subtracted from a buffer value during UTF8 conversion.
* This table contains as many values as there might be trailing bytes
* in a UTF-8 sequence.
*/
#define offsetsFromUTF8_0 0x00000000UL
#define offsetsFromUTF8_1 0x00003080UL
#define offsetsFromUTF8_2 0x000E2080UL
#define offsetsFromUTF8_3 0x03C82080UL
#define offsetsFromUTF8_4 0xFA082080UL
#define offsetsFromUTF8_5 0x82082080UL
DECLSPEC void hc_enc_init (hc_enc_t *hc_enc)
{
hc_enc->pos = 0;
hc_enc->cbuf = 0;
hc_enc->clen = 0;
}
DECLSPEC int hc_enc_has_next (hc_enc_t *hc_enc, const int sz)
{
if (hc_enc->pos < sz) return 1;
if (hc_enc->clen) return 1;
return 0;
}
// Input buffer and Output buffer size has to be multiple of 4 and at least of size 4.
// The output buffer is not zero padded, so entire buffer has to be set all zero before entering this function or truncated afterwards.
DECLSPEC int hc_enc_next (hc_enc_t *hc_enc, const u32 *src_buf, const int src_len, const int src_sz, u32 *dst_buf, const int dst_sz)
{
const u8 *src_ptr = (const u8 *) src_buf;
u8 *dst_ptr = ( u8 *) dst_buf;
int src_pos = hc_enc->pos;
int dst_pos = hc_enc->clen;
dst_buf[0] = hc_enc->cbuf;
hc_enc->clen = 0;
hc_enc->cbuf = 0;
while ((src_pos < src_len) && (dst_pos < dst_sz))
{
const u8 c = src_ptr[src_pos];
int extraBytesToRead = 0;
if (c >= 0xfc)
{
extraBytesToRead = 5;
}
else if (c >= 0xf8)
{
extraBytesToRead = 4;
}
else if (c >= 0xf0)
{
extraBytesToRead = 3;
}
else if (c >= 0xe0)
{
extraBytesToRead = 2;
}
else if (c >= 0xc0)
{
extraBytesToRead = 1;
}
if ((src_pos + extraBytesToRead) >= src_sz)
{
// broken input
hc_enc->pos = src_len;
return dst_pos;
}
u32 ch = 0;
switch (extraBytesToRead)
{
case 5:
ch += src_ptr[src_pos++]; ch <<= 6; /* remember, illegal UTF-8 */
ch += src_ptr[src_pos++]; ch <<= 6; /* remember, illegal UTF-8 */
ch += src_ptr[src_pos++]; ch <<= 6;
ch += src_ptr[src_pos++]; ch <<= 6;
ch += src_ptr[src_pos++]; ch <<= 6;
ch += src_ptr[src_pos++];
ch -= offsetsFromUTF8_5;
break;
case 4:
ch += src_ptr[src_pos++]; ch <<= 6; /* remember, illegal UTF-8 */
ch += src_ptr[src_pos++]; ch <<= 6;
ch += src_ptr[src_pos++]; ch <<= 6;
ch += src_ptr[src_pos++]; ch <<= 6;
ch += src_ptr[src_pos++];
ch -= offsetsFromUTF8_4;
break;
case 3:
ch += src_ptr[src_pos++]; ch <<= 6;
ch += src_ptr[src_pos++]; ch <<= 6;
ch += src_ptr[src_pos++]; ch <<= 6;
ch += src_ptr[src_pos++];
ch -= offsetsFromUTF8_3;
break;
case 2:
ch += src_ptr[src_pos++]; ch <<= 6;
ch += src_ptr[src_pos++]; ch <<= 6;
ch += src_ptr[src_pos++];
ch -= offsetsFromUTF8_2;
break;
case 1:
ch += src_ptr[src_pos++]; ch <<= 6;
ch += src_ptr[src_pos++];
ch -= offsetsFromUTF8_1;
break;
case 0:
ch += src_ptr[src_pos++];
ch -= offsetsFromUTF8_0;
break;
}
/* Target is a character <= 0xFFFF */
if (ch <= UNI_MAX_BMP)
{
dst_ptr[dst_pos++] = (ch >> 0) & 0xff;
dst_ptr[dst_pos++] = (ch >> 8) & 0xff;
}
else
{
ch -= halfBase;
const u32 a = ((ch >> halfShift) + UNI_SUR_HIGH_START);
const u32 b = ((ch & halfMask) + UNI_SUR_LOW_START);
if ((dst_pos + 2) == dst_sz)
{
dst_ptr[dst_pos++] = (a >> 0) & 0xff;
dst_ptr[dst_pos++] = (a >> 8) & 0xff;
hc_enc->cbuf = b & 0xffff;
hc_enc->clen = 2;
}
else
{
dst_ptr[dst_pos++] = (a >> 0) & 0xff;
dst_ptr[dst_pos++] = (a >> 8) & 0xff;
dst_ptr[dst_pos++] = (b >> 0) & 0xff;
dst_ptr[dst_pos++] = (b >> 8) & 0xff;
}
}
}
hc_enc->pos = src_pos;
return dst_pos;
}
DECLSPEC int hc_enc_next_global (hc_enc_t *hc_enc, GLOBAL_AS const u32 *src_buf, const int src_len, const int src_sz, u32 *dst_buf, const int dst_sz)
{
GLOBAL_AS const u8 *src_ptr = (GLOBAL_AS const u8 *) src_buf;
u8 *dst_ptr = ( u8 *) dst_buf;
int src_pos = hc_enc->pos;
int dst_pos = hc_enc->clen;
dst_buf[0] = hc_enc->cbuf;
hc_enc->clen = 0;
hc_enc->cbuf = 0;
while ((src_pos < src_len) && (dst_pos < dst_sz))
{
const u8 c = src_ptr[src_pos];
int extraBytesToRead = 0;
if (c >= 0xfc)
{
extraBytesToRead = 5;
}
else if (c >= 0xf8)
{
extraBytesToRead = 4;
}
else if (c >= 0xf0)
{
extraBytesToRead = 3;
}
else if (c >= 0xe0)
{
extraBytesToRead = 2;
}
else if (c >= 0xc0)
{
extraBytesToRead = 1;
}
if ((src_pos + extraBytesToRead) >= src_sz)
{
// broken input
hc_enc->pos = src_len;
return dst_pos;
}
u32 ch = 0;
switch (extraBytesToRead)
{
case 5:
ch += src_ptr[src_pos++]; ch <<= 6; /* remember, illegal UTF-8 */
ch += src_ptr[src_pos++]; ch <<= 6; /* remember, illegal UTF-8 */
ch += src_ptr[src_pos++]; ch <<= 6;
ch += src_ptr[src_pos++]; ch <<= 6;
ch += src_ptr[src_pos++]; ch <<= 6;
ch += src_ptr[src_pos++];
ch -= offsetsFromUTF8_5;
break;
case 4:
ch += src_ptr[src_pos++]; ch <<= 6; /* remember, illegal UTF-8 */
ch += src_ptr[src_pos++]; ch <<= 6;
ch += src_ptr[src_pos++]; ch <<= 6;
ch += src_ptr[src_pos++]; ch <<= 6;
ch += src_ptr[src_pos++];
ch -= offsetsFromUTF8_4;
break;
case 3:
ch += src_ptr[src_pos++]; ch <<= 6;
ch += src_ptr[src_pos++]; ch <<= 6;
ch += src_ptr[src_pos++]; ch <<= 6;
ch += src_ptr[src_pos++];
ch -= offsetsFromUTF8_3;
break;
case 2:
ch += src_ptr[src_pos++]; ch <<= 6;
ch += src_ptr[src_pos++]; ch <<= 6;
ch += src_ptr[src_pos++];
ch -= offsetsFromUTF8_2;
break;
case 1:
ch += src_ptr[src_pos++]; ch <<= 6;
ch += src_ptr[src_pos++];
ch -= offsetsFromUTF8_1;
break;
case 0:
ch += src_ptr[src_pos++];
ch -= offsetsFromUTF8_0;
break;
}
/* Target is a character <= 0xFFFF */
if (ch <= UNI_MAX_BMP)
{
dst_ptr[dst_pos++] = (ch >> 0) & 0xff;
dst_ptr[dst_pos++] = (ch >> 8) & 0xff;
}
else
{
ch -= halfBase;
const u32 a = ((ch >> halfShift) + UNI_SUR_HIGH_START);
const u32 b = ((ch & halfMask) + UNI_SUR_LOW_START);
if ((dst_pos + 2) == dst_sz)
{
dst_ptr[dst_pos++] = (a >> 0) & 0xff;
dst_ptr[dst_pos++] = (a >> 8) & 0xff;
hc_enc->cbuf = b & 0xffff;
hc_enc->clen = 2;
}
else
{
dst_ptr[dst_pos++] = (a >> 0) & 0xff;
dst_ptr[dst_pos++] = (a >> 8) & 0xff;
dst_ptr[dst_pos++] = (b >> 0) & 0xff;
dst_ptr[dst_pos++] = (b >> 8) & 0xff;
}
}
}
hc_enc->pos = src_pos;
return dst_pos;
}
#undef halfShift
#undef halfBase
#undef halfMask
#undef UNI_MAX_BMP
#undef UNI_SUR_HIGH_START
#undef UNI_SUR_HIGH_END
#undef UNI_SUR_LOW_START
#undef UNI_SUR_LOW_END
#undef offsetsFromUTF8_0
#undef offsetsFromUTF8_1
#undef offsetsFromUTF8_2
#undef offsetsFromUTF8_3
#undef offsetsFromUTF8_4
#undef offsetsFromUTF8_5
DECLSPEC int pkcs_padding_bs8 (const u32 *data_buf, const int data_len)
{
if (data_len == 0) return -1; // cannot have zero length, is important to avoid out of boundary reads
if (data_len % 8) return -1; // has to be a multiple of block size
const int last_pad_pos = data_len - 1;
const int last_pad_elem = last_pad_pos / 4;
const u32 pad = data_buf[last_pad_elem] >> 24; // guaranteed by pkcs structure
if ((pad < 1) || (pad > 8)) return -1; // pkcs pads are not zero based
const u32 padm = (pad << 0)
| (pad << 8)
| (pad << 16)
| (pad << 24);
u32 mask0 = 0;
u32 mask1 = 0;
switch (pad)
{
case 1: mask0 = 0x00000000; mask1 = 0xff000000; break;
case 2: mask0 = 0x00000000; mask1 = 0xffff0000; break;
case 3: mask0 = 0x00000000; mask1 = 0xffffff00; break;
case 4: mask0 = 0x00000000; mask1 = 0xffffffff; break;
case 5: mask0 = 0xff000000; mask1 = 0xffffffff; break;
case 6: mask0 = 0xffff0000; mask1 = 0xffffffff; break;
case 7: mask0 = 0xffffff00; mask1 = 0xffffffff; break;
case 8: mask0 = 0xffffffff; mask1 = 0xffffffff; break;
}
const u32 data0 = data_buf[last_pad_elem - 1];
const u32 data1 = data_buf[last_pad_elem - 0];
if ((data0 & mask0) != (padm & mask0)) return -1;
if ((data1 & mask1) != (padm & mask1)) return -1;
const int real_len = data_len - pad;
return real_len;
}
DECLSPEC int pkcs_padding_bs16 (const u32 *data_buf, const int data_len)
{
if (data_len == 0) return -1; // cannot have zero length, is important to avoid out of boundary reads
if (data_len % 16) return -1; // has to be a multiple of block size
const int last_pad_pos = data_len - 1;
const int last_pad_elem = last_pad_pos / 4;
const u32 pad = data_buf[last_pad_elem] >> 24; // guaranteed by pkcs structure
if ((pad < 1) || (pad > 16)) return -1; // pkcs pads are not zero based
const u32 padm = (pad << 0)
| (pad << 8)
| (pad << 16)
| (pad << 24);
u32 mask0 = 0;
u32 mask1 = 0;
u32 mask2 = 0;
u32 mask3 = 0;
switch (pad)
{
case 1: mask0 = 0x00000000; mask1 = 0x00000000; mask2 = 0x00000000; mask3 = 0xff000000; break;
case 2: mask0 = 0x00000000; mask1 = 0x00000000; mask2 = 0x00000000; mask3 = 0xffff0000; break;
case 3: mask0 = 0x00000000; mask1 = 0x00000000; mask2 = 0x00000000; mask3 = 0xffffff00; break;
case 4: mask0 = 0x00000000; mask1 = 0x00000000; mask2 = 0x00000000; mask3 = 0xffffffff; break;
case 5: mask0 = 0x00000000; mask1 = 0x00000000; mask2 = 0xff000000; mask3 = 0xffffffff; break;
case 6: mask0 = 0x00000000; mask1 = 0x00000000; mask2 = 0xffff0000; mask3 = 0xffffffff; break;
case 7: mask0 = 0x00000000; mask1 = 0x00000000; mask2 = 0xffffff00; mask3 = 0xffffffff; break;
case 8: mask0 = 0x00000000; mask1 = 0x00000000; mask2 = 0xffffffff; mask3 = 0xffffffff; break;
case 9: mask0 = 0x00000000; mask1 = 0xff000000; mask2 = 0xffffffff; mask3 = 0xffffffff; break;
case 10: mask0 = 0x00000000; mask1 = 0xffff0000; mask2 = 0xffffffff; mask3 = 0xffffffff; break;
case 11: mask0 = 0x00000000; mask1 = 0xffffff00; mask2 = 0xffffffff; mask3 = 0xffffffff; break;
case 12: mask0 = 0x00000000; mask1 = 0xffffffff; mask2 = 0xffffffff; mask3 = 0xffffffff; break;
case 13: mask0 = 0xff000000; mask1 = 0xffffffff; mask2 = 0xffffffff; mask3 = 0xffffffff; break;
case 14: mask0 = 0xffff0000; mask1 = 0xffffffff; mask2 = 0xffffffff; mask3 = 0xffffffff; break;
case 15: mask0 = 0xffffff00; mask1 = 0xffffffff; mask2 = 0xffffffff; mask3 = 0xffffffff; break;
case 16: mask0 = 0xffffffff; mask1 = 0xffffffff; mask2 = 0xffffffff; mask3 = 0xffffffff; break;
}
const u32 data0 = data_buf[last_pad_elem - 3];
const u32 data1 = data_buf[last_pad_elem - 2];
const u32 data2 = data_buf[last_pad_elem - 1];
const u32 data3 = data_buf[last_pad_elem - 0];
if ((data0 & mask0) != (padm & mask0)) return -1;
if ((data1 & mask1) != (padm & mask1)) return -1;
if ((data2 & mask2) != (padm & mask2)) return -1;
if ((data3 & mask3) != (padm & mask3)) return -1;
const int real_len = data_len - pad;
return real_len;
}
DECLSPEC int asn1_detect (const u32 *buf, const int len)
{
if (len < 128)
{
if ((buf[0] & 0x00ff80ff) != 0x00020030) return 0;
}
else if (len < 256)
{
if ((buf[0] & 0xff00ffff) != 0x02008130) return 0;
}
else if (len < 65536)
{
if ((buf[0] & 0x0000ffff) != 0x00008230) return 0;
if ((buf[1] & 0x000000ff) != 0x00000002) return 0;
}
if (len < 128)
{
const int lenb = ((buf[0] & 0x00007f00) >> 8);
if ((lenb + 2) != len) return 0;
}
else if (len < 256)
{
const int lenb = ((buf[0] & 0x00ff0000) >> 16);
if ((lenb + 3) != len) return 0;
}
else if (len < 65536)
{
const int lenb = ((buf[0] & 0xff000000) >> 24)
| ((buf[0] & 0x00ff0000) >> 8);
if ((lenb + 4) != len) return 0;
}
return 1;
}
DECLSPEC u32 check_bitmap (GLOBAL_AS const u32 *bitmap, const u32 bitmap_mask, const u32 bitmap_shift, const u32 digest)
{
return (bitmap[(digest >> bitmap_shift) & bitmap_mask] & (1 << (digest & 0x1f)));
@ -2007,17 +2508,21 @@ DECLSPEC u32 check (const u32 *digest, GLOBAL_AS const u32 *bitmap_s1_a, GLOBAL_
DECLSPEC void mark_hash (GLOBAL_AS plain_t *plains_buf, GLOBAL_AS u32 *d_result, const u32 salt_pos, const u32 digests_cnt, const u32 digest_pos, const u32 hash_pos, const u64 gid, const u32 il_pos, const u32 extra1, const u32 extra2)
{
const u32 idx = atomic_inc (d_result);
const u32 idx = hc_atomic_inc (d_result);
#if ATTACK_MODE == 9
#else
if (idx >= digests_cnt)
{
// this is kind of tricky: we *must* call atomic_inc() to know about the current value from a multi-thread perspective
// this is kind of tricky: we *must* call hc_atomic_inc() to know about the current value from a multi-thread perspective
// this action creates a buffer overflow, so we need to fix it here
atomic_dec (d_result);
hc_atomic_dec (d_result);
return;
}
#endif
plains_buf[idx].salt_pos = salt_pos;
plains_buf[idx].digest_pos = digest_pos; // relative
@ -2126,34 +2631,15 @@ DECLSPEC int hc_find_keyboard_layout_map (const u32 search, const int search_len
return -1;
}
DECLSPEC int hc_execute_keyboard_layout_mapping (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int pw_len, LOCAL_AS keyboard_layout_mapping_t *s_keyboard_layout_mapping_buf, const int keyboard_layout_mapping_cnt)
DECLSPEC int hc_execute_keyboard_layout_mapping (u32 *w, const int pw_len, LOCAL_AS keyboard_layout_mapping_t *s_keyboard_layout_mapping_buf, const int keyboard_layout_mapping_cnt)
{
u32 out_buf[16] = { 0 };
u32 out_buf[32] = { 0 };
u8 *out_ptr = (u8 *) out_buf;
int out_len = 0;
// TC/VC passwords are limited to 64
u32 w[16];
w[ 0] = w0[0];
w[ 1] = w0[1];
w[ 2] = w0[2];
w[ 3] = w0[3];
w[ 4] = w1[0];
w[ 5] = w1[1];
w[ 6] = w1[2];
w[ 7] = w1[3];
w[ 8] = w2[0];
w[ 9] = w2[1];
w[10] = w2[2];
w[11] = w2[3];
w[12] = w3[0];
w[13] = w3[1];
w[14] = w3[2];
w[15] = w3[3];
// TC/VC passwords are limited to 128
u8 *w_ptr = (u8 *) w;
@ -2232,22 +2718,38 @@ DECLSPEC int hc_execute_keyboard_layout_mapping (u32 *w0, u32 *w1, u32 *w2, u32
}
}
w0[0] = out_buf[ 0];
w0[1] = out_buf[ 1];
w0[2] = out_buf[ 2];
w0[3] = out_buf[ 3];
w1[0] = out_buf[ 4];
w1[1] = out_buf[ 5];
w1[2] = out_buf[ 6];
w1[3] = out_buf[ 7];
w2[0] = out_buf[ 8];
w2[1] = out_buf[ 9];
w2[2] = out_buf[10];
w2[3] = out_buf[11];
w3[0] = out_buf[12];
w3[1] = out_buf[13];
w3[2] = out_buf[14];
w3[3] = out_buf[15];
w[ 0] = out_buf[ 0];
w[ 1] = out_buf[ 1];
w[ 2] = out_buf[ 2];
w[ 3] = out_buf[ 3];
w[ 4] = out_buf[ 4];
w[ 5] = out_buf[ 5];
w[ 6] = out_buf[ 6];
w[ 7] = out_buf[ 7];
w[ 8] = out_buf[ 8];
w[ 9] = out_buf[ 9];
w[10] = out_buf[10];
w[11] = out_buf[11];
w[12] = out_buf[12];
w[13] = out_buf[13];
w[14] = out_buf[14];
w[15] = out_buf[15];
w[16] = out_buf[16];
w[17] = out_buf[17];
w[18] = out_buf[18];
w[19] = out_buf[19];
w[20] = out_buf[20];
w[21] = out_buf[21];
w[22] = out_buf[22];
w[23] = out_buf[23];
w[24] = out_buf[24];
w[25] = out_buf[25];
w[26] = out_buf[26];
w[27] = out_buf[27];
w[28] = out_buf[28];
w[29] = out_buf[29];
w[30] = out_buf[30];
w[31] = out_buf[31];
return out_len;
}

View File

@ -27,80 +27,85 @@
*/
#if defined IS_CUDA || defined IS_HIP
#define KERN_ATTR(p2,p4,p5,p6,p19) \
MAYBE_UNUSED GLOBAL_AS pw_t *pws, \
MAYBE_UNUSED p2 const kernel_rule_t *g_rules_buf, \
MAYBE_UNUSED GLOBAL_AS const pw_t *combs_buf, \
MAYBE_UNUSED p4, \
MAYBE_UNUSED GLOBAL_AS p5 *tmps, \
MAYBE_UNUSED GLOBAL_AS p6 *hooks, \
MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s1_a, \
MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s1_b, \
MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s1_c, \
MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s1_d, \
MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s2_a, \
MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s2_b, \
MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s2_c, \
MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s2_d, \
MAYBE_UNUSED GLOBAL_AS plain_t *plains_buf, \
MAYBE_UNUSED GLOBAL_AS const digest_t *digests_buf, \
MAYBE_UNUSED GLOBAL_AS u32 *hashes_shown, \
MAYBE_UNUSED GLOBAL_AS const salt_t *salt_bufs, \
MAYBE_UNUSED GLOBAL_AS const p19 *esalt_bufs, \
MAYBE_UNUSED GLOBAL_AS u32 *d_return_buf, \
MAYBE_UNUSED GLOBAL_AS void *d_extra0_buf, \
MAYBE_UNUSED GLOBAL_AS void *d_extra1_buf, \
MAYBE_UNUSED GLOBAL_AS void *d_extra2_buf, \
MAYBE_UNUSED GLOBAL_AS void *d_extra3_buf, \
MAYBE_UNUSED const u32 bitmap_mask, \
MAYBE_UNUSED const u32 bitmap_shift1, \
MAYBE_UNUSED const u32 bitmap_shift2, \
MAYBE_UNUSED const u32 salt_pos, \
MAYBE_UNUSED const u32 loop_pos, \
MAYBE_UNUSED const u32 loop_cnt, \
MAYBE_UNUSED const u32 il_cnt, \
MAYBE_UNUSED const u32 digests_cnt, \
MAYBE_UNUSED const u32 digests_offset, \
MAYBE_UNUSED const u32 combs_mode, \
#define KERN_ATTR(p2,p4,p5,p6,p19) \
MAYBE_UNUSED GLOBAL_AS pw_t *pws, \
MAYBE_UNUSED p2 const kernel_rule_t *g_rules_buf, \
MAYBE_UNUSED GLOBAL_AS const pw_t *combs_buf, \
MAYBE_UNUSED p4, \
MAYBE_UNUSED GLOBAL_AS p5 *tmps, \
MAYBE_UNUSED GLOBAL_AS p6 *hooks, \
MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s1_a, \
MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s1_b, \
MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s1_c, \
MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s1_d, \
MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s2_a, \
MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s2_b, \
MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s2_c, \
MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s2_d, \
MAYBE_UNUSED GLOBAL_AS plain_t *plains_buf, \
MAYBE_UNUSED GLOBAL_AS const digest_t *digests_buf, \
MAYBE_UNUSED GLOBAL_AS u32 *hashes_shown, \
MAYBE_UNUSED GLOBAL_AS const salt_t *salt_bufs, \
MAYBE_UNUSED GLOBAL_AS const p19 *esalt_bufs, \
MAYBE_UNUSED GLOBAL_AS u32 *d_return_buf, \
MAYBE_UNUSED GLOBAL_AS void *d_extra0_buf, \
MAYBE_UNUSED GLOBAL_AS void *d_extra1_buf, \
MAYBE_UNUSED GLOBAL_AS void *d_extra2_buf, \
MAYBE_UNUSED GLOBAL_AS void *d_extra3_buf, \
MAYBE_UNUSED const u32 bitmap_mask, \
MAYBE_UNUSED const u32 bitmap_shift1, \
MAYBE_UNUSED const u32 bitmap_shift2, \
MAYBE_UNUSED const u32 salt_pos_host, \
MAYBE_UNUSED const u32 loop_pos, \
MAYBE_UNUSED const u32 loop_cnt, \
MAYBE_UNUSED const u32 il_cnt, \
MAYBE_UNUSED const u32 digests_cnt, \
MAYBE_UNUSED const u32 digests_offset_host, \
MAYBE_UNUSED const u32 combs_mode, \
MAYBE_UNUSED const u32 salt_repeat, \
MAYBE_UNUSED const u64 pws_pos, \
MAYBE_UNUSED const u64 gid_max
#else
#define KERN_ATTR(p2,p4,p5,p6,p19) \
MAYBE_UNUSED GLOBAL_AS pw_t *pws, \
MAYBE_UNUSED p2 const kernel_rule_t *rules_buf, \
MAYBE_UNUSED GLOBAL_AS const pw_t *combs_buf, \
MAYBE_UNUSED p4, \
MAYBE_UNUSED GLOBAL_AS p5 *tmps, \
MAYBE_UNUSED GLOBAL_AS p6 *hooks, \
MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s1_a, \
MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s1_b, \
MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s1_c, \
MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s1_d, \
MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s2_a, \
MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s2_b, \
MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s2_c, \
MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s2_d, \
MAYBE_UNUSED GLOBAL_AS plain_t *plains_buf, \
MAYBE_UNUSED GLOBAL_AS const digest_t *digests_buf, \
MAYBE_UNUSED GLOBAL_AS u32 *hashes_shown, \
MAYBE_UNUSED GLOBAL_AS const salt_t *salt_bufs, \
MAYBE_UNUSED GLOBAL_AS const p19 *esalt_bufs, \
MAYBE_UNUSED GLOBAL_AS u32 *d_return_buf, \
MAYBE_UNUSED GLOBAL_AS void *d_extra0_buf, \
MAYBE_UNUSED GLOBAL_AS void *d_extra1_buf, \
MAYBE_UNUSED GLOBAL_AS void *d_extra2_buf, \
MAYBE_UNUSED GLOBAL_AS void *d_extra3_buf, \
MAYBE_UNUSED const u32 bitmap_mask, \
MAYBE_UNUSED const u32 bitmap_shift1, \
MAYBE_UNUSED const u32 bitmap_shift2, \
MAYBE_UNUSED const u32 salt_pos, \
MAYBE_UNUSED const u32 loop_pos, \
MAYBE_UNUSED const u32 loop_cnt, \
MAYBE_UNUSED const u32 il_cnt, \
MAYBE_UNUSED const u32 digests_cnt, \
MAYBE_UNUSED const u32 digests_offset, \
MAYBE_UNUSED const u32 combs_mode, \
#define KERN_ATTR(p2,p4,p5,p6,p19) \
MAYBE_UNUSED GLOBAL_AS pw_t *pws, \
MAYBE_UNUSED p2 const kernel_rule_t *rules_buf, \
MAYBE_UNUSED GLOBAL_AS const pw_t *combs_buf, \
MAYBE_UNUSED p4, \
MAYBE_UNUSED GLOBAL_AS p5 *tmps, \
MAYBE_UNUSED GLOBAL_AS p6 *hooks, \
MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s1_a, \
MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s1_b, \
MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s1_c, \
MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s1_d, \
MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s2_a, \
MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s2_b, \
MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s2_c, \
MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s2_d, \
MAYBE_UNUSED GLOBAL_AS plain_t *plains_buf, \
MAYBE_UNUSED GLOBAL_AS const digest_t *digests_buf, \
MAYBE_UNUSED GLOBAL_AS u32 *hashes_shown, \
MAYBE_UNUSED GLOBAL_AS const salt_t *salt_bufs, \
MAYBE_UNUSED GLOBAL_AS const p19 *esalt_bufs, \
MAYBE_UNUSED GLOBAL_AS u32 *d_return_buf, \
MAYBE_UNUSED GLOBAL_AS void *d_extra0_buf, \
MAYBE_UNUSED GLOBAL_AS void *d_extra1_buf, \
MAYBE_UNUSED GLOBAL_AS void *d_extra2_buf, \
MAYBE_UNUSED GLOBAL_AS void *d_extra3_buf, \
MAYBE_UNUSED const u32 bitmap_mask, \
MAYBE_UNUSED const u32 bitmap_shift1, \
MAYBE_UNUSED const u32 bitmap_shift2, \
MAYBE_UNUSED const u32 salt_pos_host, \
MAYBE_UNUSED const u32 loop_pos, \
MAYBE_UNUSED const u32 loop_cnt, \
MAYBE_UNUSED const u32 il_cnt, \
MAYBE_UNUSED const u32 digests_cnt, \
MAYBE_UNUSED const u32 digests_offset_host, \
MAYBE_UNUSED const u32 combs_mode, \
MAYBE_UNUSED const u32 salt_repeat, \
MAYBE_UNUSED const u64 pws_pos, \
MAYBE_UNUSED const u64 gid_max
#endif
/*
* Shortcut macros for usage in the actual kernels
*
@ -232,6 +237,16 @@ DECLSPEC int hash_comp (const u32 *d1, GLOBAL_AS const u32 *d2);
DECLSPEC int find_hash (const u32 *digest, const u32 digests_cnt, GLOBAL_AS const digest_t *digests_buf);
#endif
DECLSPEC int hc_enc_scan (const u32 *buf, const int len);
DECLSPEC int hc_enc_scan_global (GLOBAL_AS const u32 *buf, const int len);
DECLSPEC void hc_enc_init (hc_enc_t *hc_enc);
DECLSPEC int hc_enc_has_next (hc_enc_t *hc_enc, const int sz);
DECLSPEC int hc_enc_next (hc_enc_t *hc_enc, const u32 *src_buf, const int src_len, const int src_sz, u32 *dst_buf, const int dst_sz);
DECLSPEC int hc_enc_next_global (hc_enc_t *hc_enc, GLOBAL_AS const u32 *src_buf, const int src_len, const int src_sz, u32 *dst_buf, const int dst_sz);
DECLSPEC int pkcs_padding_bs8 (const u32 *data_buf, const int data_len);
DECLSPEC int pkcs_padding_bs16 (const u32 *data_buf, const int data_len);
DECLSPEC int asn1_detect (const u32 *buf, const int len);
DECLSPEC u32 check_bitmap (GLOBAL_AS const u32 *bitmap, const u32 bitmap_mask, const u32 bitmap_shift, const u32 digest);
DECLSPEC u32 check (const u32 *digest, GLOBAL_AS const u32 *bitmap_s1_a, GLOBAL_AS const u32 *bitmap_s1_b, GLOBAL_AS const u32 *bitmap_s1_c, GLOBAL_AS const u32 *bitmap_s1_d, GLOBAL_AS const u32 *bitmap_s2_a, GLOBAL_AS const u32 *bitmap_s2_b, GLOBAL_AS const u32 *bitmap_s2_c, GLOBAL_AS const u32 *bitmap_s2_d, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2);
DECLSPEC void mark_hash (GLOBAL_AS plain_t *plains_buf, GLOBAL_AS u32 *d_result, const u32 salt_pos, const u32 digests_cnt, const u32 digest_pos, const u32 hash_pos, const u64 gid, const u32 il_pos, const u32 extra1, const u32 extra2);
@ -242,7 +257,7 @@ DECLSPEC int is_valid_hex_32 (const u32 v);
DECLSPEC int is_valid_base58_8 (const u8 v);
DECLSPEC int is_valid_base58_32 (const u32 v);
DECLSPEC int hc_find_keyboard_layout_map (const u32 search, const int search_len, LOCAL_AS keyboard_layout_mapping_t *s_keyboard_layout_mapping_buf, const int keyboard_layout_mapping_cnt);
DECLSPEC int hc_execute_keyboard_layout_mapping (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int pw_len, LOCAL_AS keyboard_layout_mapping_t *s_keyboard_layout_mapping_buf, const int keyboard_layout_mapping_cnt);
DECLSPEC int hc_execute_keyboard_layout_mapping (u32 *w, const int pw_len, LOCAL_AS keyboard_layout_mapping_t *s_keyboard_layout_mapping_buf, const int keyboard_layout_mapping_cnt);
DECLSPEC void make_utf16be (const u32x *in, u32x *out1, u32x *out2);
DECLSPEC void make_utf16beN (const u32x *in, u32x *out1, u32x *out2);
DECLSPEC void make_utf16le (const u32x *in, u32x *out1, u32x *out2);

View File

@ -18,15 +18,15 @@ if (check (digest_tp,
bitmap_shift1,
bitmap_shift2))
{
int digest_pos = find_hash (digest_tp, digests_cnt, &digests_buf[digests_offset]);
int digest_pos = find_hash (digest_tp, digests_cnt, &digests_buf[DIGESTS_OFFSET]);
if (digest_pos != -1)
{
const u32 final_hash_pos = digests_offset + digest_pos;
const u32 final_hash_pos = DIGESTS_OFFSET + digest_pos;
if (atomic_inc (&hashes_shown[final_hash_pos]) == 0)
if (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos, 0, 0);
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, digest_pos, final_hash_pos, gid, il_pos, 0, 0);
}
}
}

View File

@ -18,17 +18,17 @@ if (check (digest_tp,
bitmap_shift1,
bitmap_shift2))
{
int digest_pos = find_hash (digest_tp, digests_cnt, &digests_buf[digests_offset]);
int digest_pos = find_hash (digest_tp, digests_cnt, &digests_buf[DIGESTS_OFFSET]);
if (digest_pos != -1)
{
if ((il_pos + slice) < il_cnt)
{
const u32 final_hash_pos = digests_offset + digest_pos;
const u32 final_hash_pos = DIGESTS_OFFSET + digest_pos;
if (atomic_inc (&hashes_shown[final_hash_pos]) == 0)
if (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + slice, 0, 0);
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + slice, 0, 0);
}
}
}

View File

@ -3,10 +3,10 @@ if ((r0 == search[0])
&& (r2 == search[2])
&& (r3 == search[3]))
{
const u32 final_hash_pos = digests_offset + 0;
const u32 final_hash_pos = DIGESTS_OFFSET + 0;
if (atomic_inc (&hashes_shown[final_hash_pos]) == 0)
if (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos, 0, 0);
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, 0, final_hash_pos, gid, il_pos, 0, 0);
}
}

View File

@ -1,10 +1,10 @@
if ((il_pos + slice) < il_cnt)
{
const u32 final_hash_pos = digests_offset + 0;
const u32 final_hash_pos = DIGESTS_OFFSET + 0;
if (atomic_inc (&hashes_shown[final_hash_pos]) == 0)
if (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + slice, 0, 0);
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, 0, final_hash_pos, gid, il_pos + slice, 0, 0);
}
}

View File

@ -1730,14 +1730,16 @@ DECLSPEC void point_get_coords (secp256k1_t *r, const u32 *x, const u32 *y)
r->xy[95] = neg[7];
}
DECLSPEC void point_mul (u32 *r, const u32 *k, GLOBAL_AS const secp256k1_t *tmps)
/*
* Convert the tweak/scalar k to w-NAF (window size is 4).
* @param naf out: w-NAF form of the tweak/scalar, a pointer to an u32 array with a size of 33.
* @param k in: tweak/scalar which should be converted, a pointer to an u32 array with a size of 8.
* @return Returns the loop start index.
*/
DECLSPEC int convert_to_window_naf (u32 *naf, const u32 *k)
{
/*
* Convert the tweak/scalar k to w-NAF (window size is 4)
*/
int loop_start = 0;
u32 n[9];
n[0] = 0; // we need this extra slot sometimes for the subtraction to work
n[1] = k[7];
n[2] = k[6];
@ -1748,10 +1750,6 @@ DECLSPEC void point_mul (u32 *r, const u32 *k, GLOBAL_AS const secp256k1_t *tmps
n[7] = k[1];
n[8] = k[0];
u32 naf[32 + 1] = { 0 }; // we need one extra slot
int loop_start = 0;
for (int i = 0; i <= 256; i++)
{
if (n[8] & 1)
@ -1835,7 +1833,20 @@ DECLSPEC void point_mul (u32 *r, const u32 *k, GLOBAL_AS const secp256k1_t *tmps
n[1] = n[1] >> 1 | n[0] << 31;
n[0] = n[0] >> 1;
}
return loop_start;
}
/*
* @param x1 out: x coordinate, a pointer to an u32 array with a size of 8.
* @param y1 out: y coordinate, a pointer to an u32 array with a size of 8.
* @param k in: tweak/scalar which should be converted, a pointer to an u32 array with a size of 8.
* @param tmps in: a basepoint for the multiplication.
* @return Returns the x coordinate with a leading parity/sign (for odd/even y), it is named a compressed coordinate.
*/
DECLSPEC void point_mul_xy (u32 *x1, u32 *y1, const u32 *k, GLOBAL_AS const secp256k1_t *tmps)
{
u32 naf[SECP256K1_NAF_SIZE] = { 0 };
int loop_start = convert_to_window_naf(naf, k);
// first set:
@ -1846,7 +1857,6 @@ DECLSPEC void point_mul (u32 *r, const u32 *k, GLOBAL_AS const secp256k1_t *tmps
const u32 x_pos = ((multiplier - 1 + odd) >> 1) * 24;
const u32 y_pos = odd ? (x_pos + 8) : (x_pos + 16);
u32 x1[8];
x1[0] = tmps->xy[x_pos + 0];
x1[1] = tmps->xy[x_pos + 1];
@ -1857,8 +1867,6 @@ DECLSPEC void point_mul (u32 *r, const u32 *k, GLOBAL_AS const secp256k1_t *tmps
x1[6] = tmps->xy[x_pos + 6];
x1[7] = tmps->xy[x_pos + 7];
u32 y1[8];
y1[0] = tmps->xy[y_pos + 0];
y1[1] = tmps->xy[y_pos + 1];
y1[2] = tmps->xy[y_pos + 2];
@ -1966,51 +1974,51 @@ DECLSPEC void point_mul (u32 *r, const u32 *k, GLOBAL_AS const secp256k1_t *tmps
mul_mod (z1, z2, z1); // z1^3
mul_mod (y1, y1, z1); // y1_affine
// return values are already in x1 and y1
}
/*
* @param r out: x coordinate with leading parity/sign (for odd/even y), a pointer to an u32 array with a size of 9.
* @param k in: tweak/scalar which should be converted, a pointer to an u32 array with a size of 8.
* @param tmps in: a basepoint for the multiplication.
* @return Returns the x coordinate with a leading parity/sign (for odd/even y), it is named a compressed coordinate.
*/
DECLSPEC void point_mul (u32 *r, const u32 *k, GLOBAL_AS const secp256k1_t *tmps)
{
u32 x[8];
u32 y[8];
point_mul_xy(x, y, k, tmps);
/*
* output:
*/
// shift by 1 byte (8 bits) to make room and add the parity/sign (for odd/even y):
r[8] = (x1[0] << 24);
r[7] = (x1[0] >> 8) | (x1[1] << 24);
r[6] = (x1[1] >> 8) | (x1[2] << 24);
r[5] = (x1[2] >> 8) | (x1[3] << 24);
r[4] = (x1[3] >> 8) | (x1[4] << 24);
r[3] = (x1[4] >> 8) | (x1[5] << 24);
r[2] = (x1[5] >> 8) | (x1[6] << 24);
r[1] = (x1[6] >> 8) | (x1[7] << 24);
r[0] = (x1[7] >> 8);
r[8] = (x[0] << 24);
r[7] = (x[0] >> 8) | (x[1] << 24);
r[6] = (x[1] >> 8) | (x[2] << 24);
r[5] = (x[2] >> 8) | (x[3] << 24);
r[4] = (x[3] >> 8) | (x[4] << 24);
r[3] = (x[4] >> 8) | (x[5] << 24);
r[2] = (x[5] >> 8) | (x[6] << 24);
r[1] = (x[6] >> 8) | (x[7] << 24);
r[0] = (x[7] >> 8);
const u32 type = 0x02 | (y1[0] & 1); // (note: 0b10 | 0b01 = 0x03)
const u32 type = 0x02 | (y[0] & 1); // (note: 0b10 | 0b01 = 0x03)
r[0] = r[0] | type << 24; // 0x02 or 0x03
}
DECLSPEC u32 parse_public (secp256k1_t *r, const u32 *k)
/*
* Transform a x coordinate and separate parity to secp256k1_t.
* @param r out: x and y coordinates.
* @param x in: x coordinate which should be converted, a pointer to an u32 array with a size of 8.
* @param first_byte in: The parity of the y coordinate, a u32.
* @return Returns 0 if successfull, returns 1 if x is greater than the basepoint.
*/
DECLSPEC u32 transform_public (secp256k1_t *r, const u32 *x, const u32 first_byte)
{
// verify:
const u32 first_byte = k[0] & 0xff;
if ((first_byte != '\x02') && (first_byte != '\x03'))
{
return 1;
}
// load k into x without the first byte:
u32 x[8];
x[0] = (k[7] & 0xff00) << 16 | (k[7] & 0xff0000) | (k[7] & 0xff000000) >> 16 | (k[8] & 0xff);
x[1] = (k[6] & 0xff00) << 16 | (k[6] & 0xff0000) | (k[6] & 0xff000000) >> 16 | (k[7] & 0xff);
x[2] = (k[5] & 0xff00) << 16 | (k[5] & 0xff0000) | (k[5] & 0xff000000) >> 16 | (k[6] & 0xff);
x[3] = (k[4] & 0xff00) << 16 | (k[4] & 0xff0000) | (k[4] & 0xff000000) >> 16 | (k[5] & 0xff);
x[4] = (k[3] & 0xff00) << 16 | (k[3] & 0xff0000) | (k[3] & 0xff000000) >> 16 | (k[4] & 0xff);
x[5] = (k[2] & 0xff00) << 16 | (k[2] & 0xff0000) | (k[2] & 0xff000000) >> 16 | (k[3] & 0xff);
x[6] = (k[1] & 0xff00) << 16 | (k[1] & 0xff0000) | (k[1] & 0xff000000) >> 16 | (k[2] & 0xff);
x[7] = (k[0] & 0xff00) << 16 | (k[0] & 0xff0000) | (k[0] & 0xff000000) >> 16 | (k[1] & 0xff);
u32 p[8];
p[0] = SECP256K1_P0;
@ -2062,3 +2070,163 @@ DECLSPEC u32 parse_public (secp256k1_t *r, const u32 *k)
return 0;
}
/*
* Parse a x coordinate with leading parity to secp256k1_t.
* @param r out: x and y coordinates.
* @param k in: x coordinate which should be converted with leading parity, a pointer to an u32 array with a size of 9.
* @return Returns 0 if successfull, returns 1 if x is greater than the basepoint or the parity has an unexpected value.
*/
DECLSPEC u32 parse_public (secp256k1_t *r, const u32 *k)
{
// verify:
const u32 first_byte = k[0] & 0xff;
if ((first_byte != '\x02') && (first_byte != '\x03'))
{
return 1;
}
// load k into x without the first byte:
u32 x[8];
x[0] = (k[7] & 0xff00) << 16 | (k[7] & 0xff0000) | (k[7] & 0xff000000) >> 16 | (k[8] & 0xff);
x[1] = (k[6] & 0xff00) << 16 | (k[6] & 0xff0000) | (k[6] & 0xff000000) >> 16 | (k[7] & 0xff);
x[2] = (k[5] & 0xff00) << 16 | (k[5] & 0xff0000) | (k[5] & 0xff000000) >> 16 | (k[6] & 0xff);
x[3] = (k[4] & 0xff00) << 16 | (k[4] & 0xff0000) | (k[4] & 0xff000000) >> 16 | (k[5] & 0xff);
x[4] = (k[3] & 0xff00) << 16 | (k[3] & 0xff0000) | (k[3] & 0xff000000) >> 16 | (k[4] & 0xff);
x[5] = (k[2] & 0xff00) << 16 | (k[2] & 0xff0000) | (k[2] & 0xff000000) >> 16 | (k[3] & 0xff);
x[6] = (k[1] & 0xff00) << 16 | (k[1] & 0xff0000) | (k[1] & 0xff000000) >> 16 | (k[2] & 0xff);
x[7] = (k[0] & 0xff00) << 16 | (k[0] & 0xff0000) | (k[0] & 0xff000000) >> 16 | (k[1] & 0xff);
return transform_public(r, x, first_byte);
}
/*
* Set precomputed values of the basepoint g to a secp256k1 structure.
* @param r out: x and y coordinates. pre-computed points: (x1,y1,-y1),(x3,y3,-y3),(x5,y5,-y5),(x7,y7,-y7)
*/
DECLSPEC void set_precomputed_basepoint_g (secp256k1_t *r) {
// x1
r->xy[ 0] = SECP256K1_G_PRE_COMPUTED_00;
r->xy[ 1] = SECP256K1_G_PRE_COMPUTED_01;
r->xy[ 2] = SECP256K1_G_PRE_COMPUTED_02;
r->xy[ 3] = SECP256K1_G_PRE_COMPUTED_03;
r->xy[ 4] = SECP256K1_G_PRE_COMPUTED_04;
r->xy[ 5] = SECP256K1_G_PRE_COMPUTED_05;
r->xy[ 6] = SECP256K1_G_PRE_COMPUTED_06;
r->xy[ 7] = SECP256K1_G_PRE_COMPUTED_07;
// y1
r->xy[ 8] = SECP256K1_G_PRE_COMPUTED_08;
r->xy[ 9] = SECP256K1_G_PRE_COMPUTED_09;
r->xy[10] = SECP256K1_G_PRE_COMPUTED_10;
r->xy[11] = SECP256K1_G_PRE_COMPUTED_11;
r->xy[12] = SECP256K1_G_PRE_COMPUTED_12;
r->xy[13] = SECP256K1_G_PRE_COMPUTED_13;
r->xy[14] = SECP256K1_G_PRE_COMPUTED_14;
r->xy[15] = SECP256K1_G_PRE_COMPUTED_15;
// -y1
r->xy[16] = SECP256K1_G_PRE_COMPUTED_16;
r->xy[17] = SECP256K1_G_PRE_COMPUTED_17;
r->xy[18] = SECP256K1_G_PRE_COMPUTED_18;
r->xy[19] = SECP256K1_G_PRE_COMPUTED_19;
r->xy[20] = SECP256K1_G_PRE_COMPUTED_20;
r->xy[21] = SECP256K1_G_PRE_COMPUTED_21;
r->xy[22] = SECP256K1_G_PRE_COMPUTED_22;
r->xy[23] = SECP256K1_G_PRE_COMPUTED_23;
// x3
r->xy[24] = SECP256K1_G_PRE_COMPUTED_24;
r->xy[25] = SECP256K1_G_PRE_COMPUTED_25;
r->xy[26] = SECP256K1_G_PRE_COMPUTED_26;
r->xy[27] = SECP256K1_G_PRE_COMPUTED_27;
r->xy[28] = SECP256K1_G_PRE_COMPUTED_28;
r->xy[29] = SECP256K1_G_PRE_COMPUTED_29;
r->xy[30] = SECP256K1_G_PRE_COMPUTED_30;
r->xy[31] = SECP256K1_G_PRE_COMPUTED_31;
// y3
r->xy[32] = SECP256K1_G_PRE_COMPUTED_32;
r->xy[33] = SECP256K1_G_PRE_COMPUTED_33;
r->xy[34] = SECP256K1_G_PRE_COMPUTED_34;
r->xy[35] = SECP256K1_G_PRE_COMPUTED_35;
r->xy[36] = SECP256K1_G_PRE_COMPUTED_36;
r->xy[37] = SECP256K1_G_PRE_COMPUTED_37;
r->xy[38] = SECP256K1_G_PRE_COMPUTED_38;
r->xy[39] = SECP256K1_G_PRE_COMPUTED_39;
// -y3
r->xy[40] = SECP256K1_G_PRE_COMPUTED_40;
r->xy[41] = SECP256K1_G_PRE_COMPUTED_41;
r->xy[42] = SECP256K1_G_PRE_COMPUTED_42;
r->xy[43] = SECP256K1_G_PRE_COMPUTED_43;
r->xy[44] = SECP256K1_G_PRE_COMPUTED_44;
r->xy[45] = SECP256K1_G_PRE_COMPUTED_45;
r->xy[46] = SECP256K1_G_PRE_COMPUTED_46;
r->xy[47] = SECP256K1_G_PRE_COMPUTED_47;
// x5
r->xy[48] = SECP256K1_G_PRE_COMPUTED_48;
r->xy[49] = SECP256K1_G_PRE_COMPUTED_49;
r->xy[50] = SECP256K1_G_PRE_COMPUTED_50;
r->xy[51] = SECP256K1_G_PRE_COMPUTED_51;
r->xy[52] = SECP256K1_G_PRE_COMPUTED_52;
r->xy[53] = SECP256K1_G_PRE_COMPUTED_53;
r->xy[54] = SECP256K1_G_PRE_COMPUTED_54;
r->xy[55] = SECP256K1_G_PRE_COMPUTED_55;
// y5
r->xy[56] = SECP256K1_G_PRE_COMPUTED_56;
r->xy[57] = SECP256K1_G_PRE_COMPUTED_57;
r->xy[58] = SECP256K1_G_PRE_COMPUTED_58;
r->xy[59] = SECP256K1_G_PRE_COMPUTED_59;
r->xy[60] = SECP256K1_G_PRE_COMPUTED_60;
r->xy[61] = SECP256K1_G_PRE_COMPUTED_61;
r->xy[62] = SECP256K1_G_PRE_COMPUTED_62;
r->xy[63] = SECP256K1_G_PRE_COMPUTED_63;
// -y5
r->xy[64] = SECP256K1_G_PRE_COMPUTED_64;
r->xy[65] = SECP256K1_G_PRE_COMPUTED_65;
r->xy[66] = SECP256K1_G_PRE_COMPUTED_66;
r->xy[67] = SECP256K1_G_PRE_COMPUTED_67;
r->xy[68] = SECP256K1_G_PRE_COMPUTED_68;
r->xy[69] = SECP256K1_G_PRE_COMPUTED_69;
r->xy[70] = SECP256K1_G_PRE_COMPUTED_70;
r->xy[71] = SECP256K1_G_PRE_COMPUTED_71;
// x7
r->xy[72] = SECP256K1_G_PRE_COMPUTED_72;
r->xy[73] = SECP256K1_G_PRE_COMPUTED_73;
r->xy[74] = SECP256K1_G_PRE_COMPUTED_74;
r->xy[75] = SECP256K1_G_PRE_COMPUTED_75;
r->xy[76] = SECP256K1_G_PRE_COMPUTED_76;
r->xy[77] = SECP256K1_G_PRE_COMPUTED_77;
r->xy[78] = SECP256K1_G_PRE_COMPUTED_78;
r->xy[79] = SECP256K1_G_PRE_COMPUTED_79;
// y7
r->xy[80] = SECP256K1_G_PRE_COMPUTED_80;
r->xy[81] = SECP256K1_G_PRE_COMPUTED_81;
r->xy[82] = SECP256K1_G_PRE_COMPUTED_82;
r->xy[83] = SECP256K1_G_PRE_COMPUTED_83;
r->xy[84] = SECP256K1_G_PRE_COMPUTED_84;
r->xy[85] = SECP256K1_G_PRE_COMPUTED_85;
r->xy[86] = SECP256K1_G_PRE_COMPUTED_86;
r->xy[87] = SECP256K1_G_PRE_COMPUTED_87;
// -y7
r->xy[88] = SECP256K1_G_PRE_COMPUTED_88;
r->xy[89] = SECP256K1_G_PRE_COMPUTED_89;
r->xy[90] = SECP256K1_G_PRE_COMPUTED_90;
r->xy[91] = SECP256K1_G_PRE_COMPUTED_91;
r->xy[92] = SECP256K1_G_PRE_COMPUTED_92;
r->xy[93] = SECP256K1_G_PRE_COMPUTED_93;
r->xy[94] = SECP256K1_G_PRE_COMPUTED_94;
r->xy[95] = SECP256K1_G_PRE_COMPUTED_95;
}

View File

@ -10,6 +10,8 @@
#define SECP256K1_B 7
// finite field Fp
// p = FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE FFFFFC2F
#define SECP256K1_P0 0xfffffc2f
#define SECP256K1_P1 0xfffffffe
#define SECP256K1_P2 0xffffffff
@ -19,6 +21,8 @@
#define SECP256K1_P6 0xffffffff
#define SECP256K1_P7 0xffffffff
// prime order N
// n = FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE BAAEDCE6 AF48A03B BFD25E8C D0364141
#define SECP256K1_N0 0xd0364141
#define SECP256K1_N1 0xbfd25e8c
#define SECP256K1_N2 0xaf48a03b
@ -28,14 +32,194 @@
#define SECP256K1_N6 0xffffffff
#define SECP256K1_N7 0xffffffff
// the base point G in compressed form for transform_public
// G = 02 79BE667E F9DCBBAC 55A06295 CE870B07 029BFCDB 2DCE28D9 59F2815B 16F81798
#define SECP256K1_G_PARITY 0x00000002
#define SECP256K1_G0 0x16f81798
#define SECP256K1_G1 0x59f2815b
#define SECP256K1_G2 0x2dce28d9
#define SECP256K1_G3 0x029bfcdb
#define SECP256K1_G4 0xce870b07
#define SECP256K1_G5 0x55a06295
#define SECP256K1_G6 0xf9dcbbac
#define SECP256K1_G7 0x79be667e
// the base point G in compressed form for parse_public
// parity and reversed byte/char (8 bit) byte order
// G = 02 79BE667E F9DCBBAC 55A06295 CE870B07 029BFCDB 2DCE28D9 59F2815B 16F81798
#define SECP256K1_G_STRING0 0x66be7902
#define SECP256K1_G_STRING1 0xbbdcf97e
#define SECP256K1_G_STRING2 0x62a055ac
#define SECP256K1_G_STRING3 0x0b87ce95
#define SECP256K1_G_STRING4 0xfc9b0207
#define SECP256K1_G_STRING5 0x28ce2ddb
#define SECP256K1_G_STRING6 0x81f259d9
#define SECP256K1_G_STRING7 0x17f8165b
#define SECP256K1_G_STRING8 0x00000098
// pre computed values, can be verified using private keys for
// x1 is the same as the basepoint g
// x1 WIF: KwDiBf89QgGbjEhKnhXJuH7LrciVrZi3qYjgd9M7rFU73sVHnoWn
// x3 WIF: KwDiBf89QgGbjEhKnhXJuH7LrciVrZi3qYjgd9M7rFU74sHUHy8S
// x5 WIF: KwDiBf89QgGbjEhKnhXJuH7LrciVrZi3qYjgd9M7rFU75s2EPgZf
// x7 WIF: KwDiBf89QgGbjEhKnhXJuH7LrciVrZi3qYjgd9M7rFU76rnZwVdz
// x1: 79BE667E F9DCBBAC 55A06295 CE870B07 029BFCDB 2DCE28D9 59F2815B 16F81798
// x1: 79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798
#define SECP256K1_G_PRE_COMPUTED_00 0x16f81798
#define SECP256K1_G_PRE_COMPUTED_01 0x59f2815b
#define SECP256K1_G_PRE_COMPUTED_02 0x2dce28d9
#define SECP256K1_G_PRE_COMPUTED_03 0x029bfcdb
#define SECP256K1_G_PRE_COMPUTED_04 0xce870b07
#define SECP256K1_G_PRE_COMPUTED_05 0x55a06295
#define SECP256K1_G_PRE_COMPUTED_06 0xf9dcbbac
#define SECP256K1_G_PRE_COMPUTED_07 0x79be667e
// y1: 483ADA77 26A3C465 5DA4FBFC 0E1108A8 FD17B448 A6855419 9C47D08F FB10D4B8
// y1: 483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8
#define SECP256K1_G_PRE_COMPUTED_08 0xfb10d4b8
#define SECP256K1_G_PRE_COMPUTED_09 0x9c47d08f
#define SECP256K1_G_PRE_COMPUTED_10 0xa6855419
#define SECP256K1_G_PRE_COMPUTED_11 0xfd17b448
#define SECP256K1_G_PRE_COMPUTED_12 0x0e1108a8
#define SECP256K1_G_PRE_COMPUTED_13 0x5da4fbfc
#define SECP256K1_G_PRE_COMPUTED_14 0x26a3c465
#define SECP256K1_G_PRE_COMPUTED_15 0x483ada77
// -y1: B7C52588 D95C3B9A A25B0403 F1EEF757 02E84BB7 597AABE6 63B82F6F 04EF2777
// -y1: B7C52588D95C3B9AA25B0403F1EEF75702E84BB7597AABE663B82F6F04EF2777
#define SECP256K1_G_PRE_COMPUTED_16 0x04ef2777
#define SECP256K1_G_PRE_COMPUTED_17 0x63b82f6f
#define SECP256K1_G_PRE_COMPUTED_18 0x597aabe6
#define SECP256K1_G_PRE_COMPUTED_19 0x02e84bb7
#define SECP256K1_G_PRE_COMPUTED_20 0xf1eef757
#define SECP256K1_G_PRE_COMPUTED_21 0xa25b0403
#define SECP256K1_G_PRE_COMPUTED_22 0xd95c3b9a
#define SECP256K1_G_PRE_COMPUTED_23 0xb7c52588
// x3: F9308A01 9258C310 49344F85 F89D5229 B531C845 836F99B0 8601F113 BCE036F9
// x3: F9308A019258C31049344F85F89D5229B531C845836F99B08601F113BCE036F9
#define SECP256K1_G_PRE_COMPUTED_24 0xbce036f9
#define SECP256K1_G_PRE_COMPUTED_25 0x8601f113
#define SECP256K1_G_PRE_COMPUTED_26 0x836f99b0
#define SECP256K1_G_PRE_COMPUTED_27 0xb531c845
#define SECP256K1_G_PRE_COMPUTED_28 0xf89d5229
#define SECP256K1_G_PRE_COMPUTED_29 0x49344f85
#define SECP256K1_G_PRE_COMPUTED_30 0x9258c310
#define SECP256K1_G_PRE_COMPUTED_31 0xf9308a01
// y3: 388F7B0F 632DE814 0FE337E6 2A37F356 6500A999 34C2231B 6CB9FD75 84B8E672
// y3: 388F7B0F632DE8140FE337E62A37F3566500A99934C2231B6CB9FD7584B8E672
#define SECP256K1_G_PRE_COMPUTED_32 0x84b8e672
#define SECP256K1_G_PRE_COMPUTED_33 0x6cb9fd75
#define SECP256K1_G_PRE_COMPUTED_34 0x34c2231b
#define SECP256K1_G_PRE_COMPUTED_35 0x6500a999
#define SECP256K1_G_PRE_COMPUTED_36 0x2a37f356
#define SECP256K1_G_PRE_COMPUTED_37 0x0fe337e6
#define SECP256K1_G_PRE_COMPUTED_38 0x632de814
#define SECP256K1_G_PRE_COMPUTED_39 0x388f7b0f
// -y3: C77084F0 9CD217EB F01CC819 D5C80CA9 9AFF5666 CB3DDCE4 93460289 7B4715BD
// -y3: C77084F09CD217EBF01CC819D5C80CA99AFF5666CB3DDCE4934602897B4715BD
#define SECP256K1_G_PRE_COMPUTED_40 0x7b4715bd
#define SECP256K1_G_PRE_COMPUTED_41 0x93460289
#define SECP256K1_G_PRE_COMPUTED_42 0xcb3ddce4
#define SECP256K1_G_PRE_COMPUTED_43 0x9aff5666
#define SECP256K1_G_PRE_COMPUTED_44 0xd5c80ca9
#define SECP256K1_G_PRE_COMPUTED_45 0xf01cc819
#define SECP256K1_G_PRE_COMPUTED_46 0x9cd217eb
#define SECP256K1_G_PRE_COMPUTED_47 0xc77084f0
// x5: 2F8BDE4D 1A072093 55B4A725 0A5C5128 E88B84BD DC619AB7 CBA8D569 B240EFE4
// x5: 2F8BDE4D1A07209355B4A7250A5C5128E88B84BDDC619AB7CBA8D569B240EFE4
#define SECP256K1_G_PRE_COMPUTED_48 0xb240efe4
#define SECP256K1_G_PRE_COMPUTED_49 0xcba8d569
#define SECP256K1_G_PRE_COMPUTED_50 0xdc619ab7
#define SECP256K1_G_PRE_COMPUTED_51 0xe88b84bd
#define SECP256K1_G_PRE_COMPUTED_52 0x0a5c5128
#define SECP256K1_G_PRE_COMPUTED_53 0x55b4a725
#define SECP256K1_G_PRE_COMPUTED_54 0x1a072093
#define SECP256K1_G_PRE_COMPUTED_55 0x2f8bde4d
// y5: D8AC2226 36E5E3D6 D4DBA9DD A6C9C426 F788271B AB0D6840 DCA87D3A A6AC62D6
// y5: D8AC222636E5E3D6D4DBA9DDA6C9C426F788271BAB0D6840DCA87D3AA6AC62D6
#define SECP256K1_G_PRE_COMPUTED_56 0xa6ac62d6
#define SECP256K1_G_PRE_COMPUTED_57 0xdca87d3a
#define SECP256K1_G_PRE_COMPUTED_58 0xab0d6840
#define SECP256K1_G_PRE_COMPUTED_59 0xf788271b
#define SECP256K1_G_PRE_COMPUTED_60 0xa6c9c426
#define SECP256K1_G_PRE_COMPUTED_61 0xd4dba9dd
#define SECP256K1_G_PRE_COMPUTED_62 0x36e5e3d6
#define SECP256K1_G_PRE_COMPUTED_63 0xd8ac2226
// -y5: 2753DDD9 C91A1C29 2B245622 59363BD9 0877D8E4 54F297BF 235782C4 59539959
// -y5: 2753DDD9C91A1C292B24562259363BD90877D8E454F297BF235782C459539959
#define SECP256K1_G_PRE_COMPUTED_64 0x59539959
#define SECP256K1_G_PRE_COMPUTED_65 0x235782c4
#define SECP256K1_G_PRE_COMPUTED_66 0x54f297bf
#define SECP256K1_G_PRE_COMPUTED_67 0x0877d8e4
#define SECP256K1_G_PRE_COMPUTED_68 0x59363bd9
#define SECP256K1_G_PRE_COMPUTED_69 0x2b245622
#define SECP256K1_G_PRE_COMPUTED_70 0xc91a1c29
#define SECP256K1_G_PRE_COMPUTED_71 0x2753ddd9
// x7: 5CBDF064 6E5DB4EA A398F365 F2EA7A0E 3D419B7E 0330E39C E92BDDED CAC4F9BC
// x7: 5CBDF0646E5DB4EAA398F365F2EA7A0E3D419B7E0330E39CE92BDDEDCAC4F9BC
#define SECP256K1_G_PRE_COMPUTED_72 0xcac4f9bc
#define SECP256K1_G_PRE_COMPUTED_73 0xe92bdded
#define SECP256K1_G_PRE_COMPUTED_74 0x0330e39c
#define SECP256K1_G_PRE_COMPUTED_75 0x3d419b7e
#define SECP256K1_G_PRE_COMPUTED_76 0xf2ea7a0e
#define SECP256K1_G_PRE_COMPUTED_77 0xa398f365
#define SECP256K1_G_PRE_COMPUTED_78 0x6e5db4ea
#define SECP256K1_G_PRE_COMPUTED_79 0x5cbdf064
// y7: 6AEBCA40 BA255960 A3178D6D 861A54DB A813D0B8 13FDE7B5 A5082628 087264DA
// y7: 6AEBCA40BA255960A3178D6D861A54DBA813D0B813FDE7B5A5082628087264DA
#define SECP256K1_G_PRE_COMPUTED_80 0x087264da
#define SECP256K1_G_PRE_COMPUTED_81 0xa5082628
#define SECP256K1_G_PRE_COMPUTED_82 0x13fde7b5
#define SECP256K1_G_PRE_COMPUTED_83 0xa813d0b8
#define SECP256K1_G_PRE_COMPUTED_84 0x861a54db
#define SECP256K1_G_PRE_COMPUTED_85 0xa3178d6d
#define SECP256K1_G_PRE_COMPUTED_86 0xba255960
#define SECP256K1_G_PRE_COMPUTED_87 0x6aebca40
// -y7: 951435BF 45DAA69F 5CE87292 79E5AB24 57EC2F47 EC02184A 5AF7D9D6 F78D9755
// -y7: 951435BF45DAA69F5CE8729279E5AB2457EC2F47EC02184A5AF7D9D6F78D9755
#define SECP256K1_G_PRE_COMPUTED_88 0xf78d9755
#define SECP256K1_G_PRE_COMPUTED_89 0x5af7d9d6
#define SECP256K1_G_PRE_COMPUTED_90 0xec02184a
#define SECP256K1_G_PRE_COMPUTED_91 0x57ec2f47
#define SECP256K1_G_PRE_COMPUTED_92 0x79e5ab24
#define SECP256K1_G_PRE_COMPUTED_93 0x5ce87292
#define SECP256K1_G_PRE_COMPUTED_94 0x45daa69f
#define SECP256K1_G_PRE_COMPUTED_95 0x951435bf
#define SECP256K1_PRE_COMPUTED_XY_SIZE 96
#define SECP256K1_NAF_SIZE 33 // 32+1, we need one extra slot
#define PUBLIC_KEY_LENGTH_WITHOUT_PARITY 8
#define PUBLIC_KEY_LENGTH_X_Y_WITHOUT_PARITY 16
// 8+1 to make room for the parity
#define PUBLIC_KEY_LENGTH_WITH_PARITY 9
// (32*8 == 256)
#define PRIVATE_KEY_LENGTH 8
typedef struct secp256k1
{
u32 xy[96]; // pre-computed points: (x1,y1,-y1),(x3,y3,-y3),(x5,y5,-y5),(x7,y7,-y7)
u32 xy[SECP256K1_PRE_COMPUTED_XY_SIZE]; // pre-computed points: (x1,y1,-y1),(x3,y3,-y3),(x5,y5,-y5),(x7,y7,-y7)
} secp256k1_t;
DECLSPEC u32 transform_public (secp256k1_t *r, const u32 *x, const u32 first_byte);
DECLSPEC u32 parse_public (secp256k1_t *r, const u32 *k);
DECLSPEC void point_mul_xy (u32 *x1, u32 *y1, const u32 *k, GLOBAL_AS const secp256k1_t *tmps);
DECLSPEC void point_mul (u32 *r, const u32 *k, GLOBAL_AS const secp256k1_t *tmps);
DECLSPEC void set_precomputed_basepoint_g (secp256k1_t *r);
#endif // _INC_ECC_SECP256K1_H

View File

@ -9,7 +9,7 @@
#include "inc_common.h"
#include "inc_hash_blake2b.h"
DECLSPEC void blake2b_transform (u64 *h, const u64 *m, const u32 len, const u64 f0)
DECLSPEC void blake2b_transform (u64 *h, const u64 *m, const int len, const u64 f0)
{
const u64 t0 = hl32_to_64_S (0, len);
@ -86,9 +86,11 @@ DECLSPEC void blake2b_init (blake2b_ctx_t *ctx)
ctx->len = 0;
}
DECLSPEC void blake2b_update_128 (blake2b_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, u32 *w4, u32 *w5, u32 *w6, u32 *w7, const u32 len)
DECLSPEC void blake2b_update_128 (blake2b_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, u32 *w4, u32 *w5, u32 *w6, u32 *w7, const int len)
{
MAYBE_VOLATILE const u32 pos = ctx->len & 127;
if (len == 0) return;
const int pos = ctx->len & 127;
if (pos == 0)
{
@ -195,7 +197,7 @@ DECLSPEC void blake2b_update_128 (blake2b_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2,
ctx->len += len;
}
DECLSPEC void blake2b_update (blake2b_ctx_t *ctx, const u32 *w, const u32 len)
DECLSPEC void blake2b_update (blake2b_ctx_t *ctx, const u32 *w, const int len)
{
u32 w0[4];
u32 w1[4];
@ -285,7 +287,7 @@ DECLSPEC void blake2b_update (blake2b_ctx_t *ctx, const u32 *w, const u32 len)
blake2b_update_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, len - (u32) pos1);
}
DECLSPEC void blake2b_update_global (blake2b_ctx_t *ctx, GLOBAL_AS const u32 *w, const u32 len)
DECLSPEC void blake2b_update_global (blake2b_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{
u32 w0[4];
u32 w1[4];
@ -457,9 +459,11 @@ DECLSPEC void blake2b_init_vector (blake2b_ctx_vector_t *ctx)
ctx->len = 0;
}
DECLSPEC void blake2b_update_vector_128 (blake2b_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, const u32 len)
DECLSPEC void blake2b_update_vector_128 (blake2b_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, const int len)
{
MAYBE_VOLATILE const u32 pos = ctx->len & 127;
if (len == 0) return;
const int pos = ctx->len & 127;
if (pos == 0)
{
@ -566,7 +570,7 @@ DECLSPEC void blake2b_update_vector_128 (blake2b_ctx_vector_t *ctx, u32x *w0, u3
ctx->len += len;
}
DECLSPEC void blake2b_update_vector (blake2b_ctx_vector_t *ctx, const u32x *w, const u32 len)
DECLSPEC void blake2b_update_vector (blake2b_ctx_vector_t *ctx, const u32x *w, const int len)
{
u32x w0[4];
u32x w1[4];

View File

@ -62,7 +62,7 @@ typedef struct blake2b_ctx
u64 m[16]; // buffer
u64 h[ 8]; // digest
u32 len;
int len;
} blake2b_ctx_t;
@ -71,19 +71,19 @@ typedef struct blake2b_ctx_vector
u64x m[16]; // buffer
u64x h[ 8]; // digest
u32 len;
int len;
} blake2b_ctx_vector_t;
DECLSPEC void blake2b_transform (u64 *h, const u64 *m, const u32 len, const u64 f0);
DECLSPEC void blake2b_transform (u64 *h, const u64 *m, const int len, const u64 f0);
DECLSPEC void blake2b_init (blake2b_ctx_t *ctx);
DECLSPEC void blake2b_update (blake2b_ctx_t *ctx, const u32 *w, const u32 len);
DECLSPEC void blake2b_update_global (blake2b_ctx_t *ctx, GLOBAL_AS const u32 *w, const u32 len);
DECLSPEC void blake2b_update (blake2b_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void blake2b_update_global (blake2b_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);
DECLSPEC void blake2b_final (blake2b_ctx_t *ctx);
DECLSPEC void blake2b_transform_vector (u64x *h, const u64x *m, const u32x len, const u64 f0);
DECLSPEC void blake2b_init_vector (blake2b_ctx_vector_t *ctx);
DECLSPEC void blake2b_update_vector (blake2b_ctx_vector_t *ctx, const u32x *w, const u32 len);
DECLSPEC void blake2b_update_vector (blake2b_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void blake2b_final_vector (blake2b_ctx_vector_t *ctx);
#endif // _INC_HASH_BLAKE2B_H

View File

@ -107,7 +107,9 @@ DECLSPEC void md4_init (md4_ctx_t *ctx)
DECLSPEC void md4_update_64 (md4_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len)
{
MAYBE_VOLATILE const int pos = ctx->len & 63;
if (len == 0) return;
const int pos = ctx->len & 63;
ctx->len += len;
@ -363,6 +365,24 @@ DECLSPEC void md4_update_swap (md4_ctx_t *ctx, const u32 *w, const int len)
DECLSPEC void md4_update_utf16le (md4_ctx_t *ctx, const u32 *w, const int len)
{
if (hc_enc_scan (w, len))
{
hc_enc_t hc_enc;
hc_enc_init (&hc_enc);
while (hc_enc_has_next (&hc_enc, len))
{
u32 enc_buf[16] = { 0 };
const int enc_len = hc_enc_next (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
md4_update_64 (ctx, enc_buf + 0, enc_buf + 4, enc_buf + 8, enc_buf + 12, enc_len);
}
return;
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
@ -405,6 +425,41 @@ DECLSPEC void md4_update_utf16le (md4_ctx_t *ctx, const u32 *w, const int len)
DECLSPEC void md4_update_utf16le_swap (md4_ctx_t *ctx, const u32 *w, const int len)
{
if (hc_enc_scan (w, len))
{
hc_enc_t hc_enc;
hc_enc_init (&hc_enc);
while (hc_enc_has_next (&hc_enc, len))
{
u32 enc_buf[16] = { 0 };
const int enc_len = hc_enc_next (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
enc_buf[ 0] = hc_swap32_S (enc_buf[ 0]);
enc_buf[ 1] = hc_swap32_S (enc_buf[ 1]);
enc_buf[ 2] = hc_swap32_S (enc_buf[ 2]);
enc_buf[ 3] = hc_swap32_S (enc_buf[ 3]);
enc_buf[ 4] = hc_swap32_S (enc_buf[ 4]);
enc_buf[ 5] = hc_swap32_S (enc_buf[ 5]);
enc_buf[ 6] = hc_swap32_S (enc_buf[ 6]);
enc_buf[ 7] = hc_swap32_S (enc_buf[ 7]);
enc_buf[ 8] = hc_swap32_S (enc_buf[ 8]);
enc_buf[ 9] = hc_swap32_S (enc_buf[ 9]);
enc_buf[10] = hc_swap32_S (enc_buf[10]);
enc_buf[11] = hc_swap32_S (enc_buf[11]);
enc_buf[12] = hc_swap32_S (enc_buf[12]);
enc_buf[13] = hc_swap32_S (enc_buf[13]);
enc_buf[14] = hc_swap32_S (enc_buf[14]);
enc_buf[15] = hc_swap32_S (enc_buf[15]);
md4_update_64 (ctx, enc_buf + 0, enc_buf + 4, enc_buf + 8, enc_buf + 12, enc_len);
}
return;
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
@ -619,6 +674,24 @@ DECLSPEC void md4_update_global_swap (md4_ctx_t *ctx, GLOBAL_AS const u32 *w, co
DECLSPEC void md4_update_global_utf16le (md4_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{
if (hc_enc_scan_global (w, len))
{
hc_enc_t hc_enc;
hc_enc_init (&hc_enc);
while (hc_enc_has_next (&hc_enc, len))
{
u32 enc_buf[16] = { 0 };
const int enc_len = hc_enc_next_global (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
md4_update_64 (ctx, enc_buf + 0, enc_buf + 4, enc_buf + 8, enc_buf + 12, enc_len);
}
return;
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
@ -661,6 +734,41 @@ DECLSPEC void md4_update_global_utf16le (md4_ctx_t *ctx, GLOBAL_AS const u32 *w,
DECLSPEC void md4_update_global_utf16le_swap (md4_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{
if (hc_enc_scan_global (w, len))
{
hc_enc_t hc_enc;
hc_enc_init (&hc_enc);
while (hc_enc_has_next (&hc_enc, len))
{
u32 enc_buf[16] = { 0 };
const int enc_len = hc_enc_next_global (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
enc_buf[ 0] = hc_swap32_S (enc_buf[ 0]);
enc_buf[ 1] = hc_swap32_S (enc_buf[ 1]);
enc_buf[ 2] = hc_swap32_S (enc_buf[ 2]);
enc_buf[ 3] = hc_swap32_S (enc_buf[ 3]);
enc_buf[ 4] = hc_swap32_S (enc_buf[ 4]);
enc_buf[ 5] = hc_swap32_S (enc_buf[ 5]);
enc_buf[ 6] = hc_swap32_S (enc_buf[ 6]);
enc_buf[ 7] = hc_swap32_S (enc_buf[ 7]);
enc_buf[ 8] = hc_swap32_S (enc_buf[ 8]);
enc_buf[ 9] = hc_swap32_S (enc_buf[ 9]);
enc_buf[10] = hc_swap32_S (enc_buf[10]);
enc_buf[11] = hc_swap32_S (enc_buf[11]);
enc_buf[12] = hc_swap32_S (enc_buf[12]);
enc_buf[13] = hc_swap32_S (enc_buf[13]);
enc_buf[14] = hc_swap32_S (enc_buf[14]);
enc_buf[15] = hc_swap32_S (enc_buf[15]);
md4_update_64 (ctx, enc_buf + 0, enc_buf + 4, enc_buf + 8, enc_buf + 12, enc_len);
}
return;
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
@ -737,7 +845,7 @@ DECLSPEC void md4_update_global_utf16le_swap (md4_ctx_t *ctx, GLOBAL_AS const u3
DECLSPEC void md4_final (md4_ctx_t *ctx)
{
MAYBE_VOLATILE const int pos = ctx->len & 63;
const int pos = ctx->len & 63;
append_0x80_4x4_S (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos);
@ -773,56 +881,61 @@ DECLSPEC void md4_final (md4_ctx_t *ctx)
DECLSPEC void md4_hmac_init_64 (md4_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3)
{
u32 t0[4];
u32 t1[4];
u32 t2[4];
u32 t3[4];
u32 a0[4];
u32 a1[4];
u32 a2[4];
u32 a3[4];
// ipad
t0[0] = w0[0] ^ 0x36363636;
t0[1] = w0[1] ^ 0x36363636;
t0[2] = w0[2] ^ 0x36363636;
t0[3] = w0[3] ^ 0x36363636;
t1[0] = w1[0] ^ 0x36363636;
t1[1] = w1[1] ^ 0x36363636;
t1[2] = w1[2] ^ 0x36363636;
t1[3] = w1[3] ^ 0x36363636;
t2[0] = w2[0] ^ 0x36363636;
t2[1] = w2[1] ^ 0x36363636;
t2[2] = w2[2] ^ 0x36363636;
t2[3] = w2[3] ^ 0x36363636;
t3[0] = w3[0] ^ 0x36363636;
t3[1] = w3[1] ^ 0x36363636;
t3[2] = w3[2] ^ 0x36363636;
t3[3] = w3[3] ^ 0x36363636;
a0[0] = w0[0] ^ 0x36363636;
a0[1] = w0[1] ^ 0x36363636;
a0[2] = w0[2] ^ 0x36363636;
a0[3] = w0[3] ^ 0x36363636;
a1[0] = w1[0] ^ 0x36363636;
a1[1] = w1[1] ^ 0x36363636;
a1[2] = w1[2] ^ 0x36363636;
a1[3] = w1[3] ^ 0x36363636;
a2[0] = w2[0] ^ 0x36363636;
a2[1] = w2[1] ^ 0x36363636;
a2[2] = w2[2] ^ 0x36363636;
a2[3] = w2[3] ^ 0x36363636;
a3[0] = w3[0] ^ 0x36363636;
a3[1] = w3[1] ^ 0x36363636;
a3[2] = w3[2] ^ 0x36363636;
a3[3] = w3[3] ^ 0x36363636;
md4_init (&ctx->ipad);
md4_update_64 (&ctx->ipad, t0, t1, t2, t3, 64);
md4_update_64 (&ctx->ipad, a0, a1, a2, a3, 64);
// opad
t0[0] = w0[0] ^ 0x5c5c5c5c;
t0[1] = w0[1] ^ 0x5c5c5c5c;
t0[2] = w0[2] ^ 0x5c5c5c5c;
t0[3] = w0[3] ^ 0x5c5c5c5c;
t1[0] = w1[0] ^ 0x5c5c5c5c;
t1[1] = w1[1] ^ 0x5c5c5c5c;
t1[2] = w1[2] ^ 0x5c5c5c5c;
t1[3] = w1[3] ^ 0x5c5c5c5c;
t2[0] = w2[0] ^ 0x5c5c5c5c;
t2[1] = w2[1] ^ 0x5c5c5c5c;
t2[2] = w2[2] ^ 0x5c5c5c5c;
t2[3] = w2[3] ^ 0x5c5c5c5c;
t3[0] = w3[0] ^ 0x5c5c5c5c;
t3[1] = w3[1] ^ 0x5c5c5c5c;
t3[2] = w3[2] ^ 0x5c5c5c5c;
t3[3] = w3[3] ^ 0x5c5c5c5c;
u32 b0[4];
u32 b1[4];
u32 b2[4];
u32 b3[4];
b0[0] = w0[0] ^ 0x5c5c5c5c;
b0[1] = w0[1] ^ 0x5c5c5c5c;
b0[2] = w0[2] ^ 0x5c5c5c5c;
b0[3] = w0[3] ^ 0x5c5c5c5c;
b1[0] = w1[0] ^ 0x5c5c5c5c;
b1[1] = w1[1] ^ 0x5c5c5c5c;
b1[2] = w1[2] ^ 0x5c5c5c5c;
b1[3] = w1[3] ^ 0x5c5c5c5c;
b2[0] = w2[0] ^ 0x5c5c5c5c;
b2[1] = w2[1] ^ 0x5c5c5c5c;
b2[2] = w2[2] ^ 0x5c5c5c5c;
b2[3] = w2[3] ^ 0x5c5c5c5c;
b3[0] = w3[0] ^ 0x5c5c5c5c;
b3[1] = w3[1] ^ 0x5c5c5c5c;
b3[2] = w3[2] ^ 0x5c5c5c5c;
b3[3] = w3[3] ^ 0x5c5c5c5c;
md4_init (&ctx->opad);
md4_update_64 (&ctx->opad, t0, t1, t2, t3, 64);
md4_update_64 (&ctx->opad, b0, b1, b2, b3, 64);
}
DECLSPEC void md4_hmac_init (md4_hmac_ctx_t *ctx, const u32 *w, const int len)
@ -1246,7 +1359,9 @@ DECLSPEC void md4_init_vector_from_scalar (md4_ctx_vector_t *ctx, md4_ctx_t *ctx
DECLSPEC void md4_update_vector_64 (md4_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len)
{
MAYBE_VOLATILE const int pos = ctx->len & 63;
if (len == 0) return;
const int pos = ctx->len & 63;
ctx->len += len;
@ -1620,7 +1735,7 @@ DECLSPEC void md4_update_vector_utf16le_swap (md4_ctx_vector_t *ctx, const u32x
DECLSPEC void md4_final_vector (md4_ctx_vector_t *ctx)
{
MAYBE_VOLATILE const int pos = ctx->len & 63;
const int pos = ctx->len & 63;
append_0x80_4x4 (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos);
@ -1656,56 +1771,61 @@ DECLSPEC void md4_final_vector (md4_ctx_vector_t *ctx)
DECLSPEC void md4_hmac_init_vector_64 (md4_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3)
{
u32x t0[4];
u32x t1[4];
u32x t2[4];
u32x t3[4];
u32x a0[4];
u32x a1[4];
u32x a2[4];
u32x a3[4];
// ipad
t0[0] = w0[0] ^ 0x36363636;
t0[1] = w0[1] ^ 0x36363636;
t0[2] = w0[2] ^ 0x36363636;
t0[3] = w0[3] ^ 0x36363636;
t1[0] = w1[0] ^ 0x36363636;
t1[1] = w1[1] ^ 0x36363636;
t1[2] = w1[2] ^ 0x36363636;
t1[3] = w1[3] ^ 0x36363636;
t2[0] = w2[0] ^ 0x36363636;
t2[1] = w2[1] ^ 0x36363636;
t2[2] = w2[2] ^ 0x36363636;
t2[3] = w2[3] ^ 0x36363636;
t3[0] = w3[0] ^ 0x36363636;
t3[1] = w3[1] ^ 0x36363636;
t3[2] = w3[2] ^ 0x36363636;
t3[3] = w3[3] ^ 0x36363636;
a0[0] = w0[0] ^ 0x36363636;
a0[1] = w0[1] ^ 0x36363636;
a0[2] = w0[2] ^ 0x36363636;
a0[3] = w0[3] ^ 0x36363636;
a1[0] = w1[0] ^ 0x36363636;
a1[1] = w1[1] ^ 0x36363636;
a1[2] = w1[2] ^ 0x36363636;
a1[3] = w1[3] ^ 0x36363636;
a2[0] = w2[0] ^ 0x36363636;
a2[1] = w2[1] ^ 0x36363636;
a2[2] = w2[2] ^ 0x36363636;
a2[3] = w2[3] ^ 0x36363636;
a3[0] = w3[0] ^ 0x36363636;
a3[1] = w3[1] ^ 0x36363636;
a3[2] = w3[2] ^ 0x36363636;
a3[3] = w3[3] ^ 0x36363636;
md4_init_vector (&ctx->ipad);
md4_update_vector_64 (&ctx->ipad, t0, t1, t2, t3, 64);
md4_update_vector_64 (&ctx->ipad, a0, a1, a2, a3, 64);
// opad
t0[0] = w0[0] ^ 0x5c5c5c5c;
t0[1] = w0[1] ^ 0x5c5c5c5c;
t0[2] = w0[2] ^ 0x5c5c5c5c;
t0[3] = w0[3] ^ 0x5c5c5c5c;
t1[0] = w1[0] ^ 0x5c5c5c5c;
t1[1] = w1[1] ^ 0x5c5c5c5c;
t1[2] = w1[2] ^ 0x5c5c5c5c;
t1[3] = w1[3] ^ 0x5c5c5c5c;
t2[0] = w2[0] ^ 0x5c5c5c5c;
t2[1] = w2[1] ^ 0x5c5c5c5c;
t2[2] = w2[2] ^ 0x5c5c5c5c;
t2[3] = w2[3] ^ 0x5c5c5c5c;
t3[0] = w3[0] ^ 0x5c5c5c5c;
t3[1] = w3[1] ^ 0x5c5c5c5c;
t3[2] = w3[2] ^ 0x5c5c5c5c;
t3[3] = w3[3] ^ 0x5c5c5c5c;
u32x b0[4];
u32x b1[4];
u32x b2[4];
u32x b3[4];
b0[0] = w0[0] ^ 0x5c5c5c5c;
b0[1] = w0[1] ^ 0x5c5c5c5c;
b0[2] = w0[2] ^ 0x5c5c5c5c;
b0[3] = w0[3] ^ 0x5c5c5c5c;
b1[0] = w1[0] ^ 0x5c5c5c5c;
b1[1] = w1[1] ^ 0x5c5c5c5c;
b1[2] = w1[2] ^ 0x5c5c5c5c;
b1[3] = w1[3] ^ 0x5c5c5c5c;
b2[0] = w2[0] ^ 0x5c5c5c5c;
b2[1] = w2[1] ^ 0x5c5c5c5c;
b2[2] = w2[2] ^ 0x5c5c5c5c;
b2[3] = w2[3] ^ 0x5c5c5c5c;
b3[0] = w3[0] ^ 0x5c5c5c5c;
b3[1] = w3[1] ^ 0x5c5c5c5c;
b3[2] = w3[2] ^ 0x5c5c5c5c;
b3[3] = w3[3] ^ 0x5c5c5c5c;
md4_init_vector (&ctx->opad);
md4_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64);
md4_update_vector_64 (&ctx->opad, b0, b1, b2, b3, 64);
}
DECLSPEC void md4_hmac_init_vector (md4_hmac_ctx_vector_t *ctx, const u32x *w, const int len)

View File

@ -143,7 +143,9 @@ DECLSPEC void md5_init (md5_ctx_t *ctx)
DECLSPEC void md5_update_64 (md5_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len)
{
MAYBE_VOLATILE const int pos = ctx->len & 63;
if (len == 0) return;
const int pos = ctx->len & 63;
ctx->len += len;
@ -399,6 +401,24 @@ DECLSPEC void md5_update_swap (md5_ctx_t *ctx, const u32 *w, const int len)
DECLSPEC void md5_update_utf16le (md5_ctx_t *ctx, const u32 *w, const int len)
{
if (hc_enc_scan (w, len))
{
hc_enc_t hc_enc;
hc_enc_init (&hc_enc);
while (hc_enc_has_next (&hc_enc, len))
{
u32 enc_buf[16] = { 0 };
const int enc_len = hc_enc_next (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
md5_update_64 (ctx, enc_buf + 0, enc_buf + 4, enc_buf + 8, enc_buf + 12, enc_len);
}
return;
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
@ -441,6 +461,41 @@ DECLSPEC void md5_update_utf16le (md5_ctx_t *ctx, const u32 *w, const int len)
DECLSPEC void md5_update_utf16le_swap (md5_ctx_t *ctx, const u32 *w, const int len)
{
if (hc_enc_scan (w, len))
{
hc_enc_t hc_enc;
hc_enc_init (&hc_enc);
while (hc_enc_has_next (&hc_enc, len))
{
u32 enc_buf[16] = { 0 };
const int enc_len = hc_enc_next (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
enc_buf[ 0] = hc_swap32_S (enc_buf[ 0]);
enc_buf[ 1] = hc_swap32_S (enc_buf[ 1]);
enc_buf[ 2] = hc_swap32_S (enc_buf[ 2]);
enc_buf[ 3] = hc_swap32_S (enc_buf[ 3]);
enc_buf[ 4] = hc_swap32_S (enc_buf[ 4]);
enc_buf[ 5] = hc_swap32_S (enc_buf[ 5]);
enc_buf[ 6] = hc_swap32_S (enc_buf[ 6]);
enc_buf[ 7] = hc_swap32_S (enc_buf[ 7]);
enc_buf[ 8] = hc_swap32_S (enc_buf[ 8]);
enc_buf[ 9] = hc_swap32_S (enc_buf[ 9]);
enc_buf[10] = hc_swap32_S (enc_buf[10]);
enc_buf[11] = hc_swap32_S (enc_buf[11]);
enc_buf[12] = hc_swap32_S (enc_buf[12]);
enc_buf[13] = hc_swap32_S (enc_buf[13]);
enc_buf[14] = hc_swap32_S (enc_buf[14]);
enc_buf[15] = hc_swap32_S (enc_buf[15]);
md5_update_64 (ctx, enc_buf + 0, enc_buf + 4, enc_buf + 8, enc_buf + 12, enc_len);
}
return;
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
@ -655,6 +710,24 @@ DECLSPEC void md5_update_global_swap (md5_ctx_t *ctx, GLOBAL_AS const u32 *w, co
DECLSPEC void md5_update_global_utf16le (md5_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{
if (hc_enc_scan_global (w, len))
{
hc_enc_t hc_enc;
hc_enc_init (&hc_enc);
while (hc_enc_has_next (&hc_enc, len))
{
u32 enc_buf[16] = { 0 };
const int enc_len = hc_enc_next_global (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
md5_update_64 (ctx, enc_buf + 0, enc_buf + 4, enc_buf + 8, enc_buf + 12, enc_len);
}
return;
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
@ -697,6 +770,41 @@ DECLSPEC void md5_update_global_utf16le (md5_ctx_t *ctx, GLOBAL_AS const u32 *w,
DECLSPEC void md5_update_global_utf16le_swap (md5_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{
if (hc_enc_scan_global (w, len))
{
hc_enc_t hc_enc;
hc_enc_init (&hc_enc);
while (hc_enc_has_next (&hc_enc, len))
{
u32 enc_buf[16] = { 0 };
const int enc_len = hc_enc_next_global (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
enc_buf[ 0] = hc_swap32_S (enc_buf[ 0]);
enc_buf[ 1] = hc_swap32_S (enc_buf[ 1]);
enc_buf[ 2] = hc_swap32_S (enc_buf[ 2]);
enc_buf[ 3] = hc_swap32_S (enc_buf[ 3]);
enc_buf[ 4] = hc_swap32_S (enc_buf[ 4]);
enc_buf[ 5] = hc_swap32_S (enc_buf[ 5]);
enc_buf[ 6] = hc_swap32_S (enc_buf[ 6]);
enc_buf[ 7] = hc_swap32_S (enc_buf[ 7]);
enc_buf[ 8] = hc_swap32_S (enc_buf[ 8]);
enc_buf[ 9] = hc_swap32_S (enc_buf[ 9]);
enc_buf[10] = hc_swap32_S (enc_buf[10]);
enc_buf[11] = hc_swap32_S (enc_buf[11]);
enc_buf[12] = hc_swap32_S (enc_buf[12]);
enc_buf[13] = hc_swap32_S (enc_buf[13]);
enc_buf[14] = hc_swap32_S (enc_buf[14]);
enc_buf[15] = hc_swap32_S (enc_buf[15]);
md5_update_64 (ctx, enc_buf + 0, enc_buf + 4, enc_buf + 8, enc_buf + 12, enc_len);
}
return;
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
@ -773,7 +881,7 @@ DECLSPEC void md5_update_global_utf16le_swap (md5_ctx_t *ctx, GLOBAL_AS const u3
DECLSPEC void md5_final (md5_ctx_t *ctx)
{
MAYBE_VOLATILE const int pos = ctx->len & 63;
const int pos = ctx->len & 63;
append_0x80_4x4_S (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos);
@ -809,56 +917,61 @@ DECLSPEC void md5_final (md5_ctx_t *ctx)
DECLSPEC void md5_hmac_init_64 (md5_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3)
{
u32 t0[4];
u32 t1[4];
u32 t2[4];
u32 t3[4];
u32 a0[4];
u32 a1[4];
u32 a2[4];
u32 a3[4];
// ipad
t0[0] = w0[0] ^ 0x36363636;
t0[1] = w0[1] ^ 0x36363636;
t0[2] = w0[2] ^ 0x36363636;
t0[3] = w0[3] ^ 0x36363636;
t1[0] = w1[0] ^ 0x36363636;
t1[1] = w1[1] ^ 0x36363636;
t1[2] = w1[2] ^ 0x36363636;
t1[3] = w1[3] ^ 0x36363636;
t2[0] = w2[0] ^ 0x36363636;
t2[1] = w2[1] ^ 0x36363636;
t2[2] = w2[2] ^ 0x36363636;
t2[3] = w2[3] ^ 0x36363636;
t3[0] = w3[0] ^ 0x36363636;
t3[1] = w3[1] ^ 0x36363636;
t3[2] = w3[2] ^ 0x36363636;
t3[3] = w3[3] ^ 0x36363636;
a0[0] = w0[0] ^ 0x36363636;
a0[1] = w0[1] ^ 0x36363636;
a0[2] = w0[2] ^ 0x36363636;
a0[3] = w0[3] ^ 0x36363636;
a1[0] = w1[0] ^ 0x36363636;
a1[1] = w1[1] ^ 0x36363636;
a1[2] = w1[2] ^ 0x36363636;
a1[3] = w1[3] ^ 0x36363636;
a2[0] = w2[0] ^ 0x36363636;
a2[1] = w2[1] ^ 0x36363636;
a2[2] = w2[2] ^ 0x36363636;
a2[3] = w2[3] ^ 0x36363636;
a3[0] = w3[0] ^ 0x36363636;
a3[1] = w3[1] ^ 0x36363636;
a3[2] = w3[2] ^ 0x36363636;
a3[3] = w3[3] ^ 0x36363636;
md5_init (&ctx->ipad);
md5_update_64 (&ctx->ipad, t0, t1, t2, t3, 64);
md5_update_64 (&ctx->ipad, a0, a1, a2, a3, 64);
// opad
t0[0] = w0[0] ^ 0x5c5c5c5c;
t0[1] = w0[1] ^ 0x5c5c5c5c;
t0[2] = w0[2] ^ 0x5c5c5c5c;
t0[3] = w0[3] ^ 0x5c5c5c5c;
t1[0] = w1[0] ^ 0x5c5c5c5c;
t1[1] = w1[1] ^ 0x5c5c5c5c;
t1[2] = w1[2] ^ 0x5c5c5c5c;
t1[3] = w1[3] ^ 0x5c5c5c5c;
t2[0] = w2[0] ^ 0x5c5c5c5c;
t2[1] = w2[1] ^ 0x5c5c5c5c;
t2[2] = w2[2] ^ 0x5c5c5c5c;
t2[3] = w2[3] ^ 0x5c5c5c5c;
t3[0] = w3[0] ^ 0x5c5c5c5c;
t3[1] = w3[1] ^ 0x5c5c5c5c;
t3[2] = w3[2] ^ 0x5c5c5c5c;
t3[3] = w3[3] ^ 0x5c5c5c5c;
u32 b0[4];
u32 b1[4];
u32 b2[4];
u32 b3[4];
b0[0] = w0[0] ^ 0x5c5c5c5c;
b0[1] = w0[1] ^ 0x5c5c5c5c;
b0[2] = w0[2] ^ 0x5c5c5c5c;
b0[3] = w0[3] ^ 0x5c5c5c5c;
b1[0] = w1[0] ^ 0x5c5c5c5c;
b1[1] = w1[1] ^ 0x5c5c5c5c;
b1[2] = w1[2] ^ 0x5c5c5c5c;
b1[3] = w1[3] ^ 0x5c5c5c5c;
b2[0] = w2[0] ^ 0x5c5c5c5c;
b2[1] = w2[1] ^ 0x5c5c5c5c;
b2[2] = w2[2] ^ 0x5c5c5c5c;
b2[3] = w2[3] ^ 0x5c5c5c5c;
b3[0] = w3[0] ^ 0x5c5c5c5c;
b3[1] = w3[1] ^ 0x5c5c5c5c;
b3[2] = w3[2] ^ 0x5c5c5c5c;
b3[3] = w3[3] ^ 0x5c5c5c5c;
md5_init (&ctx->opad);
md5_update_64 (&ctx->opad, t0, t1, t2, t3, 64);
md5_update_64 (&ctx->opad, b0, b1, b2, b3, 64);
}
DECLSPEC void md5_hmac_init (md5_hmac_ctx_t *ctx, const u32 *w, const int len)
@ -1318,7 +1431,9 @@ DECLSPEC void md5_init_vector_from_scalar (md5_ctx_vector_t *ctx, md5_ctx_t *ctx
DECLSPEC void md5_update_vector_64 (md5_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len)
{
MAYBE_VOLATILE const int pos = ctx->len & 63;
if (len == 0) return;
const int pos = ctx->len & 63;
ctx->len += len;
@ -1692,7 +1807,7 @@ DECLSPEC void md5_update_vector_utf16le_swap (md5_ctx_vector_t *ctx, const u32x
DECLSPEC void md5_final_vector (md5_ctx_vector_t *ctx)
{
MAYBE_VOLATILE const int pos = ctx->len & 63;
const int pos = ctx->len & 63;
append_0x80_4x4 (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos);
@ -1728,56 +1843,61 @@ DECLSPEC void md5_final_vector (md5_ctx_vector_t *ctx)
DECLSPEC void md5_hmac_init_vector_64 (md5_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3)
{
u32x t0[4];
u32x t1[4];
u32x t2[4];
u32x t3[4];
u32x a0[4];
u32x a1[4];
u32x a2[4];
u32x a3[4];
// ipad
t0[0] = w0[0] ^ 0x36363636;
t0[1] = w0[1] ^ 0x36363636;
t0[2] = w0[2] ^ 0x36363636;
t0[3] = w0[3] ^ 0x36363636;
t1[0] = w1[0] ^ 0x36363636;
t1[1] = w1[1] ^ 0x36363636;
t1[2] = w1[2] ^ 0x36363636;
t1[3] = w1[3] ^ 0x36363636;
t2[0] = w2[0] ^ 0x36363636;
t2[1] = w2[1] ^ 0x36363636;
t2[2] = w2[2] ^ 0x36363636;
t2[3] = w2[3] ^ 0x36363636;
t3[0] = w3[0] ^ 0x36363636;
t3[1] = w3[1] ^ 0x36363636;
t3[2] = w3[2] ^ 0x36363636;
t3[3] = w3[3] ^ 0x36363636;
a0[0] = w0[0] ^ 0x36363636;
a0[1] = w0[1] ^ 0x36363636;
a0[2] = w0[2] ^ 0x36363636;
a0[3] = w0[3] ^ 0x36363636;
a1[0] = w1[0] ^ 0x36363636;
a1[1] = w1[1] ^ 0x36363636;
a1[2] = w1[2] ^ 0x36363636;
a1[3] = w1[3] ^ 0x36363636;
a2[0] = w2[0] ^ 0x36363636;
a2[1] = w2[1] ^ 0x36363636;
a2[2] = w2[2] ^ 0x36363636;
a2[3] = w2[3] ^ 0x36363636;
a3[0] = w3[0] ^ 0x36363636;
a3[1] = w3[1] ^ 0x36363636;
a3[2] = w3[2] ^ 0x36363636;
a3[3] = w3[3] ^ 0x36363636;
md5_init_vector (&ctx->ipad);
md5_update_vector_64 (&ctx->ipad, t0, t1, t2, t3, 64);
md5_update_vector_64 (&ctx->ipad, a0, a1, a2, a3, 64);
// opad
t0[0] = w0[0] ^ 0x5c5c5c5c;
t0[1] = w0[1] ^ 0x5c5c5c5c;
t0[2] = w0[2] ^ 0x5c5c5c5c;
t0[3] = w0[3] ^ 0x5c5c5c5c;
t1[0] = w1[0] ^ 0x5c5c5c5c;
t1[1] = w1[1] ^ 0x5c5c5c5c;
t1[2] = w1[2] ^ 0x5c5c5c5c;
t1[3] = w1[3] ^ 0x5c5c5c5c;
t2[0] = w2[0] ^ 0x5c5c5c5c;
t2[1] = w2[1] ^ 0x5c5c5c5c;
t2[2] = w2[2] ^ 0x5c5c5c5c;
t2[3] = w2[3] ^ 0x5c5c5c5c;
t3[0] = w3[0] ^ 0x5c5c5c5c;
t3[1] = w3[1] ^ 0x5c5c5c5c;
t3[2] = w3[2] ^ 0x5c5c5c5c;
t3[3] = w3[3] ^ 0x5c5c5c5c;
u32x b0[4];
u32x b1[4];
u32x b2[4];
u32x b3[4];
b0[0] = w0[0] ^ 0x5c5c5c5c;
b0[1] = w0[1] ^ 0x5c5c5c5c;
b0[2] = w0[2] ^ 0x5c5c5c5c;
b0[3] = w0[3] ^ 0x5c5c5c5c;
b1[0] = w1[0] ^ 0x5c5c5c5c;
b1[1] = w1[1] ^ 0x5c5c5c5c;
b1[2] = w1[2] ^ 0x5c5c5c5c;
b1[3] = w1[3] ^ 0x5c5c5c5c;
b2[0] = w2[0] ^ 0x5c5c5c5c;
b2[1] = w2[1] ^ 0x5c5c5c5c;
b2[2] = w2[2] ^ 0x5c5c5c5c;
b2[3] = w2[3] ^ 0x5c5c5c5c;
b3[0] = w3[0] ^ 0x5c5c5c5c;
b3[1] = w3[1] ^ 0x5c5c5c5c;
b3[2] = w3[2] ^ 0x5c5c5c5c;
b3[3] = w3[3] ^ 0x5c5c5c5c;
md5_init_vector (&ctx->opad);
md5_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64);
md5_update_vector_64 (&ctx->opad, b0, b1, b2, b3, 64);
}
DECLSPEC void md5_hmac_init_vector (md5_hmac_ctx_vector_t *ctx, const u32x *w, const int len)

View File

@ -241,7 +241,9 @@ DECLSPEC void ripemd160_init (ripemd160_ctx_t *ctx)
DECLSPEC void ripemd160_update_64 (ripemd160_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len)
{
MAYBE_VOLATILE const int pos = ctx->len & 63;
if (len == 0) return;
const int pos = ctx->len & 63;
ctx->len += len;
@ -497,6 +499,24 @@ DECLSPEC void ripemd160_update_swap (ripemd160_ctx_t *ctx, const u32 *w, const i
DECLSPEC void ripemd160_update_utf16le (ripemd160_ctx_t *ctx, const u32 *w, const int len)
{
if (hc_enc_scan (w, len))
{
hc_enc_t hc_enc;
hc_enc_init (&hc_enc);
while (hc_enc_has_next (&hc_enc, len))
{
u32 enc_buf[16] = { 0 };
const int enc_len = hc_enc_next (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
ripemd160_update_64 (ctx, enc_buf + 0, enc_buf + 4, enc_buf + 8, enc_buf + 12, enc_len);
}
return;
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
@ -539,6 +559,41 @@ DECLSPEC void ripemd160_update_utf16le (ripemd160_ctx_t *ctx, const u32 *w, cons
DECLSPEC void ripemd160_update_utf16le_swap (ripemd160_ctx_t *ctx, const u32 *w, const int len)
{
if (hc_enc_scan (w, len))
{
hc_enc_t hc_enc;
hc_enc_init (&hc_enc);
while (hc_enc_has_next (&hc_enc, len))
{
u32 enc_buf[16] = { 0 };
const int enc_len = hc_enc_next (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
enc_buf[ 0] = hc_swap32_S (enc_buf[ 0]);
enc_buf[ 1] = hc_swap32_S (enc_buf[ 1]);
enc_buf[ 2] = hc_swap32_S (enc_buf[ 2]);
enc_buf[ 3] = hc_swap32_S (enc_buf[ 3]);
enc_buf[ 4] = hc_swap32_S (enc_buf[ 4]);
enc_buf[ 5] = hc_swap32_S (enc_buf[ 5]);
enc_buf[ 6] = hc_swap32_S (enc_buf[ 6]);
enc_buf[ 7] = hc_swap32_S (enc_buf[ 7]);
enc_buf[ 8] = hc_swap32_S (enc_buf[ 8]);
enc_buf[ 9] = hc_swap32_S (enc_buf[ 9]);
enc_buf[10] = hc_swap32_S (enc_buf[10]);
enc_buf[11] = hc_swap32_S (enc_buf[11]);
enc_buf[12] = hc_swap32_S (enc_buf[12]);
enc_buf[13] = hc_swap32_S (enc_buf[13]);
enc_buf[14] = hc_swap32_S (enc_buf[14]);
enc_buf[15] = hc_swap32_S (enc_buf[15]);
ripemd160_update_64 (ctx, enc_buf + 0, enc_buf + 4, enc_buf + 8, enc_buf + 12, enc_len);
}
return;
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
@ -753,6 +808,24 @@ DECLSPEC void ripemd160_update_global_swap (ripemd160_ctx_t *ctx, GLOBAL_AS cons
DECLSPEC void ripemd160_update_global_utf16le (ripemd160_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{
if (hc_enc_scan_global (w, len))
{
hc_enc_t hc_enc;
hc_enc_init (&hc_enc);
while (hc_enc_has_next (&hc_enc, len))
{
u32 enc_buf[16] = { 0 };
const int enc_len = hc_enc_next_global (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
ripemd160_update_64 (ctx, enc_buf + 0, enc_buf + 4, enc_buf + 8, enc_buf + 12, enc_len);
}
return;
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
@ -795,6 +868,41 @@ DECLSPEC void ripemd160_update_global_utf16le (ripemd160_ctx_t *ctx, GLOBAL_AS c
DECLSPEC void ripemd160_update_global_utf16le_swap (ripemd160_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{
if (hc_enc_scan_global (w, len))
{
hc_enc_t hc_enc;
hc_enc_init (&hc_enc);
while (hc_enc_has_next (&hc_enc, len))
{
u32 enc_buf[16] = { 0 };
const int enc_len = hc_enc_next_global (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
enc_buf[ 0] = hc_swap32_S (enc_buf[ 0]);
enc_buf[ 1] = hc_swap32_S (enc_buf[ 1]);
enc_buf[ 2] = hc_swap32_S (enc_buf[ 2]);
enc_buf[ 3] = hc_swap32_S (enc_buf[ 3]);
enc_buf[ 4] = hc_swap32_S (enc_buf[ 4]);
enc_buf[ 5] = hc_swap32_S (enc_buf[ 5]);
enc_buf[ 6] = hc_swap32_S (enc_buf[ 6]);
enc_buf[ 7] = hc_swap32_S (enc_buf[ 7]);
enc_buf[ 8] = hc_swap32_S (enc_buf[ 8]);
enc_buf[ 9] = hc_swap32_S (enc_buf[ 9]);
enc_buf[10] = hc_swap32_S (enc_buf[10]);
enc_buf[11] = hc_swap32_S (enc_buf[11]);
enc_buf[12] = hc_swap32_S (enc_buf[12]);
enc_buf[13] = hc_swap32_S (enc_buf[13]);
enc_buf[14] = hc_swap32_S (enc_buf[14]);
enc_buf[15] = hc_swap32_S (enc_buf[15]);
ripemd160_update_64 (ctx, enc_buf + 0, enc_buf + 4, enc_buf + 8, enc_buf + 12, enc_len);
}
return;
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
@ -871,7 +979,7 @@ DECLSPEC void ripemd160_update_global_utf16le_swap (ripemd160_ctx_t *ctx, GLOBAL
DECLSPEC void ripemd160_final (ripemd160_ctx_t *ctx)
{
MAYBE_VOLATILE const int pos = ctx->len & 63;
const int pos = ctx->len & 63;
append_0x80_4x4_S (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos);
@ -907,56 +1015,61 @@ DECLSPEC void ripemd160_final (ripemd160_ctx_t *ctx)
DECLSPEC void ripemd160_hmac_init_64 (ripemd160_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3)
{
u32 t0[4];
u32 t1[4];
u32 t2[4];
u32 t3[4];
u32 a0[4];
u32 a1[4];
u32 a2[4];
u32 a3[4];
// ipad
t0[0] = w0[0] ^ 0x36363636;
t0[1] = w0[1] ^ 0x36363636;
t0[2] = w0[2] ^ 0x36363636;
t0[3] = w0[3] ^ 0x36363636;
t1[0] = w1[0] ^ 0x36363636;
t1[1] = w1[1] ^ 0x36363636;
t1[2] = w1[2] ^ 0x36363636;
t1[3] = w1[3] ^ 0x36363636;
t2[0] = w2[0] ^ 0x36363636;
t2[1] = w2[1] ^ 0x36363636;
t2[2] = w2[2] ^ 0x36363636;
t2[3] = w2[3] ^ 0x36363636;
t3[0] = w3[0] ^ 0x36363636;
t3[1] = w3[1] ^ 0x36363636;
t3[2] = w3[2] ^ 0x36363636;
t3[3] = w3[3] ^ 0x36363636;
a0[0] = w0[0] ^ 0x36363636;
a0[1] = w0[1] ^ 0x36363636;
a0[2] = w0[2] ^ 0x36363636;
a0[3] = w0[3] ^ 0x36363636;
a1[0] = w1[0] ^ 0x36363636;
a1[1] = w1[1] ^ 0x36363636;
a1[2] = w1[2] ^ 0x36363636;
a1[3] = w1[3] ^ 0x36363636;
a2[0] = w2[0] ^ 0x36363636;
a2[1] = w2[1] ^ 0x36363636;
a2[2] = w2[2] ^ 0x36363636;
a2[3] = w2[3] ^ 0x36363636;
a3[0] = w3[0] ^ 0x36363636;
a3[1] = w3[1] ^ 0x36363636;
a3[2] = w3[2] ^ 0x36363636;
a3[3] = w3[3] ^ 0x36363636;
ripemd160_init (&ctx->ipad);
ripemd160_update_64 (&ctx->ipad, t0, t1, t2, t3, 64);
ripemd160_update_64 (&ctx->ipad, a0, a1, a2, a3, 64);
// opad
t0[0] = w0[0] ^ 0x5c5c5c5c;
t0[1] = w0[1] ^ 0x5c5c5c5c;
t0[2] = w0[2] ^ 0x5c5c5c5c;
t0[3] = w0[3] ^ 0x5c5c5c5c;
t1[0] = w1[0] ^ 0x5c5c5c5c;
t1[1] = w1[1] ^ 0x5c5c5c5c;
t1[2] = w1[2] ^ 0x5c5c5c5c;
t1[3] = w1[3] ^ 0x5c5c5c5c;
t2[0] = w2[0] ^ 0x5c5c5c5c;
t2[1] = w2[1] ^ 0x5c5c5c5c;
t2[2] = w2[2] ^ 0x5c5c5c5c;
t2[3] = w2[3] ^ 0x5c5c5c5c;
t3[0] = w3[0] ^ 0x5c5c5c5c;
t3[1] = w3[1] ^ 0x5c5c5c5c;
t3[2] = w3[2] ^ 0x5c5c5c5c;
t3[3] = w3[3] ^ 0x5c5c5c5c;
u32 b0[4];
u32 b1[4];
u32 b2[4];
u32 b3[4];
b0[0] = w0[0] ^ 0x5c5c5c5c;
b0[1] = w0[1] ^ 0x5c5c5c5c;
b0[2] = w0[2] ^ 0x5c5c5c5c;
b0[3] = w0[3] ^ 0x5c5c5c5c;
b1[0] = w1[0] ^ 0x5c5c5c5c;
b1[1] = w1[1] ^ 0x5c5c5c5c;
b1[2] = w1[2] ^ 0x5c5c5c5c;
b1[3] = w1[3] ^ 0x5c5c5c5c;
b2[0] = w2[0] ^ 0x5c5c5c5c;
b2[1] = w2[1] ^ 0x5c5c5c5c;
b2[2] = w2[2] ^ 0x5c5c5c5c;
b2[3] = w2[3] ^ 0x5c5c5c5c;
b3[0] = w3[0] ^ 0x5c5c5c5c;
b3[1] = w3[1] ^ 0x5c5c5c5c;
b3[2] = w3[2] ^ 0x5c5c5c5c;
b3[3] = w3[3] ^ 0x5c5c5c5c;
ripemd160_init (&ctx->opad);
ripemd160_update_64 (&ctx->opad, t0, t1, t2, t3, 64);
ripemd160_update_64 (&ctx->opad, b0, b1, b2, b3, 64);
}
DECLSPEC void ripemd160_hmac_init (ripemd160_hmac_ctx_t *ctx, const u32 *w, const int len)
@ -1515,7 +1628,9 @@ DECLSPEC void ripemd160_init_vector_from_scalar (ripemd160_ctx_vector_t *ctx, ri
DECLSPEC void ripemd160_update_vector_64 (ripemd160_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len)
{
MAYBE_VOLATILE const int pos = ctx->len & 63;
if (len == 0) return;
const int pos = ctx->len & 63;
ctx->len += len;
@ -1889,7 +2004,7 @@ DECLSPEC void ripemd160_update_vector_utf16le_swap (ripemd160_ctx_vector_t *ctx,
DECLSPEC void ripemd160_final_vector (ripemd160_ctx_vector_t *ctx)
{
MAYBE_VOLATILE const int pos = ctx->len & 63;
const int pos = ctx->len & 63;
append_0x80_4x4 (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos);
@ -1925,56 +2040,61 @@ DECLSPEC void ripemd160_final_vector (ripemd160_ctx_vector_t *ctx)
DECLSPEC void ripemd160_hmac_init_vector_64 (ripemd160_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3)
{
u32x t0[4];
u32x t1[4];
u32x t2[4];
u32x t3[4];
u32x a0[4];
u32x a1[4];
u32x a2[4];
u32x a3[4];
// ipad
t0[0] = w0[0] ^ 0x36363636;
t0[1] = w0[1] ^ 0x36363636;
t0[2] = w0[2] ^ 0x36363636;
t0[3] = w0[3] ^ 0x36363636;
t1[0] = w1[0] ^ 0x36363636;
t1[1] = w1[1] ^ 0x36363636;
t1[2] = w1[2] ^ 0x36363636;
t1[3] = w1[3] ^ 0x36363636;
t2[0] = w2[0] ^ 0x36363636;
t2[1] = w2[1] ^ 0x36363636;
t2[2] = w2[2] ^ 0x36363636;
t2[3] = w2[3] ^ 0x36363636;
t3[0] = w3[0] ^ 0x36363636;
t3[1] = w3[1] ^ 0x36363636;
t3[2] = w3[2] ^ 0x36363636;
t3[3] = w3[3] ^ 0x36363636;
a0[0] = w0[0] ^ 0x36363636;
a0[1] = w0[1] ^ 0x36363636;
a0[2] = w0[2] ^ 0x36363636;
a0[3] = w0[3] ^ 0x36363636;
a1[0] = w1[0] ^ 0x36363636;
a1[1] = w1[1] ^ 0x36363636;
a1[2] = w1[2] ^ 0x36363636;
a1[3] = w1[3] ^ 0x36363636;
a2[0] = w2[0] ^ 0x36363636;
a2[1] = w2[1] ^ 0x36363636;
a2[2] = w2[2] ^ 0x36363636;
a2[3] = w2[3] ^ 0x36363636;
a3[0] = w3[0] ^ 0x36363636;
a3[1] = w3[1] ^ 0x36363636;
a3[2] = w3[2] ^ 0x36363636;
a3[3] = w3[3] ^ 0x36363636;
ripemd160_init_vector (&ctx->ipad);
ripemd160_update_vector_64 (&ctx->ipad, t0, t1, t2, t3, 64);
ripemd160_update_vector_64 (&ctx->ipad, a0, a1, a2, a3, 64);
// opad
t0[0] = w0[0] ^ 0x5c5c5c5c;
t0[1] = w0[1] ^ 0x5c5c5c5c;
t0[2] = w0[2] ^ 0x5c5c5c5c;
t0[3] = w0[3] ^ 0x5c5c5c5c;
t1[0] = w1[0] ^ 0x5c5c5c5c;
t1[1] = w1[1] ^ 0x5c5c5c5c;
t1[2] = w1[2] ^ 0x5c5c5c5c;
t1[3] = w1[3] ^ 0x5c5c5c5c;
t2[0] = w2[0] ^ 0x5c5c5c5c;
t2[1] = w2[1] ^ 0x5c5c5c5c;
t2[2] = w2[2] ^ 0x5c5c5c5c;
t2[3] = w2[3] ^ 0x5c5c5c5c;
t3[0] = w3[0] ^ 0x5c5c5c5c;
t3[1] = w3[1] ^ 0x5c5c5c5c;
t3[2] = w3[2] ^ 0x5c5c5c5c;
t3[3] = w3[3] ^ 0x5c5c5c5c;
u32x b0[4];
u32x b1[4];
u32x b2[4];
u32x b3[4];
b0[0] = w0[0] ^ 0x5c5c5c5c;
b0[1] = w0[1] ^ 0x5c5c5c5c;
b0[2] = w0[2] ^ 0x5c5c5c5c;
b0[3] = w0[3] ^ 0x5c5c5c5c;
b1[0] = w1[0] ^ 0x5c5c5c5c;
b1[1] = w1[1] ^ 0x5c5c5c5c;
b1[2] = w1[2] ^ 0x5c5c5c5c;
b1[3] = w1[3] ^ 0x5c5c5c5c;
b2[0] = w2[0] ^ 0x5c5c5c5c;
b2[1] = w2[1] ^ 0x5c5c5c5c;
b2[2] = w2[2] ^ 0x5c5c5c5c;
b2[3] = w2[3] ^ 0x5c5c5c5c;
b3[0] = w3[0] ^ 0x5c5c5c5c;
b3[1] = w3[1] ^ 0x5c5c5c5c;
b3[2] = w3[2] ^ 0x5c5c5c5c;
b3[3] = w3[3] ^ 0x5c5c5c5c;
ripemd160_init_vector (&ctx->opad);
ripemd160_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64);
ripemd160_update_vector_64 (&ctx->opad, b0, b1, b2, b3, 64);
}
DECLSPEC void ripemd160_hmac_init_vector (ripemd160_hmac_ctx_vector_t *ctx, const u32x *w, const int len)

View File

@ -356,7 +356,9 @@ DECLSPEC void sha1_init (sha1_ctx_t *ctx)
DECLSPEC void sha1_update_64 (sha1_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len)
{
MAYBE_VOLATILE const int pos = ctx->len & 63;
if (len == 0) return;
const int pos = ctx->len & 63;
ctx->len += len;
@ -612,6 +614,24 @@ DECLSPEC void sha1_update_swap (sha1_ctx_t *ctx, const u32 *w, const int len)
DECLSPEC void sha1_update_utf16le (sha1_ctx_t *ctx, const u32 *w, const int len)
{
if (hc_enc_scan (w, len))
{
hc_enc_t hc_enc;
hc_enc_init (&hc_enc);
while (hc_enc_has_next (&hc_enc, len))
{
u32 enc_buf[16] = { 0 };
const int enc_len = hc_enc_next (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
sha1_update_64 (ctx, enc_buf + 0, enc_buf + 4, enc_buf + 8, enc_buf + 12, enc_len);
}
return;
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
@ -654,6 +674,41 @@ DECLSPEC void sha1_update_utf16le (sha1_ctx_t *ctx, const u32 *w, const int len)
DECLSPEC void sha1_update_utf16le_swap (sha1_ctx_t *ctx, const u32 *w, const int len)
{
if (hc_enc_scan (w, len))
{
hc_enc_t hc_enc;
hc_enc_init (&hc_enc);
while (hc_enc_has_next (&hc_enc, len))
{
u32 enc_buf[16] = { 0 };
const int enc_len = hc_enc_next (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
enc_buf[ 0] = hc_swap32_S (enc_buf[ 0]);
enc_buf[ 1] = hc_swap32_S (enc_buf[ 1]);
enc_buf[ 2] = hc_swap32_S (enc_buf[ 2]);
enc_buf[ 3] = hc_swap32_S (enc_buf[ 3]);
enc_buf[ 4] = hc_swap32_S (enc_buf[ 4]);
enc_buf[ 5] = hc_swap32_S (enc_buf[ 5]);
enc_buf[ 6] = hc_swap32_S (enc_buf[ 6]);
enc_buf[ 7] = hc_swap32_S (enc_buf[ 7]);
enc_buf[ 8] = hc_swap32_S (enc_buf[ 8]);
enc_buf[ 9] = hc_swap32_S (enc_buf[ 9]);
enc_buf[10] = hc_swap32_S (enc_buf[10]);
enc_buf[11] = hc_swap32_S (enc_buf[11]);
enc_buf[12] = hc_swap32_S (enc_buf[12]);
enc_buf[13] = hc_swap32_S (enc_buf[13]);
enc_buf[14] = hc_swap32_S (enc_buf[14]);
enc_buf[15] = hc_swap32_S (enc_buf[15]);
sha1_update_64 (ctx, enc_buf + 0, enc_buf + 4, enc_buf + 8, enc_buf + 12, enc_len);
}
return;
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
@ -986,6 +1041,24 @@ DECLSPEC void sha1_update_global_swap (sha1_ctx_t *ctx, GLOBAL_AS const u32 *w,
DECLSPEC void sha1_update_global_utf16le (sha1_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{
if (hc_enc_scan_global (w, len))
{
hc_enc_t hc_enc;
hc_enc_init (&hc_enc);
while (hc_enc_has_next (&hc_enc, len))
{
u32 enc_buf[16] = { 0 };
const int enc_len = hc_enc_next_global (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
sha1_update_64 (ctx, enc_buf + 0, enc_buf + 4, enc_buf + 8, enc_buf + 12, enc_len);
}
return;
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
@ -1028,6 +1101,41 @@ DECLSPEC void sha1_update_global_utf16le (sha1_ctx_t *ctx, GLOBAL_AS const u32 *
DECLSPEC void sha1_update_global_utf16le_swap (sha1_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{
if (hc_enc_scan_global (w, len))
{
hc_enc_t hc_enc;
hc_enc_init (&hc_enc);
while (hc_enc_has_next (&hc_enc, len))
{
u32 enc_buf[16] = { 0 };
const int enc_len = hc_enc_next_global (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
enc_buf[ 0] = hc_swap32_S (enc_buf[ 0]);
enc_buf[ 1] = hc_swap32_S (enc_buf[ 1]);
enc_buf[ 2] = hc_swap32_S (enc_buf[ 2]);
enc_buf[ 3] = hc_swap32_S (enc_buf[ 3]);
enc_buf[ 4] = hc_swap32_S (enc_buf[ 4]);
enc_buf[ 5] = hc_swap32_S (enc_buf[ 5]);
enc_buf[ 6] = hc_swap32_S (enc_buf[ 6]);
enc_buf[ 7] = hc_swap32_S (enc_buf[ 7]);
enc_buf[ 8] = hc_swap32_S (enc_buf[ 8]);
enc_buf[ 9] = hc_swap32_S (enc_buf[ 9]);
enc_buf[10] = hc_swap32_S (enc_buf[10]);
enc_buf[11] = hc_swap32_S (enc_buf[11]);
enc_buf[12] = hc_swap32_S (enc_buf[12]);
enc_buf[13] = hc_swap32_S (enc_buf[13]);
enc_buf[14] = hc_swap32_S (enc_buf[14]);
enc_buf[15] = hc_swap32_S (enc_buf[15]);
sha1_update_64 (ctx, enc_buf + 0, enc_buf + 4, enc_buf + 8, enc_buf + 12, enc_len);
}
return;
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
@ -1222,7 +1330,7 @@ DECLSPEC void sha1_update_global_utf16be_swap (sha1_ctx_t *ctx, GLOBAL_AS const
DECLSPEC void sha1_final (sha1_ctx_t *ctx)
{
MAYBE_VOLATILE const int pos = ctx->len & 63;
const int pos = ctx->len & 63;
append_0x80_4x4_S (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3);
@ -1258,56 +1366,61 @@ DECLSPEC void sha1_final (sha1_ctx_t *ctx)
DECLSPEC void sha1_hmac_init_64 (sha1_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3)
{
u32 t0[4];
u32 t1[4];
u32 t2[4];
u32 t3[4];
u32 a0[4];
u32 a1[4];
u32 a2[4];
u32 a3[4];
// ipad
t0[0] = w0[0] ^ 0x36363636;
t0[1] = w0[1] ^ 0x36363636;
t0[2] = w0[2] ^ 0x36363636;
t0[3] = w0[3] ^ 0x36363636;
t1[0] = w1[0] ^ 0x36363636;
t1[1] = w1[1] ^ 0x36363636;
t1[2] = w1[2] ^ 0x36363636;
t1[3] = w1[3] ^ 0x36363636;
t2[0] = w2[0] ^ 0x36363636;
t2[1] = w2[1] ^ 0x36363636;
t2[2] = w2[2] ^ 0x36363636;
t2[3] = w2[3] ^ 0x36363636;
t3[0] = w3[0] ^ 0x36363636;
t3[1] = w3[1] ^ 0x36363636;
t3[2] = w3[2] ^ 0x36363636;
t3[3] = w3[3] ^ 0x36363636;
a0[0] = w0[0] ^ 0x36363636;
a0[1] = w0[1] ^ 0x36363636;
a0[2] = w0[2] ^ 0x36363636;
a0[3] = w0[3] ^ 0x36363636;
a1[0] = w1[0] ^ 0x36363636;
a1[1] = w1[1] ^ 0x36363636;
a1[2] = w1[2] ^ 0x36363636;
a1[3] = w1[3] ^ 0x36363636;
a2[0] = w2[0] ^ 0x36363636;
a2[1] = w2[1] ^ 0x36363636;
a2[2] = w2[2] ^ 0x36363636;
a2[3] = w2[3] ^ 0x36363636;
a3[0] = w3[0] ^ 0x36363636;
a3[1] = w3[1] ^ 0x36363636;
a3[2] = w3[2] ^ 0x36363636;
a3[3] = w3[3] ^ 0x36363636;
sha1_init (&ctx->ipad);
sha1_update_64 (&ctx->ipad, t0, t1, t2, t3, 64);
sha1_update_64 (&ctx->ipad, a0, a1, a2, a3, 64);
// opad
t0[0] = w0[0] ^ 0x5c5c5c5c;
t0[1] = w0[1] ^ 0x5c5c5c5c;
t0[2] = w0[2] ^ 0x5c5c5c5c;
t0[3] = w0[3] ^ 0x5c5c5c5c;
t1[0] = w1[0] ^ 0x5c5c5c5c;
t1[1] = w1[1] ^ 0x5c5c5c5c;
t1[2] = w1[2] ^ 0x5c5c5c5c;
t1[3] = w1[3] ^ 0x5c5c5c5c;
t2[0] = w2[0] ^ 0x5c5c5c5c;
t2[1] = w2[1] ^ 0x5c5c5c5c;
t2[2] = w2[2] ^ 0x5c5c5c5c;
t2[3] = w2[3] ^ 0x5c5c5c5c;
t3[0] = w3[0] ^ 0x5c5c5c5c;
t3[1] = w3[1] ^ 0x5c5c5c5c;
t3[2] = w3[2] ^ 0x5c5c5c5c;
t3[3] = w3[3] ^ 0x5c5c5c5c;
u32 b0[4];
u32 b1[4];
u32 b2[4];
u32 b3[4];
b0[0] = w0[0] ^ 0x5c5c5c5c;
b0[1] = w0[1] ^ 0x5c5c5c5c;
b0[2] = w0[2] ^ 0x5c5c5c5c;
b0[3] = w0[3] ^ 0x5c5c5c5c;
b1[0] = w1[0] ^ 0x5c5c5c5c;
b1[1] = w1[1] ^ 0x5c5c5c5c;
b1[2] = w1[2] ^ 0x5c5c5c5c;
b1[3] = w1[3] ^ 0x5c5c5c5c;
b2[0] = w2[0] ^ 0x5c5c5c5c;
b2[1] = w2[1] ^ 0x5c5c5c5c;
b2[2] = w2[2] ^ 0x5c5c5c5c;
b2[3] = w2[3] ^ 0x5c5c5c5c;
b3[0] = w3[0] ^ 0x5c5c5c5c;
b3[1] = w3[1] ^ 0x5c5c5c5c;
b3[2] = w3[2] ^ 0x5c5c5c5c;
b3[3] = w3[3] ^ 0x5c5c5c5c;
sha1_init (&ctx->opad);
sha1_update_64 (&ctx->opad, t0, t1, t2, t3, 64);
sha1_update_64 (&ctx->opad, b0, b1, b2, b3, 64);
}
DECLSPEC void sha1_hmac_init (sha1_hmac_ctx_t *ctx, const u32 *w, const int len)
@ -1983,7 +2096,9 @@ DECLSPEC void sha1_init_vector_from_scalar (sha1_ctx_vector_t *ctx, sha1_ctx_t *
DECLSPEC void sha1_update_vector_64 (sha1_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len)
{
MAYBE_VOLATILE const int pos = ctx->len & 63;
if (len == 0) return;
const int pos = ctx->len & 63;
ctx->len += len;
@ -2441,7 +2556,7 @@ DECLSPEC void sha1_update_vector_utf16beN (sha1_ctx_vector_t *ctx, const u32x *w
DECLSPEC void sha1_final_vector (sha1_ctx_vector_t *ctx)
{
MAYBE_VOLATILE const int pos = ctx->len & 63;
const int pos = ctx->len & 63;
append_0x80_4x4 (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3);
@ -2477,56 +2592,61 @@ DECLSPEC void sha1_final_vector (sha1_ctx_vector_t *ctx)
DECLSPEC void sha1_hmac_init_vector_64 (sha1_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3)
{
u32x t0[4];
u32x t1[4];
u32x t2[4];
u32x t3[4];
u32x a0[4];
u32x a1[4];
u32x a2[4];
u32x a3[4];
// ipad
t0[0] = w0[0] ^ 0x36363636;
t0[1] = w0[1] ^ 0x36363636;
t0[2] = w0[2] ^ 0x36363636;
t0[3] = w0[3] ^ 0x36363636;
t1[0] = w1[0] ^ 0x36363636;
t1[1] = w1[1] ^ 0x36363636;
t1[2] = w1[2] ^ 0x36363636;
t1[3] = w1[3] ^ 0x36363636;
t2[0] = w2[0] ^ 0x36363636;
t2[1] = w2[1] ^ 0x36363636;
t2[2] = w2[2] ^ 0x36363636;
t2[3] = w2[3] ^ 0x36363636;
t3[0] = w3[0] ^ 0x36363636;
t3[1] = w3[1] ^ 0x36363636;
t3[2] = w3[2] ^ 0x36363636;
t3[3] = w3[3] ^ 0x36363636;
a0[0] = w0[0] ^ 0x36363636;
a0[1] = w0[1] ^ 0x36363636;
a0[2] = w0[2] ^ 0x36363636;
a0[3] = w0[3] ^ 0x36363636;
a1[0] = w1[0] ^ 0x36363636;
a1[1] = w1[1] ^ 0x36363636;
a1[2] = w1[2] ^ 0x36363636;
a1[3] = w1[3] ^ 0x36363636;
a2[0] = w2[0] ^ 0x36363636;
a2[1] = w2[1] ^ 0x36363636;
a2[2] = w2[2] ^ 0x36363636;
a2[3] = w2[3] ^ 0x36363636;
a3[0] = w3[0] ^ 0x36363636;
a3[1] = w3[1] ^ 0x36363636;
a3[2] = w3[2] ^ 0x36363636;
a3[3] = w3[3] ^ 0x36363636;
sha1_init_vector (&ctx->ipad);
sha1_update_vector_64 (&ctx->ipad, t0, t1, t2, t3, 64);
sha1_update_vector_64 (&ctx->ipad, a0, a1, a2, a3, 64);
// opad
t0[0] = w0[0] ^ 0x5c5c5c5c;
t0[1] = w0[1] ^ 0x5c5c5c5c;
t0[2] = w0[2] ^ 0x5c5c5c5c;
t0[3] = w0[3] ^ 0x5c5c5c5c;
t1[0] = w1[0] ^ 0x5c5c5c5c;
t1[1] = w1[1] ^ 0x5c5c5c5c;
t1[2] = w1[2] ^ 0x5c5c5c5c;
t1[3] = w1[3] ^ 0x5c5c5c5c;
t2[0] = w2[0] ^ 0x5c5c5c5c;
t2[1] = w2[1] ^ 0x5c5c5c5c;
t2[2] = w2[2] ^ 0x5c5c5c5c;
t2[3] = w2[3] ^ 0x5c5c5c5c;
t3[0] = w3[0] ^ 0x5c5c5c5c;
t3[1] = w3[1] ^ 0x5c5c5c5c;
t3[2] = w3[2] ^ 0x5c5c5c5c;
t3[3] = w3[3] ^ 0x5c5c5c5c;
u32x b0[4];
u32x b1[4];
u32x b2[4];
u32x b3[4];
b0[0] = w0[0] ^ 0x5c5c5c5c;
b0[1] = w0[1] ^ 0x5c5c5c5c;
b0[2] = w0[2] ^ 0x5c5c5c5c;
b0[3] = w0[3] ^ 0x5c5c5c5c;
b1[0] = w1[0] ^ 0x5c5c5c5c;
b1[1] = w1[1] ^ 0x5c5c5c5c;
b1[2] = w1[2] ^ 0x5c5c5c5c;
b1[3] = w1[3] ^ 0x5c5c5c5c;
b2[0] = w2[0] ^ 0x5c5c5c5c;
b2[1] = w2[1] ^ 0x5c5c5c5c;
b2[2] = w2[2] ^ 0x5c5c5c5c;
b2[3] = w2[3] ^ 0x5c5c5c5c;
b3[0] = w3[0] ^ 0x5c5c5c5c;
b3[1] = w3[1] ^ 0x5c5c5c5c;
b3[2] = w3[2] ^ 0x5c5c5c5c;
b3[3] = w3[3] ^ 0x5c5c5c5c;
sha1_init_vector (&ctx->opad);
sha1_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64);
sha1_update_vector_64 (&ctx->opad, b0, b1, b2, b3, 64);
}
DECLSPEC void sha1_hmac_init_vector (sha1_hmac_ctx_vector_t *ctx, const u32x *w, const int len)

View File

@ -158,7 +158,9 @@ DECLSPEC void sha224_init (sha224_ctx_t *ctx)
DECLSPEC void sha224_update_64 (sha224_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len)
{
MAYBE_VOLATILE const int pos = ctx->len & 63;
if (len == 0) return;
const int pos = ctx->len & 63;
ctx->len += len;
@ -414,6 +416,24 @@ DECLSPEC void sha224_update_swap (sha224_ctx_t *ctx, const u32 *w, const int len
DECLSPEC void sha224_update_utf16le (sha224_ctx_t *ctx, const u32 *w, const int len)
{
if (hc_enc_scan (w, len))
{
hc_enc_t hc_enc;
hc_enc_init (&hc_enc);
while (hc_enc_has_next (&hc_enc, len))
{
u32 enc_buf[16] = { 0 };
const int enc_len = hc_enc_next (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
sha224_update_64 (ctx, enc_buf + 0, enc_buf + 4, enc_buf + 8, enc_buf + 12, enc_len);
}
return;
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
@ -456,6 +476,41 @@ DECLSPEC void sha224_update_utf16le (sha224_ctx_t *ctx, const u32 *w, const int
DECLSPEC void sha224_update_utf16le_swap (sha224_ctx_t *ctx, const u32 *w, const int len)
{
if (hc_enc_scan (w, len))
{
hc_enc_t hc_enc;
hc_enc_init (&hc_enc);
while (hc_enc_has_next (&hc_enc, len))
{
u32 enc_buf[16] = { 0 };
const int enc_len = hc_enc_next (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
enc_buf[ 0] = hc_swap32_S (enc_buf[ 0]);
enc_buf[ 1] = hc_swap32_S (enc_buf[ 1]);
enc_buf[ 2] = hc_swap32_S (enc_buf[ 2]);
enc_buf[ 3] = hc_swap32_S (enc_buf[ 3]);
enc_buf[ 4] = hc_swap32_S (enc_buf[ 4]);
enc_buf[ 5] = hc_swap32_S (enc_buf[ 5]);
enc_buf[ 6] = hc_swap32_S (enc_buf[ 6]);
enc_buf[ 7] = hc_swap32_S (enc_buf[ 7]);
enc_buf[ 8] = hc_swap32_S (enc_buf[ 8]);
enc_buf[ 9] = hc_swap32_S (enc_buf[ 9]);
enc_buf[10] = hc_swap32_S (enc_buf[10]);
enc_buf[11] = hc_swap32_S (enc_buf[11]);
enc_buf[12] = hc_swap32_S (enc_buf[12]);
enc_buf[13] = hc_swap32_S (enc_buf[13]);
enc_buf[14] = hc_swap32_S (enc_buf[14]);
enc_buf[15] = hc_swap32_S (enc_buf[15]);
sha224_update_64 (ctx, enc_buf + 0, enc_buf + 4, enc_buf + 8, enc_buf + 12, enc_len);
}
return;
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
@ -670,6 +725,24 @@ DECLSPEC void sha224_update_global_swap (sha224_ctx_t *ctx, GLOBAL_AS const u32
DECLSPEC void sha224_update_global_utf16le (sha224_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{
if (hc_enc_scan_global (w, len))
{
hc_enc_t hc_enc;
hc_enc_init (&hc_enc);
while (hc_enc_has_next (&hc_enc, len))
{
u32 enc_buf[16] = { 0 };
const int enc_len = hc_enc_next_global (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
sha224_update_64 (ctx, enc_buf + 0, enc_buf + 4, enc_buf + 8, enc_buf + 12, enc_len);
}
return;
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
@ -712,6 +785,41 @@ DECLSPEC void sha224_update_global_utf16le (sha224_ctx_t *ctx, GLOBAL_AS const u
DECLSPEC void sha224_update_global_utf16le_swap (sha224_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{
if (hc_enc_scan_global (w, len))
{
hc_enc_t hc_enc;
hc_enc_init (&hc_enc);
while (hc_enc_has_next (&hc_enc, len))
{
u32 enc_buf[16] = { 0 };
const int enc_len = hc_enc_next_global (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
enc_buf[ 0] = hc_swap32_S (enc_buf[ 0]);
enc_buf[ 1] = hc_swap32_S (enc_buf[ 1]);
enc_buf[ 2] = hc_swap32_S (enc_buf[ 2]);
enc_buf[ 3] = hc_swap32_S (enc_buf[ 3]);
enc_buf[ 4] = hc_swap32_S (enc_buf[ 4]);
enc_buf[ 5] = hc_swap32_S (enc_buf[ 5]);
enc_buf[ 6] = hc_swap32_S (enc_buf[ 6]);
enc_buf[ 7] = hc_swap32_S (enc_buf[ 7]);
enc_buf[ 8] = hc_swap32_S (enc_buf[ 8]);
enc_buf[ 9] = hc_swap32_S (enc_buf[ 9]);
enc_buf[10] = hc_swap32_S (enc_buf[10]);
enc_buf[11] = hc_swap32_S (enc_buf[11]);
enc_buf[12] = hc_swap32_S (enc_buf[12]);
enc_buf[13] = hc_swap32_S (enc_buf[13]);
enc_buf[14] = hc_swap32_S (enc_buf[14]);
enc_buf[15] = hc_swap32_S (enc_buf[15]);
sha224_update_64 (ctx, enc_buf + 0, enc_buf + 4, enc_buf + 8, enc_buf + 12, enc_len);
}
return;
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
@ -788,7 +896,7 @@ DECLSPEC void sha224_update_global_utf16le_swap (sha224_ctx_t *ctx, GLOBAL_AS co
DECLSPEC void sha224_final (sha224_ctx_t *ctx)
{
MAYBE_VOLATILE const int pos = ctx->len & 63;
const int pos = ctx->len & 63;
append_0x80_4x4_S (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3);
@ -824,56 +932,61 @@ DECLSPEC void sha224_final (sha224_ctx_t *ctx)
DECLSPEC void sha224_hmac_init_64 (sha224_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3)
{
u32 t0[4];
u32 t1[4];
u32 t2[4];
u32 t3[4];
u32 a0[4];
u32 a1[4];
u32 a2[4];
u32 a3[4];
// ipad
t0[0] = w0[0] ^ 0x36363636;
t0[1] = w0[1] ^ 0x36363636;
t0[2] = w0[2] ^ 0x36363636;
t0[3] = w0[3] ^ 0x36363636;
t1[0] = w1[0] ^ 0x36363636;
t1[1] = w1[1] ^ 0x36363636;
t1[2] = w1[2] ^ 0x36363636;
t1[3] = w1[3] ^ 0x36363636;
t2[0] = w2[0] ^ 0x36363636;
t2[1] = w2[1] ^ 0x36363636;
t2[2] = w2[2] ^ 0x36363636;
t2[3] = w2[3] ^ 0x36363636;
t3[0] = w3[0] ^ 0x36363636;
t3[1] = w3[1] ^ 0x36363636;
t3[2] = w3[2] ^ 0x36363636;
t3[3] = w3[3] ^ 0x36363636;
a0[0] = w0[0] ^ 0x36363636;
a0[1] = w0[1] ^ 0x36363636;
a0[2] = w0[2] ^ 0x36363636;
a0[3] = w0[3] ^ 0x36363636;
a1[0] = w1[0] ^ 0x36363636;
a1[1] = w1[1] ^ 0x36363636;
a1[2] = w1[2] ^ 0x36363636;
a1[3] = w1[3] ^ 0x36363636;
a2[0] = w2[0] ^ 0x36363636;
a2[1] = w2[1] ^ 0x36363636;
a2[2] = w2[2] ^ 0x36363636;
a2[3] = w2[3] ^ 0x36363636;
a3[0] = w3[0] ^ 0x36363636;
a3[1] = w3[1] ^ 0x36363636;
a3[2] = w3[2] ^ 0x36363636;
a3[3] = w3[3] ^ 0x36363636;
sha224_init (&ctx->ipad);
sha224_update_64 (&ctx->ipad, t0, t1, t2, t3, 64);
sha224_update_64 (&ctx->ipad, a0, a1, a2, a3, 64);
// opad
t0[0] = w0[0] ^ 0x5c5c5c5c;
t0[1] = w0[1] ^ 0x5c5c5c5c;
t0[2] = w0[2] ^ 0x5c5c5c5c;
t0[3] = w0[3] ^ 0x5c5c5c5c;
t1[0] = w1[0] ^ 0x5c5c5c5c;
t1[1] = w1[1] ^ 0x5c5c5c5c;
t1[2] = w1[2] ^ 0x5c5c5c5c;
t1[3] = w1[3] ^ 0x5c5c5c5c;
t2[0] = w2[0] ^ 0x5c5c5c5c;
t2[1] = w2[1] ^ 0x5c5c5c5c;
t2[2] = w2[2] ^ 0x5c5c5c5c;
t2[3] = w2[3] ^ 0x5c5c5c5c;
t3[0] = w3[0] ^ 0x5c5c5c5c;
t3[1] = w3[1] ^ 0x5c5c5c5c;
t3[2] = w3[2] ^ 0x5c5c5c5c;
t3[3] = w3[3] ^ 0x5c5c5c5c;
u32 b0[4];
u32 b1[4];
u32 b2[4];
u32 b3[4];
b0[0] = w0[0] ^ 0x5c5c5c5c;
b0[1] = w0[1] ^ 0x5c5c5c5c;
b0[2] = w0[2] ^ 0x5c5c5c5c;
b0[3] = w0[3] ^ 0x5c5c5c5c;
b1[0] = w1[0] ^ 0x5c5c5c5c;
b1[1] = w1[1] ^ 0x5c5c5c5c;
b1[2] = w1[2] ^ 0x5c5c5c5c;
b1[3] = w1[3] ^ 0x5c5c5c5c;
b2[0] = w2[0] ^ 0x5c5c5c5c;
b2[1] = w2[1] ^ 0x5c5c5c5c;
b2[2] = w2[2] ^ 0x5c5c5c5c;
b2[3] = w2[3] ^ 0x5c5c5c5c;
b3[0] = w3[0] ^ 0x5c5c5c5c;
b3[1] = w3[1] ^ 0x5c5c5c5c;
b3[2] = w3[2] ^ 0x5c5c5c5c;
b3[3] = w3[3] ^ 0x5c5c5c5c;
sha224_init (&ctx->opad);
sha224_update_64 (&ctx->opad, t0, t1, t2, t3, 64);
sha224_update_64 (&ctx->opad, b0, b1, b2, b3, 64);
}
DECLSPEC void sha224_hmac_init (sha224_hmac_ctx_t *ctx, const u32 *w, const int len)
@ -1332,7 +1445,9 @@ DECLSPEC void sha224_init_vector_from_scalar (sha224_ctx_vector_t *ctx, sha224_c
DECLSPEC void sha224_update_vector_64 (sha224_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len)
{
MAYBE_VOLATILE const int pos = ctx->len & 63;
if (len == 0) return;
const int pos = ctx->len & 63;
ctx->len += len;
@ -1748,7 +1863,7 @@ DECLSPEC void sha224_update_vector_utf16beN (sha224_ctx_vector_t *ctx, const u32
DECLSPEC void sha224_final_vector (sha224_ctx_vector_t *ctx)
{
MAYBE_VOLATILE const int pos = ctx->len & 63;
const int pos = ctx->len & 63;
append_0x80_4x4 (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3);
@ -1784,56 +1899,61 @@ DECLSPEC void sha224_final_vector (sha224_ctx_vector_t *ctx)
DECLSPEC void sha224_hmac_init_vector_64 (sha224_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3)
{
u32x t0[4];
u32x t1[4];
u32x t2[4];
u32x t3[4];
u32x a0[4];
u32x a1[4];
u32x a2[4];
u32x a3[4];
// ipad
t0[0] = w0[0] ^ 0x36363636;
t0[1] = w0[1] ^ 0x36363636;
t0[2] = w0[2] ^ 0x36363636;
t0[3] = w0[3] ^ 0x36363636;
t1[0] = w1[0] ^ 0x36363636;
t1[1] = w1[1] ^ 0x36363636;
t1[2] = w1[2] ^ 0x36363636;
t1[3] = w1[3] ^ 0x36363636;
t2[0] = w2[0] ^ 0x36363636;
t2[1] = w2[1] ^ 0x36363636;
t2[2] = w2[2] ^ 0x36363636;
t2[3] = w2[3] ^ 0x36363636;
t3[0] = w3[0] ^ 0x36363636;
t3[1] = w3[1] ^ 0x36363636;
t3[2] = w3[2] ^ 0x36363636;
t3[3] = w3[3] ^ 0x36363636;
a0[0] = w0[0] ^ 0x36363636;
a0[1] = w0[1] ^ 0x36363636;
a0[2] = w0[2] ^ 0x36363636;
a0[3] = w0[3] ^ 0x36363636;
a1[0] = w1[0] ^ 0x36363636;
a1[1] = w1[1] ^ 0x36363636;
a1[2] = w1[2] ^ 0x36363636;
a1[3] = w1[3] ^ 0x36363636;
a2[0] = w2[0] ^ 0x36363636;
a2[1] = w2[1] ^ 0x36363636;
a2[2] = w2[2] ^ 0x36363636;
a2[3] = w2[3] ^ 0x36363636;
a3[0] = w3[0] ^ 0x36363636;
a3[1] = w3[1] ^ 0x36363636;
a3[2] = w3[2] ^ 0x36363636;
a3[3] = w3[3] ^ 0x36363636;
sha224_init_vector (&ctx->ipad);
sha224_update_vector_64 (&ctx->ipad, t0, t1, t2, t3, 64);
sha224_update_vector_64 (&ctx->ipad, a0, a1, a2, a3, 64);
// opad
t0[0] = w0[0] ^ 0x5c5c5c5c;
t0[1] = w0[1] ^ 0x5c5c5c5c;
t0[2] = w0[2] ^ 0x5c5c5c5c;
t0[3] = w0[3] ^ 0x5c5c5c5c;
t1[0] = w1[0] ^ 0x5c5c5c5c;
t1[1] = w1[1] ^ 0x5c5c5c5c;
t1[2] = w1[2] ^ 0x5c5c5c5c;
t1[3] = w1[3] ^ 0x5c5c5c5c;
t2[0] = w2[0] ^ 0x5c5c5c5c;
t2[1] = w2[1] ^ 0x5c5c5c5c;
t2[2] = w2[2] ^ 0x5c5c5c5c;
t2[3] = w2[3] ^ 0x5c5c5c5c;
t3[0] = w3[0] ^ 0x5c5c5c5c;
t3[1] = w3[1] ^ 0x5c5c5c5c;
t3[2] = w3[2] ^ 0x5c5c5c5c;
t3[3] = w3[3] ^ 0x5c5c5c5c;
u32x b0[4];
u32x b1[4];
u32x b2[4];
u32x b3[4];
b0[0] = w0[0] ^ 0x5c5c5c5c;
b0[1] = w0[1] ^ 0x5c5c5c5c;
b0[2] = w0[2] ^ 0x5c5c5c5c;
b0[3] = w0[3] ^ 0x5c5c5c5c;
b1[0] = w1[0] ^ 0x5c5c5c5c;
b1[1] = w1[1] ^ 0x5c5c5c5c;
b1[2] = w1[2] ^ 0x5c5c5c5c;
b1[3] = w1[3] ^ 0x5c5c5c5c;
b2[0] = w2[0] ^ 0x5c5c5c5c;
b2[1] = w2[1] ^ 0x5c5c5c5c;
b2[2] = w2[2] ^ 0x5c5c5c5c;
b2[3] = w2[3] ^ 0x5c5c5c5c;
b3[0] = w3[0] ^ 0x5c5c5c5c;
b3[1] = w3[1] ^ 0x5c5c5c5c;
b3[2] = w3[2] ^ 0x5c5c5c5c;
b3[3] = w3[3] ^ 0x5c5c5c5c;
sha224_init_vector (&ctx->opad);
sha224_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64);
sha224_update_vector_64 (&ctx->opad, b0, b1, b2, b3, 64);
}
DECLSPEC void sha224_hmac_init_vector (sha224_hmac_ctx_vector_t *ctx, const u32x *w, const int len)

View File

@ -158,7 +158,9 @@ DECLSPEC void sha256_init (sha256_ctx_t *ctx)
DECLSPEC void sha256_update_64 (sha256_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len)
{
MAYBE_VOLATILE const int pos = ctx->len & 63;
if (len == 0) return;
const int pos = ctx->len & 63;
ctx->len += len;
@ -414,6 +416,24 @@ DECLSPEC void sha256_update_swap (sha256_ctx_t *ctx, const u32 *w, const int len
DECLSPEC void sha256_update_utf16le (sha256_ctx_t *ctx, const u32 *w, const int len)
{
if (hc_enc_scan (w, len))
{
hc_enc_t hc_enc;
hc_enc_init (&hc_enc);
while (hc_enc_has_next (&hc_enc, len))
{
u32 enc_buf[16] = { 0 };
const int enc_len = hc_enc_next (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
sha256_update_64 (ctx, enc_buf + 0, enc_buf + 4, enc_buf + 8, enc_buf + 12, enc_len);
}
return;
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
@ -456,6 +476,41 @@ DECLSPEC void sha256_update_utf16le (sha256_ctx_t *ctx, const u32 *w, const int
DECLSPEC void sha256_update_utf16le_swap (sha256_ctx_t *ctx, const u32 *w, const int len)
{
if (hc_enc_scan (w, len))
{
hc_enc_t hc_enc;
hc_enc_init (&hc_enc);
while (hc_enc_has_next (&hc_enc, len))
{
u32 enc_buf[16] = { 0 };
const int enc_len = hc_enc_next (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
enc_buf[ 0] = hc_swap32_S (enc_buf[ 0]);
enc_buf[ 1] = hc_swap32_S (enc_buf[ 1]);
enc_buf[ 2] = hc_swap32_S (enc_buf[ 2]);
enc_buf[ 3] = hc_swap32_S (enc_buf[ 3]);
enc_buf[ 4] = hc_swap32_S (enc_buf[ 4]);
enc_buf[ 5] = hc_swap32_S (enc_buf[ 5]);
enc_buf[ 6] = hc_swap32_S (enc_buf[ 6]);
enc_buf[ 7] = hc_swap32_S (enc_buf[ 7]);
enc_buf[ 8] = hc_swap32_S (enc_buf[ 8]);
enc_buf[ 9] = hc_swap32_S (enc_buf[ 9]);
enc_buf[10] = hc_swap32_S (enc_buf[10]);
enc_buf[11] = hc_swap32_S (enc_buf[11]);
enc_buf[12] = hc_swap32_S (enc_buf[12]);
enc_buf[13] = hc_swap32_S (enc_buf[13]);
enc_buf[14] = hc_swap32_S (enc_buf[14]);
enc_buf[15] = hc_swap32_S (enc_buf[15]);
sha256_update_64 (ctx, enc_buf + 0, enc_buf + 4, enc_buf + 8, enc_buf + 12, enc_len);
}
return;
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
@ -670,6 +725,24 @@ DECLSPEC void sha256_update_global_swap (sha256_ctx_t *ctx, GLOBAL_AS const u32
DECLSPEC void sha256_update_global_utf16le (sha256_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{
if (hc_enc_scan_global (w, len))
{
hc_enc_t hc_enc;
hc_enc_init (&hc_enc);
while (hc_enc_has_next (&hc_enc, len))
{
u32 enc_buf[16] = { 0 };
const int enc_len = hc_enc_next_global (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
sha256_update_64 (ctx, enc_buf + 0, enc_buf + 4, enc_buf + 8, enc_buf + 12, enc_len);
}
return;
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
@ -712,6 +785,41 @@ DECLSPEC void sha256_update_global_utf16le (sha256_ctx_t *ctx, GLOBAL_AS const u
DECLSPEC void sha256_update_global_utf16le_swap (sha256_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{
if (hc_enc_scan_global (w, len))
{
hc_enc_t hc_enc;
hc_enc_init (&hc_enc);
while (hc_enc_has_next (&hc_enc, len))
{
u32 enc_buf[16] = { 0 };
const int enc_len = hc_enc_next_global (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
enc_buf[ 0] = hc_swap32_S (enc_buf[ 0]);
enc_buf[ 1] = hc_swap32_S (enc_buf[ 1]);
enc_buf[ 2] = hc_swap32_S (enc_buf[ 2]);
enc_buf[ 3] = hc_swap32_S (enc_buf[ 3]);
enc_buf[ 4] = hc_swap32_S (enc_buf[ 4]);
enc_buf[ 5] = hc_swap32_S (enc_buf[ 5]);
enc_buf[ 6] = hc_swap32_S (enc_buf[ 6]);
enc_buf[ 7] = hc_swap32_S (enc_buf[ 7]);
enc_buf[ 8] = hc_swap32_S (enc_buf[ 8]);
enc_buf[ 9] = hc_swap32_S (enc_buf[ 9]);
enc_buf[10] = hc_swap32_S (enc_buf[10]);
enc_buf[11] = hc_swap32_S (enc_buf[11]);
enc_buf[12] = hc_swap32_S (enc_buf[12]);
enc_buf[13] = hc_swap32_S (enc_buf[13]);
enc_buf[14] = hc_swap32_S (enc_buf[14]);
enc_buf[15] = hc_swap32_S (enc_buf[15]);
sha256_update_64 (ctx, enc_buf + 0, enc_buf + 4, enc_buf + 8, enc_buf + 12, enc_len);
}
return;
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
@ -788,7 +896,7 @@ DECLSPEC void sha256_update_global_utf16le_swap (sha256_ctx_t *ctx, GLOBAL_AS co
DECLSPEC void sha256_final (sha256_ctx_t *ctx)
{
MAYBE_VOLATILE const int pos = ctx->len & 63;
const int pos = ctx->len & 63;
append_0x80_4x4_S (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3);
@ -824,56 +932,61 @@ DECLSPEC void sha256_final (sha256_ctx_t *ctx)
DECLSPEC void sha256_hmac_init_64 (sha256_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3)
{
u32 t0[4];
u32 t1[4];
u32 t2[4];
u32 t3[4];
u32 a0[4];
u32 a1[4];
u32 a2[4];
u32 a3[4];
// ipad
t0[0] = w0[0] ^ 0x36363636;
t0[1] = w0[1] ^ 0x36363636;
t0[2] = w0[2] ^ 0x36363636;
t0[3] = w0[3] ^ 0x36363636;
t1[0] = w1[0] ^ 0x36363636;
t1[1] = w1[1] ^ 0x36363636;
t1[2] = w1[2] ^ 0x36363636;
t1[3] = w1[3] ^ 0x36363636;
t2[0] = w2[0] ^ 0x36363636;
t2[1] = w2[1] ^ 0x36363636;
t2[2] = w2[2] ^ 0x36363636;
t2[3] = w2[3] ^ 0x36363636;
t3[0] = w3[0] ^ 0x36363636;
t3[1] = w3[1] ^ 0x36363636;
t3[2] = w3[2] ^ 0x36363636;
t3[3] = w3[3] ^ 0x36363636;
a0[0] = w0[0] ^ 0x36363636;
a0[1] = w0[1] ^ 0x36363636;
a0[2] = w0[2] ^ 0x36363636;
a0[3] = w0[3] ^ 0x36363636;
a1[0] = w1[0] ^ 0x36363636;
a1[1] = w1[1] ^ 0x36363636;
a1[2] = w1[2] ^ 0x36363636;
a1[3] = w1[3] ^ 0x36363636;
a2[0] = w2[0] ^ 0x36363636;
a2[1] = w2[1] ^ 0x36363636;
a2[2] = w2[2] ^ 0x36363636;
a2[3] = w2[3] ^ 0x36363636;
a3[0] = w3[0] ^ 0x36363636;
a3[1] = w3[1] ^ 0x36363636;
a3[2] = w3[2] ^ 0x36363636;
a3[3] = w3[3] ^ 0x36363636;
sha256_init (&ctx->ipad);
sha256_update_64 (&ctx->ipad, t0, t1, t2, t3, 64);
sha256_update_64 (&ctx->ipad, a0, a1, a2, a3, 64);
// opad
t0[0] = w0[0] ^ 0x5c5c5c5c;
t0[1] = w0[1] ^ 0x5c5c5c5c;
t0[2] = w0[2] ^ 0x5c5c5c5c;
t0[3] = w0[3] ^ 0x5c5c5c5c;
t1[0] = w1[0] ^ 0x5c5c5c5c;
t1[1] = w1[1] ^ 0x5c5c5c5c;
t1[2] = w1[2] ^ 0x5c5c5c5c;
t1[3] = w1[3] ^ 0x5c5c5c5c;
t2[0] = w2[0] ^ 0x5c5c5c5c;
t2[1] = w2[1] ^ 0x5c5c5c5c;
t2[2] = w2[2] ^ 0x5c5c5c5c;
t2[3] = w2[3] ^ 0x5c5c5c5c;
t3[0] = w3[0] ^ 0x5c5c5c5c;
t3[1] = w3[1] ^ 0x5c5c5c5c;
t3[2] = w3[2] ^ 0x5c5c5c5c;
t3[3] = w3[3] ^ 0x5c5c5c5c;
u32 b0[4];
u32 b1[4];
u32 b2[4];
u32 b3[4];
b0[0] = w0[0] ^ 0x5c5c5c5c;
b0[1] = w0[1] ^ 0x5c5c5c5c;
b0[2] = w0[2] ^ 0x5c5c5c5c;
b0[3] = w0[3] ^ 0x5c5c5c5c;
b1[0] = w1[0] ^ 0x5c5c5c5c;
b1[1] = w1[1] ^ 0x5c5c5c5c;
b1[2] = w1[2] ^ 0x5c5c5c5c;
b1[3] = w1[3] ^ 0x5c5c5c5c;
b2[0] = w2[0] ^ 0x5c5c5c5c;
b2[1] = w2[1] ^ 0x5c5c5c5c;
b2[2] = w2[2] ^ 0x5c5c5c5c;
b2[3] = w2[3] ^ 0x5c5c5c5c;
b3[0] = w3[0] ^ 0x5c5c5c5c;
b3[1] = w3[1] ^ 0x5c5c5c5c;
b3[2] = w3[2] ^ 0x5c5c5c5c;
b3[3] = w3[3] ^ 0x5c5c5c5c;
sha256_init (&ctx->opad);
sha256_update_64 (&ctx->opad, t0, t1, t2, t3, 64);
sha256_update_64 (&ctx->opad, b0, b1, b2, b3, 64);
}
DECLSPEC void sha256_hmac_init (sha256_hmac_ctx_t *ctx, const u32 *w, const int len)
@ -1332,7 +1445,9 @@ DECLSPEC void sha256_init_vector_from_scalar (sha256_ctx_vector_t *ctx, sha256_c
DECLSPEC void sha256_update_vector_64 (sha256_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len)
{
MAYBE_VOLATILE const int pos = ctx->len & 63;
if (len == 0) return;
const int pos = ctx->len & 63;
ctx->len += len;
@ -1748,7 +1863,7 @@ DECLSPEC void sha256_update_vector_utf16beN (sha256_ctx_vector_t *ctx, const u32
DECLSPEC void sha256_final_vector (sha256_ctx_vector_t *ctx)
{
MAYBE_VOLATILE const int pos = ctx->len & 63;
const int pos = ctx->len & 63;
append_0x80_4x4 (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3);
@ -1784,56 +1899,61 @@ DECLSPEC void sha256_final_vector (sha256_ctx_vector_t *ctx)
DECLSPEC void sha256_hmac_init_vector_64 (sha256_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3)
{
u32x t0[4];
u32x t1[4];
u32x t2[4];
u32x t3[4];
u32x a0[4];
u32x a1[4];
u32x a2[4];
u32x a3[4];
// ipad
t0[0] = w0[0] ^ 0x36363636;
t0[1] = w0[1] ^ 0x36363636;
t0[2] = w0[2] ^ 0x36363636;
t0[3] = w0[3] ^ 0x36363636;
t1[0] = w1[0] ^ 0x36363636;
t1[1] = w1[1] ^ 0x36363636;
t1[2] = w1[2] ^ 0x36363636;
t1[3] = w1[3] ^ 0x36363636;
t2[0] = w2[0] ^ 0x36363636;
t2[1] = w2[1] ^ 0x36363636;
t2[2] = w2[2] ^ 0x36363636;
t2[3] = w2[3] ^ 0x36363636;
t3[0] = w3[0] ^ 0x36363636;
t3[1] = w3[1] ^ 0x36363636;
t3[2] = w3[2] ^ 0x36363636;
t3[3] = w3[3] ^ 0x36363636;
a0[0] = w0[0] ^ 0x36363636;
a0[1] = w0[1] ^ 0x36363636;
a0[2] = w0[2] ^ 0x36363636;
a0[3] = w0[3] ^ 0x36363636;
a1[0] = w1[0] ^ 0x36363636;
a1[1] = w1[1] ^ 0x36363636;
a1[2] = w1[2] ^ 0x36363636;
a1[3] = w1[3] ^ 0x36363636;
a2[0] = w2[0] ^ 0x36363636;
a2[1] = w2[1] ^ 0x36363636;
a2[2] = w2[2] ^ 0x36363636;
a2[3] = w2[3] ^ 0x36363636;
a3[0] = w3[0] ^ 0x36363636;
a3[1] = w3[1] ^ 0x36363636;
a3[2] = w3[2] ^ 0x36363636;
a3[3] = w3[3] ^ 0x36363636;
sha256_init_vector (&ctx->ipad);
sha256_update_vector_64 (&ctx->ipad, t0, t1, t2, t3, 64);
sha256_update_vector_64 (&ctx->ipad, a0, a1, a2, a3, 64);
// opad
t0[0] = w0[0] ^ 0x5c5c5c5c;
t0[1] = w0[1] ^ 0x5c5c5c5c;
t0[2] = w0[2] ^ 0x5c5c5c5c;
t0[3] = w0[3] ^ 0x5c5c5c5c;
t1[0] = w1[0] ^ 0x5c5c5c5c;
t1[1] = w1[1] ^ 0x5c5c5c5c;
t1[2] = w1[2] ^ 0x5c5c5c5c;
t1[3] = w1[3] ^ 0x5c5c5c5c;
t2[0] = w2[0] ^ 0x5c5c5c5c;
t2[1] = w2[1] ^ 0x5c5c5c5c;
t2[2] = w2[2] ^ 0x5c5c5c5c;
t2[3] = w2[3] ^ 0x5c5c5c5c;
t3[0] = w3[0] ^ 0x5c5c5c5c;
t3[1] = w3[1] ^ 0x5c5c5c5c;
t3[2] = w3[2] ^ 0x5c5c5c5c;
t3[3] = w3[3] ^ 0x5c5c5c5c;
u32x b0[4];
u32x b1[4];
u32x b2[4];
u32x b3[4];
b0[0] = w0[0] ^ 0x5c5c5c5c;
b0[1] = w0[1] ^ 0x5c5c5c5c;
b0[2] = w0[2] ^ 0x5c5c5c5c;
b0[3] = w0[3] ^ 0x5c5c5c5c;
b1[0] = w1[0] ^ 0x5c5c5c5c;
b1[1] = w1[1] ^ 0x5c5c5c5c;
b1[2] = w1[2] ^ 0x5c5c5c5c;
b1[3] = w1[3] ^ 0x5c5c5c5c;
b2[0] = w2[0] ^ 0x5c5c5c5c;
b2[1] = w2[1] ^ 0x5c5c5c5c;
b2[2] = w2[2] ^ 0x5c5c5c5c;
b2[3] = w2[3] ^ 0x5c5c5c5c;
b3[0] = w3[0] ^ 0x5c5c5c5c;
b3[1] = w3[1] ^ 0x5c5c5c5c;
b3[2] = w3[2] ^ 0x5c5c5c5c;
b3[3] = w3[3] ^ 0x5c5c5c5c;
sha256_init_vector (&ctx->opad);
sha256_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64);
sha256_update_vector_64 (&ctx->opad, b0, b1, b2, b3, 64);
}
DECLSPEC void sha256_hmac_init_vector (sha256_hmac_ctx_vector_t *ctx, const u32x *w, const int len)

View File

@ -178,7 +178,9 @@ DECLSPEC void sha384_init (sha384_ctx_t *ctx)
DECLSPEC void sha384_update_128 (sha384_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, u32 *w4, u32 *w5, u32 *w6, u32 *w7, const int len)
{
MAYBE_VOLATILE const int pos = ctx->len & 127;
if (len == 0) return;
const int pos = ctx->len & 127;
ctx->len += len;
@ -622,6 +624,24 @@ DECLSPEC void sha384_update_swap (sha384_ctx_t *ctx, const u32 *w, const int len
DECLSPEC void sha384_update_utf16le (sha384_ctx_t *ctx, const u32 *w, const int len)
{
if (hc_enc_scan (w, len))
{
hc_enc_t hc_enc;
hc_enc_init (&hc_enc);
while (hc_enc_has_next (&hc_enc, len))
{
u32 enc_buf[32] = { 0 };
const int enc_len = hc_enc_next (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
sha384_update_128 (ctx, enc_buf + 0, enc_buf + 4, enc_buf + 8, enc_buf + 12, enc_buf + 16, enc_buf + 20, enc_buf + 24, enc_buf + 28, enc_len);
}
return;
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
@ -688,6 +708,57 @@ DECLSPEC void sha384_update_utf16le (sha384_ctx_t *ctx, const u32 *w, const int
DECLSPEC void sha384_update_utf16le_swap (sha384_ctx_t *ctx, const u32 *w, const int len)
{
if (hc_enc_scan (w, len))
{
hc_enc_t hc_enc;
hc_enc_init (&hc_enc);
while (hc_enc_has_next (&hc_enc, len))
{
u32 enc_buf[32] = { 0 };
const int enc_len = hc_enc_next (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
enc_buf[ 0] = hc_swap32_S (enc_buf[ 0]);
enc_buf[ 1] = hc_swap32_S (enc_buf[ 1]);
enc_buf[ 2] = hc_swap32_S (enc_buf[ 2]);
enc_buf[ 3] = hc_swap32_S (enc_buf[ 3]);
enc_buf[ 4] = hc_swap32_S (enc_buf[ 4]);
enc_buf[ 5] = hc_swap32_S (enc_buf[ 5]);
enc_buf[ 6] = hc_swap32_S (enc_buf[ 6]);
enc_buf[ 7] = hc_swap32_S (enc_buf[ 7]);
enc_buf[ 8] = hc_swap32_S (enc_buf[ 8]);
enc_buf[ 9] = hc_swap32_S (enc_buf[ 9]);
enc_buf[10] = hc_swap32_S (enc_buf[10]);
enc_buf[11] = hc_swap32_S (enc_buf[11]);
enc_buf[12] = hc_swap32_S (enc_buf[12]);
enc_buf[13] = hc_swap32_S (enc_buf[13]);
enc_buf[14] = hc_swap32_S (enc_buf[14]);
enc_buf[15] = hc_swap32_S (enc_buf[15]);
enc_buf[16] = hc_swap32_S (enc_buf[16]);
enc_buf[17] = hc_swap32_S (enc_buf[17]);
enc_buf[18] = hc_swap32_S (enc_buf[18]);
enc_buf[19] = hc_swap32_S (enc_buf[19]);
enc_buf[20] = hc_swap32_S (enc_buf[20]);
enc_buf[21] = hc_swap32_S (enc_buf[21]);
enc_buf[22] = hc_swap32_S (enc_buf[22]);
enc_buf[23] = hc_swap32_S (enc_buf[23]);
enc_buf[24] = hc_swap32_S (enc_buf[24]);
enc_buf[25] = hc_swap32_S (enc_buf[25]);
enc_buf[26] = hc_swap32_S (enc_buf[26]);
enc_buf[27] = hc_swap32_S (enc_buf[27]);
enc_buf[28] = hc_swap32_S (enc_buf[28]);
enc_buf[29] = hc_swap32_S (enc_buf[29]);
enc_buf[30] = hc_swap32_S (enc_buf[30]);
enc_buf[31] = hc_swap32_S (enc_buf[31]);
sha384_update_128 (ctx, enc_buf + 0, enc_buf + 4, enc_buf + 8, enc_buf + 12, enc_buf + 16, enc_buf + 20, enc_buf + 24, enc_buf + 28, enc_len);
}
return;
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
@ -1062,6 +1133,24 @@ DECLSPEC void sha384_update_global_swap (sha384_ctx_t *ctx, GLOBAL_AS const u32
DECLSPEC void sha384_update_global_utf16le (sha384_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{
if (hc_enc_scan_global (w, len))
{
hc_enc_t hc_enc;
hc_enc_init (&hc_enc);
while (hc_enc_has_next (&hc_enc, len))
{
u32 enc_buf[32] = { 0 };
const int enc_len = hc_enc_next_global (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
sha384_update_128 (ctx, enc_buf + 0, enc_buf + 4, enc_buf + 8, enc_buf + 12, enc_buf + 16, enc_buf + 20, enc_buf + 24, enc_buf + 28, enc_len);
}
return;
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
@ -1128,6 +1217,57 @@ DECLSPEC void sha384_update_global_utf16le (sha384_ctx_t *ctx, GLOBAL_AS const u
DECLSPEC void sha384_update_global_utf16le_swap (sha384_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{
if (hc_enc_scan_global (w, len))
{
hc_enc_t hc_enc;
hc_enc_init (&hc_enc);
while (hc_enc_has_next (&hc_enc, len))
{
u32 enc_buf[32] = { 0 };
const int enc_len = hc_enc_next_global (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
enc_buf[ 0] = hc_swap32_S (enc_buf[ 0]);
enc_buf[ 1] = hc_swap32_S (enc_buf[ 1]);
enc_buf[ 2] = hc_swap32_S (enc_buf[ 2]);
enc_buf[ 3] = hc_swap32_S (enc_buf[ 3]);
enc_buf[ 4] = hc_swap32_S (enc_buf[ 4]);
enc_buf[ 5] = hc_swap32_S (enc_buf[ 5]);
enc_buf[ 6] = hc_swap32_S (enc_buf[ 6]);
enc_buf[ 7] = hc_swap32_S (enc_buf[ 7]);
enc_buf[ 8] = hc_swap32_S (enc_buf[ 8]);
enc_buf[ 9] = hc_swap32_S (enc_buf[ 9]);
enc_buf[10] = hc_swap32_S (enc_buf[10]);
enc_buf[11] = hc_swap32_S (enc_buf[11]);
enc_buf[12] = hc_swap32_S (enc_buf[12]);
enc_buf[13] = hc_swap32_S (enc_buf[13]);
enc_buf[14] = hc_swap32_S (enc_buf[14]);
enc_buf[15] = hc_swap32_S (enc_buf[15]);
enc_buf[16] = hc_swap32_S (enc_buf[16]);
enc_buf[17] = hc_swap32_S (enc_buf[17]);
enc_buf[18] = hc_swap32_S (enc_buf[18]);
enc_buf[19] = hc_swap32_S (enc_buf[19]);
enc_buf[20] = hc_swap32_S (enc_buf[20]);
enc_buf[21] = hc_swap32_S (enc_buf[21]);
enc_buf[22] = hc_swap32_S (enc_buf[22]);
enc_buf[23] = hc_swap32_S (enc_buf[23]);
enc_buf[24] = hc_swap32_S (enc_buf[24]);
enc_buf[25] = hc_swap32_S (enc_buf[25]);
enc_buf[26] = hc_swap32_S (enc_buf[26]);
enc_buf[27] = hc_swap32_S (enc_buf[27]);
enc_buf[28] = hc_swap32_S (enc_buf[28]);
enc_buf[29] = hc_swap32_S (enc_buf[29]);
enc_buf[30] = hc_swap32_S (enc_buf[30]);
enc_buf[31] = hc_swap32_S (enc_buf[31]);
sha384_update_128 (ctx, enc_buf + 0, enc_buf + 4, enc_buf + 8, enc_buf + 12, enc_buf + 16, enc_buf + 20, enc_buf + 24, enc_buf + 28, enc_len);
}
return;
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
@ -1260,7 +1400,7 @@ DECLSPEC void sha384_update_global_utf16le_swap (sha384_ctx_t *ctx, GLOBAL_AS co
DECLSPEC void sha384_final (sha384_ctx_t *ctx)
{
MAYBE_VOLATILE const int pos = ctx->len & 127;
const int pos = ctx->len & 127;
append_0x80_8x4_S (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->w4, ctx->w5, ctx->w6, ctx->w7, pos ^ 3);
@ -1312,92 +1452,101 @@ DECLSPEC void sha384_final (sha384_ctx_t *ctx)
DECLSPEC void sha384_hmac_init_128 (sha384_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, const u32 *w4, const u32 *w5, const u32 *w6, const u32 *w7)
{
u32 t0[4];
u32 t1[4];
u32 t2[4];
u32 t3[4];
u32 t4[4];
u32 t5[4];
u32 t6[4];
u32 t7[4];
u32 a0[4];
u32 a1[4];
u32 a2[4];
u32 a3[4];
u32 a4[4];
u32 a5[4];
u32 a6[4];
u32 a7[4];
// ipad
t0[0] = w0[0] ^ 0x36363636;
t0[1] = w0[1] ^ 0x36363636;
t0[2] = w0[2] ^ 0x36363636;
t0[3] = w0[3] ^ 0x36363636;
t1[0] = w1[0] ^ 0x36363636;
t1[1] = w1[1] ^ 0x36363636;
t1[2] = w1[2] ^ 0x36363636;
t1[3] = w1[3] ^ 0x36363636;
t2[0] = w2[0] ^ 0x36363636;
t2[1] = w2[1] ^ 0x36363636;
t2[2] = w2[2] ^ 0x36363636;
t2[3] = w2[3] ^ 0x36363636;
t3[0] = w3[0] ^ 0x36363636;
t3[1] = w3[1] ^ 0x36363636;
t3[2] = w3[2] ^ 0x36363636;
t3[3] = w3[3] ^ 0x36363636;
t4[0] = w4[0] ^ 0x36363636;
t4[1] = w4[1] ^ 0x36363636;
t4[2] = w4[2] ^ 0x36363636;
t4[3] = w4[3] ^ 0x36363636;
t5[0] = w5[0] ^ 0x36363636;
t5[1] = w5[1] ^ 0x36363636;
t5[2] = w5[2] ^ 0x36363636;
t5[3] = w5[3] ^ 0x36363636;
t6[0] = w6[0] ^ 0x36363636;
t6[1] = w6[1] ^ 0x36363636;
t6[2] = w6[2] ^ 0x36363636;
t6[3] = w6[3] ^ 0x36363636;
t7[0] = w7[0] ^ 0x36363636;
t7[1] = w7[1] ^ 0x36363636;
t7[2] = w7[2] ^ 0x36363636;
t7[3] = w7[3] ^ 0x36363636;
a0[0] = w0[0] ^ 0x36363636;
a0[1] = w0[1] ^ 0x36363636;
a0[2] = w0[2] ^ 0x36363636;
a0[3] = w0[3] ^ 0x36363636;
a1[0] = w1[0] ^ 0x36363636;
a1[1] = w1[1] ^ 0x36363636;
a1[2] = w1[2] ^ 0x36363636;
a1[3] = w1[3] ^ 0x36363636;
a2[0] = w2[0] ^ 0x36363636;
a2[1] = w2[1] ^ 0x36363636;
a2[2] = w2[2] ^ 0x36363636;
a2[3] = w2[3] ^ 0x36363636;
a3[0] = w3[0] ^ 0x36363636;
a3[1] = w3[1] ^ 0x36363636;
a3[2] = w3[2] ^ 0x36363636;
a3[3] = w3[3] ^ 0x36363636;
a4[0] = w4[0] ^ 0x36363636;
a4[1] = w4[1] ^ 0x36363636;
a4[2] = w4[2] ^ 0x36363636;
a4[3] = w4[3] ^ 0x36363636;
a5[0] = w5[0] ^ 0x36363636;
a5[1] = w5[1] ^ 0x36363636;
a5[2] = w5[2] ^ 0x36363636;
a5[3] = w5[3] ^ 0x36363636;
a6[0] = w6[0] ^ 0x36363636;
a6[1] = w6[1] ^ 0x36363636;
a6[2] = w6[2] ^ 0x36363636;
a6[3] = w6[3] ^ 0x36363636;
a7[0] = w7[0] ^ 0x36363636;
a7[1] = w7[1] ^ 0x36363636;
a7[2] = w7[2] ^ 0x36363636;
a7[3] = w7[3] ^ 0x36363636;
sha384_init (&ctx->ipad);
sha384_update_128 (&ctx->ipad, t0, t1, t2, t3, t4, t5, t6, t7, 128);
sha384_update_128 (&ctx->ipad, a0, a1, a2, a3, a4, a5, a6, a7, 128);
// opad
t0[0] = w0[0] ^ 0x5c5c5c5c;
t0[1] = w0[1] ^ 0x5c5c5c5c;
t0[2] = w0[2] ^ 0x5c5c5c5c;
t0[3] = w0[3] ^ 0x5c5c5c5c;
t1[0] = w1[0] ^ 0x5c5c5c5c;
t1[1] = w1[1] ^ 0x5c5c5c5c;
t1[2] = w1[2] ^ 0x5c5c5c5c;
t1[3] = w1[3] ^ 0x5c5c5c5c;
t2[0] = w2[0] ^ 0x5c5c5c5c;
t2[1] = w2[1] ^ 0x5c5c5c5c;
t2[2] = w2[2] ^ 0x5c5c5c5c;
t2[3] = w2[3] ^ 0x5c5c5c5c;
t3[0] = w3[0] ^ 0x5c5c5c5c;
t3[1] = w3[1] ^ 0x5c5c5c5c;
t3[2] = w3[2] ^ 0x5c5c5c5c;
t3[3] = w3[3] ^ 0x5c5c5c5c;
t4[0] = w4[0] ^ 0x5c5c5c5c;
t4[1] = w4[1] ^ 0x5c5c5c5c;
t4[2] = w4[2] ^ 0x5c5c5c5c;
t4[3] = w4[3] ^ 0x5c5c5c5c;
t5[0] = w5[0] ^ 0x5c5c5c5c;
t5[1] = w5[1] ^ 0x5c5c5c5c;
t5[2] = w5[2] ^ 0x5c5c5c5c;
t5[3] = w5[3] ^ 0x5c5c5c5c;
t6[0] = w6[0] ^ 0x5c5c5c5c;
t6[1] = w6[1] ^ 0x5c5c5c5c;
t6[2] = w6[2] ^ 0x5c5c5c5c;
t6[3] = w6[3] ^ 0x5c5c5c5c;
t7[0] = w7[0] ^ 0x5c5c5c5c;
t7[1] = w7[1] ^ 0x5c5c5c5c;
t7[2] = w7[2] ^ 0x5c5c5c5c;
t7[3] = w7[3] ^ 0x5c5c5c5c;
u32x b0[4];
u32x b1[4];
u32x b2[4];
u32x b3[4];
u32x b4[4];
u32x b5[4];
u32x b6[4];
u32x b7[4];
b0[0] = w0[0] ^ 0x5c5c5c5c;
b0[1] = w0[1] ^ 0x5c5c5c5c;
b0[2] = w0[2] ^ 0x5c5c5c5c;
b0[3] = w0[3] ^ 0x5c5c5c5c;
b1[0] = w1[0] ^ 0x5c5c5c5c;
b1[1] = w1[1] ^ 0x5c5c5c5c;
b1[2] = w1[2] ^ 0x5c5c5c5c;
b1[3] = w1[3] ^ 0x5c5c5c5c;
b2[0] = w2[0] ^ 0x5c5c5c5c;
b2[1] = w2[1] ^ 0x5c5c5c5c;
b2[2] = w2[2] ^ 0x5c5c5c5c;
b2[3] = w2[3] ^ 0x5c5c5c5c;
b3[0] = w3[0] ^ 0x5c5c5c5c;
b3[1] = w3[1] ^ 0x5c5c5c5c;
b3[2] = w3[2] ^ 0x5c5c5c5c;
b3[3] = w3[3] ^ 0x5c5c5c5c;
b4[0] = w4[0] ^ 0x5c5c5c5c;
b4[1] = w4[1] ^ 0x5c5c5c5c;
b4[2] = w4[2] ^ 0x5c5c5c5c;
b4[3] = w4[3] ^ 0x5c5c5c5c;
b5[0] = w5[0] ^ 0x5c5c5c5c;
b5[1] = w5[1] ^ 0x5c5c5c5c;
b5[2] = w5[2] ^ 0x5c5c5c5c;
b5[3] = w5[3] ^ 0x5c5c5c5c;
b6[0] = w6[0] ^ 0x5c5c5c5c;
b6[1] = w6[1] ^ 0x5c5c5c5c;
b6[2] = w6[2] ^ 0x5c5c5c5c;
b6[3] = w6[3] ^ 0x5c5c5c5c;
b7[0] = w7[0] ^ 0x5c5c5c5c;
b7[1] = w7[1] ^ 0x5c5c5c5c;
b7[2] = w7[2] ^ 0x5c5c5c5c;
b7[3] = w7[3] ^ 0x5c5c5c5c;
sha384_init (&ctx->opad);
sha384_update_128 (&ctx->opad, t0, t1, t2, t3, t4, t5, t6, t7, 128);
sha384_update_128 (&ctx->opad, b0, b1, b2, b3, b4, b5, b6, b7, 128);
}
DECLSPEC void sha384_hmac_init (sha384_hmac_ctx_t *ctx, const u32 *w, const int len)
@ -2048,7 +2197,9 @@ DECLSPEC void sha384_init_vector_from_scalar (sha384_ctx_vector_t *ctx, sha384_c
DECLSPEC void sha384_update_vector_128 (sha384_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, const int len)
{
MAYBE_VOLATILE const int pos = ctx->len & 127;
if (len == 0) return;
const int pos = ctx->len & 127;
ctx->len += len;
@ -2756,7 +2907,7 @@ DECLSPEC void sha384_update_vector_utf16beN (sha384_ctx_vector_t *ctx, const u32
DECLSPEC void sha384_final_vector (sha384_ctx_vector_t *ctx)
{
MAYBE_VOLATILE const int pos = ctx->len & 127;
const int pos = ctx->len & 127;
append_0x80_8x4 (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->w4, ctx->w5, ctx->w6, ctx->w7, pos ^ 3);
@ -2808,92 +2959,101 @@ DECLSPEC void sha384_final_vector (sha384_ctx_vector_t *ctx)
DECLSPEC void sha384_hmac_init_vector_128 (sha384_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, const u32x *w4, const u32x *w5, const u32x *w6, const u32x *w7)
{
u32x t0[4];
u32x t1[4];
u32x t2[4];
u32x t3[4];
u32x t4[4];
u32x t5[4];
u32x t6[4];
u32x t7[4];
u32x a0[4];
u32x a1[4];
u32x a2[4];
u32x a3[4];
u32x a4[4];
u32x a5[4];
u32x a6[4];
u32x a7[4];
// ipad
t0[0] = w0[0] ^ 0x36363636;
t0[1] = w0[1] ^ 0x36363636;
t0[2] = w0[2] ^ 0x36363636;
t0[3] = w0[3] ^ 0x36363636;
t1[0] = w1[0] ^ 0x36363636;
t1[1] = w1[1] ^ 0x36363636;
t1[2] = w1[2] ^ 0x36363636;
t1[3] = w1[3] ^ 0x36363636;
t2[0] = w2[0] ^ 0x36363636;
t2[1] = w2[1] ^ 0x36363636;
t2[2] = w2[2] ^ 0x36363636;
t2[3] = w2[3] ^ 0x36363636;
t3[0] = w3[0] ^ 0x36363636;
t3[1] = w3[1] ^ 0x36363636;
t3[2] = w3[2] ^ 0x36363636;
t3[3] = w3[3] ^ 0x36363636;
t4[0] = w4[0] ^ 0x36363636;
t4[1] = w4[1] ^ 0x36363636;
t4[2] = w4[2] ^ 0x36363636;
t4[3] = w4[3] ^ 0x36363636;
t5[0] = w5[0] ^ 0x36363636;
t5[1] = w5[1] ^ 0x36363636;
t5[2] = w5[2] ^ 0x36363636;
t5[3] = w5[3] ^ 0x36363636;
t6[0] = w6[0] ^ 0x36363636;
t6[1] = w6[1] ^ 0x36363636;
t6[2] = w6[2] ^ 0x36363636;
t6[3] = w6[3] ^ 0x36363636;
t7[0] = w7[0] ^ 0x36363636;
t7[1] = w7[1] ^ 0x36363636;
t7[2] = w7[2] ^ 0x36363636;
t7[3] = w7[3] ^ 0x36363636;
a0[0] = w0[0] ^ 0x36363636;
a0[1] = w0[1] ^ 0x36363636;
a0[2] = w0[2] ^ 0x36363636;
a0[3] = w0[3] ^ 0x36363636;
a1[0] = w1[0] ^ 0x36363636;
a1[1] = w1[1] ^ 0x36363636;
a1[2] = w1[2] ^ 0x36363636;
a1[3] = w1[3] ^ 0x36363636;
a2[0] = w2[0] ^ 0x36363636;
a2[1] = w2[1] ^ 0x36363636;
a2[2] = w2[2] ^ 0x36363636;
a2[3] = w2[3] ^ 0x36363636;
a3[0] = w3[0] ^ 0x36363636;
a3[1] = w3[1] ^ 0x36363636;
a3[2] = w3[2] ^ 0x36363636;
a3[3] = w3[3] ^ 0x36363636;
a4[0] = w4[0] ^ 0x36363636;
a4[1] = w4[1] ^ 0x36363636;
a4[2] = w4[2] ^ 0x36363636;
a4[3] = w4[3] ^ 0x36363636;
a5[0] = w5[0] ^ 0x36363636;
a5[1] = w5[1] ^ 0x36363636;
a5[2] = w5[2] ^ 0x36363636;
a5[3] = w5[3] ^ 0x36363636;
a6[0] = w6[0] ^ 0x36363636;
a6[1] = w6[1] ^ 0x36363636;
a6[2] = w6[2] ^ 0x36363636;
a6[3] = w6[3] ^ 0x36363636;
a7[0] = w7[0] ^ 0x36363636;
a7[1] = w7[1] ^ 0x36363636;
a7[2] = w7[2] ^ 0x36363636;
a7[3] = w7[3] ^ 0x36363636;
sha384_init_vector (&ctx->ipad);
sha384_update_vector_128 (&ctx->ipad, t0, t1, t2, t3, t4, t5, t6, t7, 128);
sha384_update_vector_128 (&ctx->ipad, a0, a1, a2, a3, a4, a5, a6, a7, 128);
// opad
t0[0] = w0[0] ^ 0x5c5c5c5c;
t0[1] = w0[1] ^ 0x5c5c5c5c;
t0[2] = w0[2] ^ 0x5c5c5c5c;
t0[3] = w0[3] ^ 0x5c5c5c5c;
t1[0] = w1[0] ^ 0x5c5c5c5c;
t1[1] = w1[1] ^ 0x5c5c5c5c;
t1[2] = w1[2] ^ 0x5c5c5c5c;
t1[3] = w1[3] ^ 0x5c5c5c5c;
t2[0] = w2[0] ^ 0x5c5c5c5c;
t2[1] = w2[1] ^ 0x5c5c5c5c;
t2[2] = w2[2] ^ 0x5c5c5c5c;
t2[3] = w2[3] ^ 0x5c5c5c5c;
t3[0] = w3[0] ^ 0x5c5c5c5c;
t3[1] = w3[1] ^ 0x5c5c5c5c;
t3[2] = w3[2] ^ 0x5c5c5c5c;
t3[3] = w3[3] ^ 0x5c5c5c5c;
t4[0] = w4[0] ^ 0x5c5c5c5c;
t4[1] = w4[1] ^ 0x5c5c5c5c;
t4[2] = w4[2] ^ 0x5c5c5c5c;
t4[3] = w4[3] ^ 0x5c5c5c5c;
t5[0] = w5[0] ^ 0x5c5c5c5c;
t5[1] = w5[1] ^ 0x5c5c5c5c;
t5[2] = w5[2] ^ 0x5c5c5c5c;
t5[3] = w5[3] ^ 0x5c5c5c5c;
t6[0] = w6[0] ^ 0x5c5c5c5c;
t6[1] = w6[1] ^ 0x5c5c5c5c;
t6[2] = w6[2] ^ 0x5c5c5c5c;
t6[3] = w6[3] ^ 0x5c5c5c5c;
t7[0] = w7[0] ^ 0x5c5c5c5c;
t7[1] = w7[1] ^ 0x5c5c5c5c;
t7[2] = w7[2] ^ 0x5c5c5c5c;
t7[3] = w7[3] ^ 0x5c5c5c5c;
u32 b0[4];
u32 b1[4];
u32 b2[4];
u32 b3[4];
u32 b4[4];
u32 b5[4];
u32 b6[4];
u32 b7[4];
b0[0] = w0[0] ^ 0x5c5c5c5c;
b0[1] = w0[1] ^ 0x5c5c5c5c;
b0[2] = w0[2] ^ 0x5c5c5c5c;
b0[3] = w0[3] ^ 0x5c5c5c5c;
b1[0] = w1[0] ^ 0x5c5c5c5c;
b1[1] = w1[1] ^ 0x5c5c5c5c;
b1[2] = w1[2] ^ 0x5c5c5c5c;
b1[3] = w1[3] ^ 0x5c5c5c5c;
b2[0] = w2[0] ^ 0x5c5c5c5c;
b2[1] = w2[1] ^ 0x5c5c5c5c;
b2[2] = w2[2] ^ 0x5c5c5c5c;
b2[3] = w2[3] ^ 0x5c5c5c5c;
b3[0] = w3[0] ^ 0x5c5c5c5c;
b3[1] = w3[1] ^ 0x5c5c5c5c;
b3[2] = w3[2] ^ 0x5c5c5c5c;
b3[3] = w3[3] ^ 0x5c5c5c5c;
b4[0] = w4[0] ^ 0x5c5c5c5c;
b4[1] = w4[1] ^ 0x5c5c5c5c;
b4[2] = w4[2] ^ 0x5c5c5c5c;
b4[3] = w4[3] ^ 0x5c5c5c5c;
b5[0] = w5[0] ^ 0x5c5c5c5c;
b5[1] = w5[1] ^ 0x5c5c5c5c;
b5[2] = w5[2] ^ 0x5c5c5c5c;
b5[3] = w5[3] ^ 0x5c5c5c5c;
b6[0] = w6[0] ^ 0x5c5c5c5c;
b6[1] = w6[1] ^ 0x5c5c5c5c;
b6[2] = w6[2] ^ 0x5c5c5c5c;
b6[3] = w6[3] ^ 0x5c5c5c5c;
b7[0] = w7[0] ^ 0x5c5c5c5c;
b7[1] = w7[1] ^ 0x5c5c5c5c;
b7[2] = w7[2] ^ 0x5c5c5c5c;
b7[3] = w7[3] ^ 0x5c5c5c5c;
sha384_init_vector (&ctx->opad);
sha384_update_vector_128 (&ctx->opad, t0, t1, t2, t3, t4, t5, t6, t7, 128);
sha384_update_vector_128 (&ctx->opad, b0, b1, b2, b3, b4, b5, b6, b7, 128);
}
DECLSPEC void sha384_hmac_init_vector (sha384_hmac_ctx_vector_t *ctx, const u32x *w, const int len)

View File

@ -178,7 +178,9 @@ DECLSPEC void sha512_init (sha512_ctx_t *ctx)
DECLSPEC void sha512_update_128 (sha512_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, u32 *w4, u32 *w5, u32 *w6, u32 *w7, const int len)
{
MAYBE_VOLATILE const int pos = ctx->len & 127;
if (len == 0) return;
const int pos = ctx->len & 127;
ctx->len += len;
@ -622,6 +624,24 @@ DECLSPEC void sha512_update_swap (sha512_ctx_t *ctx, const u32 *w, const int len
DECLSPEC void sha512_update_utf16le (sha512_ctx_t *ctx, const u32 *w, const int len)
{
if (hc_enc_scan (w, len))
{
hc_enc_t hc_enc;
hc_enc_init (&hc_enc);
while (hc_enc_has_next (&hc_enc, len))
{
u32 enc_buf[32] = { 0 };
const int enc_len = hc_enc_next (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
sha512_update_128 (ctx, enc_buf + 0, enc_buf + 4, enc_buf + 8, enc_buf + 12, enc_buf + 16, enc_buf + 20, enc_buf + 24, enc_buf + 28, enc_len);
}
return;
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
@ -688,6 +708,57 @@ DECLSPEC void sha512_update_utf16le (sha512_ctx_t *ctx, const u32 *w, const int
DECLSPEC void sha512_update_utf16le_swap (sha512_ctx_t *ctx, const u32 *w, const int len)
{
if (hc_enc_scan (w, len))
{
hc_enc_t hc_enc;
hc_enc_init (&hc_enc);
while (hc_enc_has_next (&hc_enc, len))
{
u32 enc_buf[32] = { 0 };
const int enc_len = hc_enc_next (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
enc_buf[ 0] = hc_swap32_S (enc_buf[ 0]);
enc_buf[ 1] = hc_swap32_S (enc_buf[ 1]);
enc_buf[ 2] = hc_swap32_S (enc_buf[ 2]);
enc_buf[ 3] = hc_swap32_S (enc_buf[ 3]);
enc_buf[ 4] = hc_swap32_S (enc_buf[ 4]);
enc_buf[ 5] = hc_swap32_S (enc_buf[ 5]);
enc_buf[ 6] = hc_swap32_S (enc_buf[ 6]);
enc_buf[ 7] = hc_swap32_S (enc_buf[ 7]);
enc_buf[ 8] = hc_swap32_S (enc_buf[ 8]);
enc_buf[ 9] = hc_swap32_S (enc_buf[ 9]);
enc_buf[10] = hc_swap32_S (enc_buf[10]);
enc_buf[11] = hc_swap32_S (enc_buf[11]);
enc_buf[12] = hc_swap32_S (enc_buf[12]);
enc_buf[13] = hc_swap32_S (enc_buf[13]);
enc_buf[14] = hc_swap32_S (enc_buf[14]);
enc_buf[15] = hc_swap32_S (enc_buf[15]);
enc_buf[16] = hc_swap32_S (enc_buf[16]);
enc_buf[17] = hc_swap32_S (enc_buf[17]);
enc_buf[18] = hc_swap32_S (enc_buf[18]);
enc_buf[19] = hc_swap32_S (enc_buf[19]);
enc_buf[20] = hc_swap32_S (enc_buf[20]);
enc_buf[21] = hc_swap32_S (enc_buf[21]);
enc_buf[22] = hc_swap32_S (enc_buf[22]);
enc_buf[23] = hc_swap32_S (enc_buf[23]);
enc_buf[24] = hc_swap32_S (enc_buf[24]);
enc_buf[25] = hc_swap32_S (enc_buf[25]);
enc_buf[26] = hc_swap32_S (enc_buf[26]);
enc_buf[27] = hc_swap32_S (enc_buf[27]);
enc_buf[28] = hc_swap32_S (enc_buf[28]);
enc_buf[29] = hc_swap32_S (enc_buf[29]);
enc_buf[30] = hc_swap32_S (enc_buf[30]);
enc_buf[31] = hc_swap32_S (enc_buf[31]);
sha512_update_128 (ctx, enc_buf + 0, enc_buf + 4, enc_buf + 8, enc_buf + 12, enc_buf + 16, enc_buf + 20, enc_buf + 24, enc_buf + 28, enc_len);
}
return;
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
@ -1062,6 +1133,24 @@ DECLSPEC void sha512_update_global_swap (sha512_ctx_t *ctx, GLOBAL_AS const u32
DECLSPEC void sha512_update_global_utf16le (sha512_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{
if (hc_enc_scan_global (w, len))
{
hc_enc_t hc_enc;
hc_enc_init (&hc_enc);
while (hc_enc_has_next (&hc_enc, len))
{
u32 enc_buf[32] = { 0 };
const int enc_len = hc_enc_next_global (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
sha512_update_128 (ctx, enc_buf + 0, enc_buf + 4, enc_buf + 8, enc_buf + 12, enc_buf + 16, enc_buf + 20, enc_buf + 24, enc_buf + 28, enc_len);
}
return;
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
@ -1128,6 +1217,57 @@ DECLSPEC void sha512_update_global_utf16le (sha512_ctx_t *ctx, GLOBAL_AS const u
DECLSPEC void sha512_update_global_utf16le_swap (sha512_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{
if (hc_enc_scan_global (w, len))
{
hc_enc_t hc_enc;
hc_enc_init (&hc_enc);
while (hc_enc_has_next (&hc_enc, len))
{
u32 enc_buf[32] = { 0 };
const int enc_len = hc_enc_next_global (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
enc_buf[ 0] = hc_swap32_S (enc_buf[ 0]);
enc_buf[ 1] = hc_swap32_S (enc_buf[ 1]);
enc_buf[ 2] = hc_swap32_S (enc_buf[ 2]);
enc_buf[ 3] = hc_swap32_S (enc_buf[ 3]);
enc_buf[ 4] = hc_swap32_S (enc_buf[ 4]);
enc_buf[ 5] = hc_swap32_S (enc_buf[ 5]);
enc_buf[ 6] = hc_swap32_S (enc_buf[ 6]);
enc_buf[ 7] = hc_swap32_S (enc_buf[ 7]);
enc_buf[ 8] = hc_swap32_S (enc_buf[ 8]);
enc_buf[ 9] = hc_swap32_S (enc_buf[ 9]);
enc_buf[10] = hc_swap32_S (enc_buf[10]);
enc_buf[11] = hc_swap32_S (enc_buf[11]);
enc_buf[12] = hc_swap32_S (enc_buf[12]);
enc_buf[13] = hc_swap32_S (enc_buf[13]);
enc_buf[14] = hc_swap32_S (enc_buf[14]);
enc_buf[15] = hc_swap32_S (enc_buf[15]);
enc_buf[16] = hc_swap32_S (enc_buf[16]);
enc_buf[17] = hc_swap32_S (enc_buf[17]);
enc_buf[18] = hc_swap32_S (enc_buf[18]);
enc_buf[19] = hc_swap32_S (enc_buf[19]);
enc_buf[20] = hc_swap32_S (enc_buf[20]);
enc_buf[21] = hc_swap32_S (enc_buf[21]);
enc_buf[22] = hc_swap32_S (enc_buf[22]);
enc_buf[23] = hc_swap32_S (enc_buf[23]);
enc_buf[24] = hc_swap32_S (enc_buf[24]);
enc_buf[25] = hc_swap32_S (enc_buf[25]);
enc_buf[26] = hc_swap32_S (enc_buf[26]);
enc_buf[27] = hc_swap32_S (enc_buf[27]);
enc_buf[28] = hc_swap32_S (enc_buf[28]);
enc_buf[29] = hc_swap32_S (enc_buf[29]);
enc_buf[30] = hc_swap32_S (enc_buf[30]);
enc_buf[31] = hc_swap32_S (enc_buf[31]);
sha512_update_128 (ctx, enc_buf + 0, enc_buf + 4, enc_buf + 8, enc_buf + 12, enc_buf + 16, enc_buf + 20, enc_buf + 24, enc_buf + 28, enc_len);
}
return;
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
@ -1260,7 +1400,7 @@ DECLSPEC void sha512_update_global_utf16le_swap (sha512_ctx_t *ctx, GLOBAL_AS co
DECLSPEC void sha512_final (sha512_ctx_t *ctx)
{
MAYBE_VOLATILE const int pos = ctx->len & 127;
const int pos = ctx->len & 127;
append_0x80_8x4_S (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->w4, ctx->w5, ctx->w6, ctx->w7, pos ^ 3);
@ -1312,92 +1452,101 @@ DECLSPEC void sha512_final (sha512_ctx_t *ctx)
DECLSPEC void sha512_hmac_init_128 (sha512_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, const u32 *w4, const u32 *w5, const u32 *w6, const u32 *w7)
{
u32 t0[4];
u32 t1[4];
u32 t2[4];
u32 t3[4];
u32 t4[4];
u32 t5[4];
u32 t6[4];
u32 t7[4];
u32 a0[4];
u32 a1[4];
u32 a2[4];
u32 a3[4];
u32 a4[4];
u32 a5[4];
u32 a6[4];
u32 a7[4];
// ipad
t0[0] = w0[0] ^ 0x36363636;
t0[1] = w0[1] ^ 0x36363636;
t0[2] = w0[2] ^ 0x36363636;
t0[3] = w0[3] ^ 0x36363636;
t1[0] = w1[0] ^ 0x36363636;
t1[1] = w1[1] ^ 0x36363636;
t1[2] = w1[2] ^ 0x36363636;
t1[3] = w1[3] ^ 0x36363636;
t2[0] = w2[0] ^ 0x36363636;
t2[1] = w2[1] ^ 0x36363636;
t2[2] = w2[2] ^ 0x36363636;
t2[3] = w2[3] ^ 0x36363636;
t3[0] = w3[0] ^ 0x36363636;
t3[1] = w3[1] ^ 0x36363636;
t3[2] = w3[2] ^ 0x36363636;
t3[3] = w3[3] ^ 0x36363636;
t4[0] = w4[0] ^ 0x36363636;
t4[1] = w4[1] ^ 0x36363636;
t4[2] = w4[2] ^ 0x36363636;
t4[3] = w4[3] ^ 0x36363636;
t5[0] = w5[0] ^ 0x36363636;
t5[1] = w5[1] ^ 0x36363636;
t5[2] = w5[2] ^ 0x36363636;
t5[3] = w5[3] ^ 0x36363636;
t6[0] = w6[0] ^ 0x36363636;
t6[1] = w6[1] ^ 0x36363636;
t6[2] = w6[2] ^ 0x36363636;
t6[3] = w6[3] ^ 0x36363636;
t7[0] = w7[0] ^ 0x36363636;
t7[1] = w7[1] ^ 0x36363636;
t7[2] = w7[2] ^ 0x36363636;
t7[3] = w7[3] ^ 0x36363636;
a0[0] = w0[0] ^ 0x36363636;
a0[1] = w0[1] ^ 0x36363636;
a0[2] = w0[2] ^ 0x36363636;
a0[3] = w0[3] ^ 0x36363636;
a1[0] = w1[0] ^ 0x36363636;
a1[1] = w1[1] ^ 0x36363636;
a1[2] = w1[2] ^ 0x36363636;
a1[3] = w1[3] ^ 0x36363636;
a2[0] = w2[0] ^ 0x36363636;
a2[1] = w2[1] ^ 0x36363636;
a2[2] = w2[2] ^ 0x36363636;
a2[3] = w2[3] ^ 0x36363636;
a3[0] = w3[0] ^ 0x36363636;
a3[1] = w3[1] ^ 0x36363636;
a3[2] = w3[2] ^ 0x36363636;
a3[3] = w3[3] ^ 0x36363636;
a4[0] = w4[0] ^ 0x36363636;
a4[1] = w4[1] ^ 0x36363636;
a4[2] = w4[2] ^ 0x36363636;
a4[3] = w4[3] ^ 0x36363636;
a5[0] = w5[0] ^ 0x36363636;
a5[1] = w5[1] ^ 0x36363636;
a5[2] = w5[2] ^ 0x36363636;
a5[3] = w5[3] ^ 0x36363636;
a6[0] = w6[0] ^ 0x36363636;
a6[1] = w6[1] ^ 0x36363636;
a6[2] = w6[2] ^ 0x36363636;
a6[3] = w6[3] ^ 0x36363636;
a7[0] = w7[0] ^ 0x36363636;
a7[1] = w7[1] ^ 0x36363636;
a7[2] = w7[2] ^ 0x36363636;
a7[3] = w7[3] ^ 0x36363636;
sha512_init (&ctx->ipad);
sha512_update_128 (&ctx->ipad, t0, t1, t2, t3, t4, t5, t6, t7, 128);
sha512_update_128 (&ctx->ipad, a0, a1, a2, a3, a4, a5, a6, a7, 128);
// opad
t0[0] = w0[0] ^ 0x5c5c5c5c;
t0[1] = w0[1] ^ 0x5c5c5c5c;
t0[2] = w0[2] ^ 0x5c5c5c5c;
t0[3] = w0[3] ^ 0x5c5c5c5c;
t1[0] = w1[0] ^ 0x5c5c5c5c;
t1[1] = w1[1] ^ 0x5c5c5c5c;
t1[2] = w1[2] ^ 0x5c5c5c5c;
t1[3] = w1[3] ^ 0x5c5c5c5c;
t2[0] = w2[0] ^ 0x5c5c5c5c;
t2[1] = w2[1] ^ 0x5c5c5c5c;
t2[2] = w2[2] ^ 0x5c5c5c5c;
t2[3] = w2[3] ^ 0x5c5c5c5c;
t3[0] = w3[0] ^ 0x5c5c5c5c;
t3[1] = w3[1] ^ 0x5c5c5c5c;
t3[2] = w3[2] ^ 0x5c5c5c5c;
t3[3] = w3[3] ^ 0x5c5c5c5c;
t4[0] = w4[0] ^ 0x5c5c5c5c;
t4[1] = w4[1] ^ 0x5c5c5c5c;
t4[2] = w4[2] ^ 0x5c5c5c5c;
t4[3] = w4[3] ^ 0x5c5c5c5c;
t5[0] = w5[0] ^ 0x5c5c5c5c;
t5[1] = w5[1] ^ 0x5c5c5c5c;
t5[2] = w5[2] ^ 0x5c5c5c5c;
t5[3] = w5[3] ^ 0x5c5c5c5c;
t6[0] = w6[0] ^ 0x5c5c5c5c;
t6[1] = w6[1] ^ 0x5c5c5c5c;
t6[2] = w6[2] ^ 0x5c5c5c5c;
t6[3] = w6[3] ^ 0x5c5c5c5c;
t7[0] = w7[0] ^ 0x5c5c5c5c;
t7[1] = w7[1] ^ 0x5c5c5c5c;
t7[2] = w7[2] ^ 0x5c5c5c5c;
t7[3] = w7[3] ^ 0x5c5c5c5c;
u32 b0[4];
u32 b1[4];
u32 b2[4];
u32 b3[4];
u32 b4[4];
u32 b5[4];
u32 b6[4];
u32 b7[4];
b0[0] = w0[0] ^ 0x5c5c5c5c;
b0[1] = w0[1] ^ 0x5c5c5c5c;
b0[2] = w0[2] ^ 0x5c5c5c5c;
b0[3] = w0[3] ^ 0x5c5c5c5c;
b1[0] = w1[0] ^ 0x5c5c5c5c;
b1[1] = w1[1] ^ 0x5c5c5c5c;
b1[2] = w1[2] ^ 0x5c5c5c5c;
b1[3] = w1[3] ^ 0x5c5c5c5c;
b2[0] = w2[0] ^ 0x5c5c5c5c;
b2[1] = w2[1] ^ 0x5c5c5c5c;
b2[2] = w2[2] ^ 0x5c5c5c5c;
b2[3] = w2[3] ^ 0x5c5c5c5c;
b3[0] = w3[0] ^ 0x5c5c5c5c;
b3[1] = w3[1] ^ 0x5c5c5c5c;
b3[2] = w3[2] ^ 0x5c5c5c5c;
b3[3] = w3[3] ^ 0x5c5c5c5c;
b4[0] = w4[0] ^ 0x5c5c5c5c;
b4[1] = w4[1] ^ 0x5c5c5c5c;
b4[2] = w4[2] ^ 0x5c5c5c5c;
b4[3] = w4[3] ^ 0x5c5c5c5c;
b5[0] = w5[0] ^ 0x5c5c5c5c;
b5[1] = w5[1] ^ 0x5c5c5c5c;
b5[2] = w5[2] ^ 0x5c5c5c5c;
b5[3] = w5[3] ^ 0x5c5c5c5c;
b6[0] = w6[0] ^ 0x5c5c5c5c;
b6[1] = w6[1] ^ 0x5c5c5c5c;
b6[2] = w6[2] ^ 0x5c5c5c5c;
b6[3] = w6[3] ^ 0x5c5c5c5c;
b7[0] = w7[0] ^ 0x5c5c5c5c;
b7[1] = w7[1] ^ 0x5c5c5c5c;
b7[2] = w7[2] ^ 0x5c5c5c5c;
b7[3] = w7[3] ^ 0x5c5c5c5c;
sha512_init (&ctx->opad);
sha512_update_128 (&ctx->opad, t0, t1, t2, t3, t4, t5, t6, t7, 128);
sha512_update_128 (&ctx->opad, b0, b1, b2, b3, b4, b5, b6, b7, 128);
}
DECLSPEC void sha512_hmac_init (sha512_hmac_ctx_t *ctx, const u32 *w, const int len)
@ -1774,6 +1923,105 @@ DECLSPEC void sha512_hmac_init_global_swap (sha512_hmac_ctx_t *ctx, GLOBAL_AS co
DECLSPEC void sha512_hmac_init_global_utf16le_swap (sha512_hmac_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{
if (hc_enc_scan_global (w, len))
{
hc_enc_t hc_enc;
hc_enc_init (&hc_enc);
while (hc_enc_has_next (&hc_enc, len))
{
// forced full decode in one round
u32 enc_buf[256];
const int enc_len = hc_enc_next_global (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
if (enc_len > 128)
{
sha512_ctx_t tmp;
sha512_init (&tmp);
sha512_update_utf16le_swap (&tmp, enc_buf, enc_len);
sha512_final (&tmp);
enc_buf[ 0] = h32_from_64_S (tmp.h[0]);
enc_buf[ 1] = l32_from_64_S (tmp.h[0]);
enc_buf[ 2] = h32_from_64_S (tmp.h[1]);
enc_buf[ 3] = l32_from_64_S (tmp.h[1]);
enc_buf[ 4] = h32_from_64_S (tmp.h[2]);
enc_buf[ 5] = l32_from_64_S (tmp.h[2]);
enc_buf[ 6] = h32_from_64_S (tmp.h[3]);
enc_buf[ 7] = l32_from_64_S (tmp.h[3]);
enc_buf[ 8] = h32_from_64_S (tmp.h[4]);
enc_buf[ 9] = l32_from_64_S (tmp.h[4]);
enc_buf[10] = h32_from_64_S (tmp.h[5]);
enc_buf[11] = l32_from_64_S (tmp.h[5]);
enc_buf[12] = h32_from_64_S (tmp.h[6]);
enc_buf[13] = l32_from_64_S (tmp.h[6]);
enc_buf[14] = h32_from_64_S (tmp.h[7]);
enc_buf[15] = l32_from_64_S (tmp.h[7]);
enc_buf[16] = 0;
enc_buf[17] = 0;
enc_buf[18] = 0;
enc_buf[19] = 0;
enc_buf[20] = 0;
enc_buf[21] = 0;
enc_buf[22] = 0;
enc_buf[23] = 0;
enc_buf[24] = 0;
enc_buf[25] = 0;
enc_buf[26] = 0;
enc_buf[27] = 0;
enc_buf[28] = 0;
enc_buf[29] = 0;
enc_buf[30] = 0;
enc_buf[31] = 0;
}
else
{
enc_buf[ 0] = hc_swap32_S (enc_buf[ 0]);
enc_buf[ 1] = hc_swap32_S (enc_buf[ 1]);
enc_buf[ 2] = hc_swap32_S (enc_buf[ 2]);
enc_buf[ 3] = hc_swap32_S (enc_buf[ 3]);
enc_buf[ 4] = hc_swap32_S (enc_buf[ 4]);
enc_buf[ 5] = hc_swap32_S (enc_buf[ 5]);
enc_buf[ 6] = hc_swap32_S (enc_buf[ 6]);
enc_buf[ 7] = hc_swap32_S (enc_buf[ 7]);
enc_buf[ 8] = hc_swap32_S (enc_buf[ 8]);
enc_buf[ 9] = hc_swap32_S (enc_buf[ 9]);
enc_buf[10] = hc_swap32_S (enc_buf[10]);
enc_buf[11] = hc_swap32_S (enc_buf[11]);
enc_buf[12] = hc_swap32_S (enc_buf[12]);
enc_buf[13] = hc_swap32_S (enc_buf[13]);
enc_buf[14] = hc_swap32_S (enc_buf[14]);
enc_buf[15] = hc_swap32_S (enc_buf[15]);
enc_buf[16] = hc_swap32_S (enc_buf[16]);
enc_buf[17] = hc_swap32_S (enc_buf[17]);
enc_buf[18] = hc_swap32_S (enc_buf[18]);
enc_buf[19] = hc_swap32_S (enc_buf[19]);
enc_buf[20] = hc_swap32_S (enc_buf[20]);
enc_buf[21] = hc_swap32_S (enc_buf[21]);
enc_buf[22] = hc_swap32_S (enc_buf[22]);
enc_buf[23] = hc_swap32_S (enc_buf[23]);
enc_buf[24] = hc_swap32_S (enc_buf[24]);
enc_buf[25] = hc_swap32_S (enc_buf[25]);
enc_buf[26] = hc_swap32_S (enc_buf[26]);
enc_buf[27] = hc_swap32_S (enc_buf[27]);
enc_buf[28] = hc_swap32_S (enc_buf[28]);
enc_buf[29] = hc_swap32_S (enc_buf[29]);
enc_buf[30] = hc_swap32_S (enc_buf[30]);
enc_buf[31] = hc_swap32_S (enc_buf[31]);
}
sha512_hmac_init_128 (ctx, enc_buf + 0, enc_buf + 4, enc_buf + 8, enc_buf + 12, enc_buf + 16, enc_buf + 20, enc_buf + 24, enc_buf + 28);
}
return;
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
@ -2165,7 +2413,9 @@ DECLSPEC void sha512_init_vector_from_scalar (sha512_ctx_vector_t *ctx, sha512_c
DECLSPEC void sha512_update_vector_128 (sha512_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, const int len)
{
MAYBE_VOLATILE const int pos = ctx->len & 127;
if (len == 0) return;
const int pos = ctx->len & 127;
ctx->len += len;
@ -2873,7 +3123,7 @@ DECLSPEC void sha512_update_vector_utf16beN (sha512_ctx_vector_t *ctx, const u32
DECLSPEC void sha512_final_vector (sha512_ctx_vector_t *ctx)
{
MAYBE_VOLATILE const int pos = ctx->len & 127;
const int pos = ctx->len & 127;
append_0x80_8x4 (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->w4, ctx->w5, ctx->w6, ctx->w7, pos ^ 3);
@ -2925,92 +3175,101 @@ DECLSPEC void sha512_final_vector (sha512_ctx_vector_t *ctx)
DECLSPEC void sha512_hmac_init_vector_128 (sha512_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, const u32x *w4, const u32x *w5, const u32x *w6, const u32x *w7)
{
u32x t0[4];
u32x t1[4];
u32x t2[4];
u32x t3[4];
u32x t4[4];
u32x t5[4];
u32x t6[4];
u32x t7[4];
u32x a0[4];
u32x a1[4];
u32x a2[4];
u32x a3[4];
u32x a4[4];
u32x a5[4];
u32x a6[4];
u32x a7[4];
// ipad
t0[0] = w0[0] ^ 0x36363636;
t0[1] = w0[1] ^ 0x36363636;
t0[2] = w0[2] ^ 0x36363636;
t0[3] = w0[3] ^ 0x36363636;
t1[0] = w1[0] ^ 0x36363636;
t1[1] = w1[1] ^ 0x36363636;
t1[2] = w1[2] ^ 0x36363636;
t1[3] = w1[3] ^ 0x36363636;
t2[0] = w2[0] ^ 0x36363636;
t2[1] = w2[1] ^ 0x36363636;
t2[2] = w2[2] ^ 0x36363636;
t2[3] = w2[3] ^ 0x36363636;
t3[0] = w3[0] ^ 0x36363636;
t3[1] = w3[1] ^ 0x36363636;
t3[2] = w3[2] ^ 0x36363636;
t3[3] = w3[3] ^ 0x36363636;
t4[0] = w4[0] ^ 0x36363636;
t4[1] = w4[1] ^ 0x36363636;
t4[2] = w4[2] ^ 0x36363636;
t4[3] = w4[3] ^ 0x36363636;
t5[0] = w5[0] ^ 0x36363636;
t5[1] = w5[1] ^ 0x36363636;
t5[2] = w5[2] ^ 0x36363636;
t5[3] = w5[3] ^ 0x36363636;
t6[0] = w6[0] ^ 0x36363636;
t6[1] = w6[1] ^ 0x36363636;
t6[2] = w6[2] ^ 0x36363636;
t6[3] = w6[3] ^ 0x36363636;
t7[0] = w7[0] ^ 0x36363636;
t7[1] = w7[1] ^ 0x36363636;
t7[2] = w7[2] ^ 0x36363636;
t7[3] = w7[3] ^ 0x36363636;
a0[0] = w0[0] ^ 0x36363636;
a0[1] = w0[1] ^ 0x36363636;
a0[2] = w0[2] ^ 0x36363636;
a0[3] = w0[3] ^ 0x36363636;
a1[0] = w1[0] ^ 0x36363636;
a1[1] = w1[1] ^ 0x36363636;
a1[2] = w1[2] ^ 0x36363636;
a1[3] = w1[3] ^ 0x36363636;
a2[0] = w2[0] ^ 0x36363636;
a2[1] = w2[1] ^ 0x36363636;
a2[2] = w2[2] ^ 0x36363636;
a2[3] = w2[3] ^ 0x36363636;
a3[0] = w3[0] ^ 0x36363636;
a3[1] = w3[1] ^ 0x36363636;
a3[2] = w3[2] ^ 0x36363636;
a3[3] = w3[3] ^ 0x36363636;
a4[0] = w4[0] ^ 0x36363636;
a4[1] = w4[1] ^ 0x36363636;
a4[2] = w4[2] ^ 0x36363636;
a4[3] = w4[3] ^ 0x36363636;
a5[0] = w5[0] ^ 0x36363636;
a5[1] = w5[1] ^ 0x36363636;
a5[2] = w5[2] ^ 0x36363636;
a5[3] = w5[3] ^ 0x36363636;
a6[0] = w6[0] ^ 0x36363636;
a6[1] = w6[1] ^ 0x36363636;
a6[2] = w6[2] ^ 0x36363636;
a6[3] = w6[3] ^ 0x36363636;
a7[0] = w7[0] ^ 0x36363636;
a7[1] = w7[1] ^ 0x36363636;
a7[2] = w7[2] ^ 0x36363636;
a7[3] = w7[3] ^ 0x36363636;
sha512_init_vector (&ctx->ipad);
sha512_update_vector_128 (&ctx->ipad, t0, t1, t2, t3, t4, t5, t6, t7, 128);
sha512_update_vector_128 (&ctx->ipad, a0, a1, a2, a3, a4, a5, a6, a7, 128);
// opad
t0[0] = w0[0] ^ 0x5c5c5c5c;
t0[1] = w0[1] ^ 0x5c5c5c5c;
t0[2] = w0[2] ^ 0x5c5c5c5c;
t0[3] = w0[3] ^ 0x5c5c5c5c;
t1[0] = w1[0] ^ 0x5c5c5c5c;
t1[1] = w1[1] ^ 0x5c5c5c5c;
t1[2] = w1[2] ^ 0x5c5c5c5c;
t1[3] = w1[3] ^ 0x5c5c5c5c;
t2[0] = w2[0] ^ 0x5c5c5c5c;
t2[1] = w2[1] ^ 0x5c5c5c5c;
t2[2] = w2[2] ^ 0x5c5c5c5c;
t2[3] = w2[3] ^ 0x5c5c5c5c;
t3[0] = w3[0] ^ 0x5c5c5c5c;
t3[1] = w3[1] ^ 0x5c5c5c5c;
t3[2] = w3[2] ^ 0x5c5c5c5c;
t3[3] = w3[3] ^ 0x5c5c5c5c;
t4[0] = w4[0] ^ 0x5c5c5c5c;
t4[1] = w4[1] ^ 0x5c5c5c5c;
t4[2] = w4[2] ^ 0x5c5c5c5c;
t4[3] = w4[3] ^ 0x5c5c5c5c;
t5[0] = w5[0] ^ 0x5c5c5c5c;
t5[1] = w5[1] ^ 0x5c5c5c5c;
t5[2] = w5[2] ^ 0x5c5c5c5c;
t5[3] = w5[3] ^ 0x5c5c5c5c;
t6[0] = w6[0] ^ 0x5c5c5c5c;
t6[1] = w6[1] ^ 0x5c5c5c5c;
t6[2] = w6[2] ^ 0x5c5c5c5c;
t6[3] = w6[3] ^ 0x5c5c5c5c;
t7[0] = w7[0] ^ 0x5c5c5c5c;
t7[1] = w7[1] ^ 0x5c5c5c5c;
t7[2] = w7[2] ^ 0x5c5c5c5c;
t7[3] = w7[3] ^ 0x5c5c5c5c;
u32x b0[4];
u32x b1[4];
u32x b2[4];
u32x b3[4];
u32x b4[4];
u32x b5[4];
u32x b6[4];
u32x b7[4];
b0[0] = w0[0] ^ 0x5c5c5c5c;
b0[1] = w0[1] ^ 0x5c5c5c5c;
b0[2] = w0[2] ^ 0x5c5c5c5c;
b0[3] = w0[3] ^ 0x5c5c5c5c;
b1[0] = w1[0] ^ 0x5c5c5c5c;
b1[1] = w1[1] ^ 0x5c5c5c5c;
b1[2] = w1[2] ^ 0x5c5c5c5c;
b1[3] = w1[3] ^ 0x5c5c5c5c;
b2[0] = w2[0] ^ 0x5c5c5c5c;
b2[1] = w2[1] ^ 0x5c5c5c5c;
b2[2] = w2[2] ^ 0x5c5c5c5c;
b2[3] = w2[3] ^ 0x5c5c5c5c;
b3[0] = w3[0] ^ 0x5c5c5c5c;
b3[1] = w3[1] ^ 0x5c5c5c5c;
b3[2] = w3[2] ^ 0x5c5c5c5c;
b3[3] = w3[3] ^ 0x5c5c5c5c;
b4[0] = w4[0] ^ 0x5c5c5c5c;
b4[1] = w4[1] ^ 0x5c5c5c5c;
b4[2] = w4[2] ^ 0x5c5c5c5c;
b4[3] = w4[3] ^ 0x5c5c5c5c;
b5[0] = w5[0] ^ 0x5c5c5c5c;
b5[1] = w5[1] ^ 0x5c5c5c5c;
b5[2] = w5[2] ^ 0x5c5c5c5c;
b5[3] = w5[3] ^ 0x5c5c5c5c;
b6[0] = w6[0] ^ 0x5c5c5c5c;
b6[1] = w6[1] ^ 0x5c5c5c5c;
b6[2] = w6[2] ^ 0x5c5c5c5c;
b6[3] = w6[3] ^ 0x5c5c5c5c;
b7[0] = w7[0] ^ 0x5c5c5c5c;
b7[1] = w7[1] ^ 0x5c5c5c5c;
b7[2] = w7[2] ^ 0x5c5c5c5c;
b7[3] = w7[3] ^ 0x5c5c5c5c;
sha512_init_vector (&ctx->opad);
sha512_update_vector_128 (&ctx->opad, t0, t1, t2, t3, t4, t5, t6, t7, 128);
sha512_update_vector_128 (&ctx->opad, b0, b1, b2, b3, b4, b5, b6, b7, 128);
}
DECLSPEC void sha512_hmac_init_vector (sha512_hmac_ctx_vector_t *ctx, const u32x *w, const int len)

View File

@ -758,7 +758,9 @@ DECLSPEC void streebog256_transform (streebog256_ctx_t *ctx, const u32 *w0, cons
DECLSPEC void streebog256_update_64 (streebog256_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len)
{
MAYBE_VOLATILE const int pos = ctx->len & 63;
if (len == 0) return;
const int pos = ctx->len & 63;
ctx->len += len;
@ -1047,7 +1049,7 @@ DECLSPEC void streebog256_update_global_swap (streebog256_ctx_t *ctx, GLOBAL_AS
DECLSPEC void streebog256_final (streebog256_ctx_t *ctx)
{
MAYBE_VOLATILE const int pos = ctx->len & 63;
const int pos = ctx->len & 63;
append_0x01_4x4_S (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3);
@ -1080,56 +1082,61 @@ DECLSPEC void streebog256_final (streebog256_ctx_t *ctx)
DECLSPEC void streebog256_hmac_init_64 (streebog256_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, SHM_TYPE u64a (*s_sbob_sl64)[256])
{
u32 t0[4];
u32 t1[4];
u32 t2[4];
u32 t3[4];
u32 a0[4];
u32 a1[4];
u32 a2[4];
u32 a3[4];
// ipad
t0[0] = w0[0] ^ 0x36363636;
t0[1] = w0[1] ^ 0x36363636;
t0[2] = w0[2] ^ 0x36363636;
t0[3] = w0[3] ^ 0x36363636;
t1[0] = w1[0] ^ 0x36363636;
t1[1] = w1[1] ^ 0x36363636;
t1[2] = w1[2] ^ 0x36363636;
t1[3] = w1[3] ^ 0x36363636;
t2[0] = w2[0] ^ 0x36363636;
t2[1] = w2[1] ^ 0x36363636;
t2[2] = w2[2] ^ 0x36363636;
t2[3] = w2[3] ^ 0x36363636;
t3[0] = w3[0] ^ 0x36363636;
t3[1] = w3[1] ^ 0x36363636;
t3[2] = w3[2] ^ 0x36363636;
t3[3] = w3[3] ^ 0x36363636;
a0[0] = w0[0] ^ 0x36363636;
a0[1] = w0[1] ^ 0x36363636;
a0[2] = w0[2] ^ 0x36363636;
a0[3] = w0[3] ^ 0x36363636;
a1[0] = w1[0] ^ 0x36363636;
a1[1] = w1[1] ^ 0x36363636;
a1[2] = w1[2] ^ 0x36363636;
a1[3] = w1[3] ^ 0x36363636;
a2[0] = w2[0] ^ 0x36363636;
a2[1] = w2[1] ^ 0x36363636;
a2[2] = w2[2] ^ 0x36363636;
a2[3] = w2[3] ^ 0x36363636;
a3[0] = w3[0] ^ 0x36363636;
a3[1] = w3[1] ^ 0x36363636;
a3[2] = w3[2] ^ 0x36363636;
a3[3] = w3[3] ^ 0x36363636;
streebog256_init (&ctx->ipad, s_sbob_sl64);
streebog256_update_64 (&ctx->ipad, t0, t1, t2, t3, 64);
streebog256_update_64 (&ctx->ipad, a0, a1, a2, a3, 64);
// opad
t0[0] = w0[0] ^ 0x5c5c5c5c;
t0[1] = w0[1] ^ 0x5c5c5c5c;
t0[2] = w0[2] ^ 0x5c5c5c5c;
t0[3] = w0[3] ^ 0x5c5c5c5c;
t1[0] = w1[0] ^ 0x5c5c5c5c;
t1[1] = w1[1] ^ 0x5c5c5c5c;
t1[2] = w1[2] ^ 0x5c5c5c5c;
t1[3] = w1[3] ^ 0x5c5c5c5c;
t2[0] = w2[0] ^ 0x5c5c5c5c;
t2[1] = w2[1] ^ 0x5c5c5c5c;
t2[2] = w2[2] ^ 0x5c5c5c5c;
t2[3] = w2[3] ^ 0x5c5c5c5c;
t3[0] = w3[0] ^ 0x5c5c5c5c;
t3[1] = w3[1] ^ 0x5c5c5c5c;
t3[2] = w3[2] ^ 0x5c5c5c5c;
t3[3] = w3[3] ^ 0x5c5c5c5c;
u32 b0[4];
u32 b1[4];
u32 b2[4];
u32 b3[4];
b0[0] = w0[0] ^ 0x5c5c5c5c;
b0[1] = w0[1] ^ 0x5c5c5c5c;
b0[2] = w0[2] ^ 0x5c5c5c5c;
b0[3] = w0[3] ^ 0x5c5c5c5c;
b1[0] = w1[0] ^ 0x5c5c5c5c;
b1[1] = w1[1] ^ 0x5c5c5c5c;
b1[2] = w1[2] ^ 0x5c5c5c5c;
b1[3] = w1[3] ^ 0x5c5c5c5c;
b2[0] = w2[0] ^ 0x5c5c5c5c;
b2[1] = w2[1] ^ 0x5c5c5c5c;
b2[2] = w2[2] ^ 0x5c5c5c5c;
b2[3] = w2[3] ^ 0x5c5c5c5c;
b3[0] = w3[0] ^ 0x5c5c5c5c;
b3[1] = w3[1] ^ 0x5c5c5c5c;
b3[2] = w3[2] ^ 0x5c5c5c5c;
b3[3] = w3[3] ^ 0x5c5c5c5c;
streebog256_init (&ctx->opad, s_sbob_sl64);
streebog256_update_64 (&ctx->opad, t0, t1, t2, t3, 64);
streebog256_update_64 (&ctx->opad, b0, b1, b2, b3, 64);
}
DECLSPEC void streebog256_hmac_init (streebog256_hmac_ctx_t *ctx, const u32 *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256])
@ -1457,7 +1464,9 @@ DECLSPEC void streebog256_transform_vector (streebog256_ctx_vector_t *ctx, const
DECLSPEC void streebog256_update_vector_64 (streebog256_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len)
{
MAYBE_VOLATILE const int pos = ctx->len & 63;
if (len == 0) return;
const int pos = ctx->len & 63;
ctx->len += len;
@ -1689,7 +1698,7 @@ DECLSPEC void streebog256_update_vector_swap (streebog256_ctx_vector_t *ctx, con
DECLSPEC void streebog256_final_vector (streebog256_ctx_vector_t *ctx)
{
MAYBE_VOLATILE const int pos = ctx->len & 63;
const int pos = ctx->len & 63;
append_0x01_4x4_VV (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3);
@ -1722,56 +1731,61 @@ DECLSPEC void streebog256_final_vector (streebog256_ctx_vector_t *ctx)
DECLSPEC void streebog256_hmac_init_vector_64 (streebog256_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, SHM_TYPE u64a (*s_sbob_sl64)[256])
{
u32x t0[4];
u32x t1[4];
u32x t2[4];
u32x t3[4];
u32x a0[4];
u32x a1[4];
u32x a2[4];
u32x a3[4];
// ipad
t0[0] = w0[0] ^ 0x36363636;
t0[1] = w0[1] ^ 0x36363636;
t0[2] = w0[2] ^ 0x36363636;
t0[3] = w0[3] ^ 0x36363636;
t1[0] = w1[0] ^ 0x36363636;
t1[1] = w1[1] ^ 0x36363636;
t1[2] = w1[2] ^ 0x36363636;
t1[3] = w1[3] ^ 0x36363636;
t2[0] = w2[0] ^ 0x36363636;
t2[1] = w2[1] ^ 0x36363636;
t2[2] = w2[2] ^ 0x36363636;
t2[3] = w2[3] ^ 0x36363636;
t3[0] = w3[0] ^ 0x36363636;
t3[1] = w3[1] ^ 0x36363636;
t3[2] = w3[2] ^ 0x36363636;
t3[3] = w3[3] ^ 0x36363636;
a0[0] = w0[0] ^ 0x36363636;
a0[1] = w0[1] ^ 0x36363636;
a0[2] = w0[2] ^ 0x36363636;
a0[3] = w0[3] ^ 0x36363636;
a1[0] = w1[0] ^ 0x36363636;
a1[1] = w1[1] ^ 0x36363636;
a1[2] = w1[2] ^ 0x36363636;
a1[3] = w1[3] ^ 0x36363636;
a2[0] = w2[0] ^ 0x36363636;
a2[1] = w2[1] ^ 0x36363636;
a2[2] = w2[2] ^ 0x36363636;
a2[3] = w2[3] ^ 0x36363636;
a3[0] = w3[0] ^ 0x36363636;
a3[1] = w3[1] ^ 0x36363636;
a3[2] = w3[2] ^ 0x36363636;
a3[3] = w3[3] ^ 0x36363636;
streebog256_init_vector (&ctx->ipad, s_sbob_sl64);
streebog256_update_vector_64 (&ctx->ipad, t0, t1, t2, t3, 64);
streebog256_update_vector_64 (&ctx->ipad, a0, a1, a2, a3, 64);
// opad
t0[0] = w0[0] ^ 0x5c5c5c5c;
t0[1] = w0[1] ^ 0x5c5c5c5c;
t0[2] = w0[2] ^ 0x5c5c5c5c;
t0[3] = w0[3] ^ 0x5c5c5c5c;
t1[0] = w1[0] ^ 0x5c5c5c5c;
t1[1] = w1[1] ^ 0x5c5c5c5c;
t1[2] = w1[2] ^ 0x5c5c5c5c;
t1[3] = w1[3] ^ 0x5c5c5c5c;
t2[0] = w2[0] ^ 0x5c5c5c5c;
t2[1] = w2[1] ^ 0x5c5c5c5c;
t2[2] = w2[2] ^ 0x5c5c5c5c;
t2[3] = w2[3] ^ 0x5c5c5c5c;
t3[0] = w3[0] ^ 0x5c5c5c5c;
t3[1] = w3[1] ^ 0x5c5c5c5c;
t3[2] = w3[2] ^ 0x5c5c5c5c;
t3[3] = w3[3] ^ 0x5c5c5c5c;
u32x b0[4];
u32x b1[4];
u32x b2[4];
u32x b3[4];
b0[0] = w0[0] ^ 0x5c5c5c5c;
b0[1] = w0[1] ^ 0x5c5c5c5c;
b0[2] = w0[2] ^ 0x5c5c5c5c;
b0[3] = w0[3] ^ 0x5c5c5c5c;
b1[0] = w1[0] ^ 0x5c5c5c5c;
b1[1] = w1[1] ^ 0x5c5c5c5c;
b1[2] = w1[2] ^ 0x5c5c5c5c;
b1[3] = w1[3] ^ 0x5c5c5c5c;
b2[0] = w2[0] ^ 0x5c5c5c5c;
b2[1] = w2[1] ^ 0x5c5c5c5c;
b2[2] = w2[2] ^ 0x5c5c5c5c;
b2[3] = w2[3] ^ 0x5c5c5c5c;
b3[0] = w3[0] ^ 0x5c5c5c5c;
b3[1] = w3[1] ^ 0x5c5c5c5c;
b3[2] = w3[2] ^ 0x5c5c5c5c;
b3[3] = w3[3] ^ 0x5c5c5c5c;
streebog256_init_vector (&ctx->opad, s_sbob_sl64);
streebog256_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64);
streebog256_update_vector_64 (&ctx->opad, b0, b1, b2, b3, 64);
}
DECLSPEC void streebog256_hmac_init_vector (streebog256_hmac_ctx_vector_t *ctx, const u32x *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256])

View File

@ -758,7 +758,9 @@ DECLSPEC void streebog512_transform (streebog512_ctx_t *ctx, const u32 *w0, cons
DECLSPEC void streebog512_update_64 (streebog512_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len)
{
MAYBE_VOLATILE const int pos = ctx->len & 63;
if (len == 0) return;
const int pos = ctx->len & 63;
ctx->len += len;
@ -1047,7 +1049,7 @@ DECLSPEC void streebog512_update_global_swap (streebog512_ctx_t *ctx, GLOBAL_AS
DECLSPEC void streebog512_final (streebog512_ctx_t *ctx)
{
MAYBE_VOLATILE const int pos = ctx->len & 63;
const int pos = ctx->len & 63;
append_0x01_4x4_S (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3);
@ -1080,56 +1082,61 @@ DECLSPEC void streebog512_final (streebog512_ctx_t *ctx)
DECLSPEC void streebog512_hmac_init_64 (streebog512_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, SHM_TYPE u64a (*s_sbob_sl64)[256])
{
u32 t0[4];
u32 t1[4];
u32 t2[4];
u32 t3[4];
u32 a0[4];
u32 a1[4];
u32 a2[4];
u32 a3[4];
// ipad
t0[0] = w0[0] ^ 0x36363636;
t0[1] = w0[1] ^ 0x36363636;
t0[2] = w0[2] ^ 0x36363636;
t0[3] = w0[3] ^ 0x36363636;
t1[0] = w1[0] ^ 0x36363636;
t1[1] = w1[1] ^ 0x36363636;
t1[2] = w1[2] ^ 0x36363636;
t1[3] = w1[3] ^ 0x36363636;
t2[0] = w2[0] ^ 0x36363636;
t2[1] = w2[1] ^ 0x36363636;
t2[2] = w2[2] ^ 0x36363636;
t2[3] = w2[3] ^ 0x36363636;
t3[0] = w3[0] ^ 0x36363636;
t3[1] = w3[1] ^ 0x36363636;
t3[2] = w3[2] ^ 0x36363636;
t3[3] = w3[3] ^ 0x36363636;
a0[0] = w0[0] ^ 0x36363636;
a0[1] = w0[1] ^ 0x36363636;
a0[2] = w0[2] ^ 0x36363636;
a0[3] = w0[3] ^ 0x36363636;
a1[0] = w1[0] ^ 0x36363636;
a1[1] = w1[1] ^ 0x36363636;
a1[2] = w1[2] ^ 0x36363636;
a1[3] = w1[3] ^ 0x36363636;
a2[0] = w2[0] ^ 0x36363636;
a2[1] = w2[1] ^ 0x36363636;
a2[2] = w2[2] ^ 0x36363636;
a2[3] = w2[3] ^ 0x36363636;
a3[0] = w3[0] ^ 0x36363636;
a3[1] = w3[1] ^ 0x36363636;
a3[2] = w3[2] ^ 0x36363636;
a3[3] = w3[3] ^ 0x36363636;
streebog512_init (&ctx->ipad, s_sbob_sl64);
streebog512_update_64 (&ctx->ipad, t0, t1, t2, t3, 64);
streebog512_update_64 (&ctx->ipad, a0, a1, a2, a3, 64);
// opad
t0[0] = w0[0] ^ 0x5c5c5c5c;
t0[1] = w0[1] ^ 0x5c5c5c5c;
t0[2] = w0[2] ^ 0x5c5c5c5c;
t0[3] = w0[3] ^ 0x5c5c5c5c;
t1[0] = w1[0] ^ 0x5c5c5c5c;
t1[1] = w1[1] ^ 0x5c5c5c5c;
t1[2] = w1[2] ^ 0x5c5c5c5c;
t1[3] = w1[3] ^ 0x5c5c5c5c;
t2[0] = w2[0] ^ 0x5c5c5c5c;
t2[1] = w2[1] ^ 0x5c5c5c5c;
t2[2] = w2[2] ^ 0x5c5c5c5c;
t2[3] = w2[3] ^ 0x5c5c5c5c;
t3[0] = w3[0] ^ 0x5c5c5c5c;
t3[1] = w3[1] ^ 0x5c5c5c5c;
t3[2] = w3[2] ^ 0x5c5c5c5c;
t3[3] = w3[3] ^ 0x5c5c5c5c;
u32 b0[4];
u32 b1[4];
u32 b2[4];
u32 b3[4];
b0[0] = w0[0] ^ 0x5c5c5c5c;
b0[1] = w0[1] ^ 0x5c5c5c5c;
b0[2] = w0[2] ^ 0x5c5c5c5c;
b0[3] = w0[3] ^ 0x5c5c5c5c;
b1[0] = w1[0] ^ 0x5c5c5c5c;
b1[1] = w1[1] ^ 0x5c5c5c5c;
b1[2] = w1[2] ^ 0x5c5c5c5c;
b1[3] = w1[3] ^ 0x5c5c5c5c;
b2[0] = w2[0] ^ 0x5c5c5c5c;
b2[1] = w2[1] ^ 0x5c5c5c5c;
b2[2] = w2[2] ^ 0x5c5c5c5c;
b2[3] = w2[3] ^ 0x5c5c5c5c;
b3[0] = w3[0] ^ 0x5c5c5c5c;
b3[1] = w3[1] ^ 0x5c5c5c5c;
b3[2] = w3[2] ^ 0x5c5c5c5c;
b3[3] = w3[3] ^ 0x5c5c5c5c;
streebog512_init (&ctx->opad, s_sbob_sl64);
streebog512_update_64 (&ctx->opad, t0, t1, t2, t3, 64);
streebog512_update_64 (&ctx->opad, b0, b1, b2, b3, 64);
}
DECLSPEC void streebog512_hmac_init (streebog512_hmac_ctx_t *ctx, const u32 *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256])
@ -1476,7 +1483,9 @@ DECLSPEC void streebog512_transform_vector (streebog512_ctx_vector_t *ctx, const
DECLSPEC void streebog512_update_vector_64 (streebog512_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len)
{
MAYBE_VOLATILE const int pos = ctx->len & 63;
if (len == 0) return;
const int pos = ctx->len & 63;
ctx->len += len;
@ -1708,7 +1717,7 @@ DECLSPEC void streebog512_update_vector_swap (streebog512_ctx_vector_t *ctx, con
DECLSPEC void streebog512_final_vector (streebog512_ctx_vector_t *ctx)
{
MAYBE_VOLATILE const int pos = ctx->len & 63;
const int pos = ctx->len & 63;
append_0x01_4x4_VV (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3);
@ -1741,56 +1750,61 @@ DECLSPEC void streebog512_final_vector (streebog512_ctx_vector_t *ctx)
DECLSPEC void streebog512_hmac_init_vector_64 (streebog512_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, SHM_TYPE u64a (*s_sbob_sl64)[256])
{
u32x t0[4];
u32x t1[4];
u32x t2[4];
u32x t3[4];
u32x a0[4];
u32x a1[4];
u32x a2[4];
u32x a3[4];
// ipad
t0[0] = w0[0] ^ 0x36363636;
t0[1] = w0[1] ^ 0x36363636;
t0[2] = w0[2] ^ 0x36363636;
t0[3] = w0[3] ^ 0x36363636;
t1[0] = w1[0] ^ 0x36363636;
t1[1] = w1[1] ^ 0x36363636;
t1[2] = w1[2] ^ 0x36363636;
t1[3] = w1[3] ^ 0x36363636;
t2[0] = w2[0] ^ 0x36363636;
t2[1] = w2[1] ^ 0x36363636;
t2[2] = w2[2] ^ 0x36363636;
t2[3] = w2[3] ^ 0x36363636;
t3[0] = w3[0] ^ 0x36363636;
t3[1] = w3[1] ^ 0x36363636;
t3[2] = w3[2] ^ 0x36363636;
t3[3] = w3[3] ^ 0x36363636;
a0[0] = w0[0] ^ 0x36363636;
a0[1] = w0[1] ^ 0x36363636;
a0[2] = w0[2] ^ 0x36363636;
a0[3] = w0[3] ^ 0x36363636;
a1[0] = w1[0] ^ 0x36363636;
a1[1] = w1[1] ^ 0x36363636;
a1[2] = w1[2] ^ 0x36363636;
a1[3] = w1[3] ^ 0x36363636;
a2[0] = w2[0] ^ 0x36363636;
a2[1] = w2[1] ^ 0x36363636;
a2[2] = w2[2] ^ 0x36363636;
a2[3] = w2[3] ^ 0x36363636;
a3[0] = w3[0] ^ 0x36363636;
a3[1] = w3[1] ^ 0x36363636;
a3[2] = w3[2] ^ 0x36363636;
a3[3] = w3[3] ^ 0x36363636;
streebog512_init_vector (&ctx->ipad, s_sbob_sl64);
streebog512_update_vector_64 (&ctx->ipad, t0, t1, t2, t3, 64);
streebog512_update_vector_64 (&ctx->ipad, a0, a1, a2, a3, 64);
// opad
t0[0] = w0[0] ^ 0x5c5c5c5c;
t0[1] = w0[1] ^ 0x5c5c5c5c;
t0[2] = w0[2] ^ 0x5c5c5c5c;
t0[3] = w0[3] ^ 0x5c5c5c5c;
t1[0] = w1[0] ^ 0x5c5c5c5c;
t1[1] = w1[1] ^ 0x5c5c5c5c;
t1[2] = w1[2] ^ 0x5c5c5c5c;
t1[3] = w1[3] ^ 0x5c5c5c5c;
t2[0] = w2[0] ^ 0x5c5c5c5c;
t2[1] = w2[1] ^ 0x5c5c5c5c;
t2[2] = w2[2] ^ 0x5c5c5c5c;
t2[3] = w2[3] ^ 0x5c5c5c5c;
t3[0] = w3[0] ^ 0x5c5c5c5c;
t3[1] = w3[1] ^ 0x5c5c5c5c;
t3[2] = w3[2] ^ 0x5c5c5c5c;
t3[3] = w3[3] ^ 0x5c5c5c5c;
u32x b0[4];
u32x b1[4];
u32x b2[4];
u32x b3[4];
b0[0] = w0[0] ^ 0x5c5c5c5c;
b0[1] = w0[1] ^ 0x5c5c5c5c;
b0[2] = w0[2] ^ 0x5c5c5c5c;
b0[3] = w0[3] ^ 0x5c5c5c5c;
b1[0] = w1[0] ^ 0x5c5c5c5c;
b1[1] = w1[1] ^ 0x5c5c5c5c;
b1[2] = w1[2] ^ 0x5c5c5c5c;
b1[3] = w1[3] ^ 0x5c5c5c5c;
b2[0] = w2[0] ^ 0x5c5c5c5c;
b2[1] = w2[1] ^ 0x5c5c5c5c;
b2[2] = w2[2] ^ 0x5c5c5c5c;
b2[3] = w2[3] ^ 0x5c5c5c5c;
b3[0] = w3[0] ^ 0x5c5c5c5c;
b3[1] = w3[1] ^ 0x5c5c5c5c;
b3[2] = w3[2] ^ 0x5c5c5c5c;
b3[3] = w3[3] ^ 0x5c5c5c5c;
streebog512_init_vector (&ctx->opad, s_sbob_sl64);
streebog512_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64);
streebog512_update_vector_64 (&ctx->opad, b0, b1, b2, b3, 64);
}
DECLSPEC void streebog512_hmac_init_vector (streebog512_hmac_ctx_vector_t *ctx, const u32x *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256])

View File

@ -762,7 +762,9 @@ DECLSPEC void whirlpool_init (whirlpool_ctx_t *ctx, SHM_TYPE u64 *s_MT0, SHM_TYP
DECLSPEC void whirlpool_update_64 (whirlpool_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len)
{
MAYBE_VOLATILE const int pos = ctx->len & 63;
if (len == 0) return;
const int pos = ctx->len & 63;
ctx->len += len;
@ -1018,6 +1020,24 @@ DECLSPEC void whirlpool_update_swap (whirlpool_ctx_t *ctx, const u32 *w, const i
DECLSPEC void whirlpool_update_utf16le (whirlpool_ctx_t *ctx, const u32 *w, const int len)
{
if (hc_enc_scan (w, len))
{
hc_enc_t hc_enc;
hc_enc_init (&hc_enc);
while (hc_enc_has_next (&hc_enc, len))
{
u32 enc_buf[16] = { 0 };
const int enc_len = hc_enc_next (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
whirlpool_update_64 (ctx, enc_buf + 0, enc_buf + 4, enc_buf + 8, enc_buf + 12, enc_len);
}
return;
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
@ -1060,6 +1080,41 @@ DECLSPEC void whirlpool_update_utf16le (whirlpool_ctx_t *ctx, const u32 *w, cons
DECLSPEC void whirlpool_update_utf16le_swap (whirlpool_ctx_t *ctx, const u32 *w, const int len)
{
if (hc_enc_scan (w, len))
{
hc_enc_t hc_enc;
hc_enc_init (&hc_enc);
while (hc_enc_has_next (&hc_enc, len))
{
u32 enc_buf[16] = { 0 };
const int enc_len = hc_enc_next (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
enc_buf[ 0] = hc_swap32_S (enc_buf[ 0]);
enc_buf[ 1] = hc_swap32_S (enc_buf[ 1]);
enc_buf[ 2] = hc_swap32_S (enc_buf[ 2]);
enc_buf[ 3] = hc_swap32_S (enc_buf[ 3]);
enc_buf[ 4] = hc_swap32_S (enc_buf[ 4]);
enc_buf[ 5] = hc_swap32_S (enc_buf[ 5]);
enc_buf[ 6] = hc_swap32_S (enc_buf[ 6]);
enc_buf[ 7] = hc_swap32_S (enc_buf[ 7]);
enc_buf[ 8] = hc_swap32_S (enc_buf[ 8]);
enc_buf[ 9] = hc_swap32_S (enc_buf[ 9]);
enc_buf[10] = hc_swap32_S (enc_buf[10]);
enc_buf[11] = hc_swap32_S (enc_buf[11]);
enc_buf[12] = hc_swap32_S (enc_buf[12]);
enc_buf[13] = hc_swap32_S (enc_buf[13]);
enc_buf[14] = hc_swap32_S (enc_buf[14]);
enc_buf[15] = hc_swap32_S (enc_buf[15]);
whirlpool_update_64 (ctx, enc_buf + 0, enc_buf + 4, enc_buf + 8, enc_buf + 12, enc_len);
}
return;
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
@ -1274,6 +1329,24 @@ DECLSPEC void whirlpool_update_global_swap (whirlpool_ctx_t *ctx, GLOBAL_AS cons
DECLSPEC void whirlpool_update_global_utf16le (whirlpool_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{
if (hc_enc_scan_global (w, len))
{
hc_enc_t hc_enc;
hc_enc_init (&hc_enc);
while (hc_enc_has_next (&hc_enc, len))
{
u32 enc_buf[16] = { 0 };
const int enc_len = hc_enc_next_global (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
whirlpool_update_64 (ctx, enc_buf + 0, enc_buf + 4, enc_buf + 8, enc_buf + 12, enc_len);
}
return;
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
@ -1316,6 +1389,41 @@ DECLSPEC void whirlpool_update_global_utf16le (whirlpool_ctx_t *ctx, GLOBAL_AS c
DECLSPEC void whirlpool_update_global_utf16le_swap (whirlpool_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len)
{
if (hc_enc_scan_global (w, len))
{
hc_enc_t hc_enc;
hc_enc_init (&hc_enc);
while (hc_enc_has_next (&hc_enc, len))
{
u32 enc_buf[16] = { 0 };
const int enc_len = hc_enc_next_global (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
enc_buf[ 0] = hc_swap32_S (enc_buf[ 0]);
enc_buf[ 1] = hc_swap32_S (enc_buf[ 1]);
enc_buf[ 2] = hc_swap32_S (enc_buf[ 2]);
enc_buf[ 3] = hc_swap32_S (enc_buf[ 3]);
enc_buf[ 4] = hc_swap32_S (enc_buf[ 4]);
enc_buf[ 5] = hc_swap32_S (enc_buf[ 5]);
enc_buf[ 6] = hc_swap32_S (enc_buf[ 6]);
enc_buf[ 7] = hc_swap32_S (enc_buf[ 7]);
enc_buf[ 8] = hc_swap32_S (enc_buf[ 8]);
enc_buf[ 9] = hc_swap32_S (enc_buf[ 9]);
enc_buf[10] = hc_swap32_S (enc_buf[10]);
enc_buf[11] = hc_swap32_S (enc_buf[11]);
enc_buf[12] = hc_swap32_S (enc_buf[12]);
enc_buf[13] = hc_swap32_S (enc_buf[13]);
enc_buf[14] = hc_swap32_S (enc_buf[14]);
enc_buf[15] = hc_swap32_S (enc_buf[15]);
whirlpool_update_64 (ctx, enc_buf + 0, enc_buf + 4, enc_buf + 8, enc_buf + 12, enc_len);
}
return;
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
@ -1392,7 +1500,7 @@ DECLSPEC void whirlpool_update_global_utf16le_swap (whirlpool_ctx_t *ctx, GLOBAL
DECLSPEC void whirlpool_final (whirlpool_ctx_t *ctx)
{
MAYBE_VOLATILE const int pos = ctx->len & 63;
const int pos = ctx->len & 63;
append_0x80_4x4_S (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3);
@ -1428,56 +1536,61 @@ DECLSPEC void whirlpool_final (whirlpool_ctx_t *ctx)
DECLSPEC void whirlpool_hmac_init_64 (whirlpool_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, SHM_TYPE u64 *s_MT0, SHM_TYPE u64 *s_MT1, SHM_TYPE u64 *s_MT2, SHM_TYPE u64 *s_MT3, SHM_TYPE u64 *s_MT4, SHM_TYPE u64 *s_MT5, SHM_TYPE u64 *s_MT6, SHM_TYPE u64 *s_MT7)
{
u32 t0[4];
u32 t1[4];
u32 t2[4];
u32 t3[4];
u32 a0[4];
u32 a1[4];
u32 a2[4];
u32 a3[4];
// ipad
t0[0] = w0[0] ^ 0x36363636;
t0[1] = w0[1] ^ 0x36363636;
t0[2] = w0[2] ^ 0x36363636;
t0[3] = w0[3] ^ 0x36363636;
t1[0] = w1[0] ^ 0x36363636;
t1[1] = w1[1] ^ 0x36363636;
t1[2] = w1[2] ^ 0x36363636;
t1[3] = w1[3] ^ 0x36363636;
t2[0] = w2[0] ^ 0x36363636;
t2[1] = w2[1] ^ 0x36363636;
t2[2] = w2[2] ^ 0x36363636;
t2[3] = w2[3] ^ 0x36363636;
t3[0] = w3[0] ^ 0x36363636;
t3[1] = w3[1] ^ 0x36363636;
t3[2] = w3[2] ^ 0x36363636;
t3[3] = w3[3] ^ 0x36363636;
a0[0] = w0[0] ^ 0x36363636;
a0[1] = w0[1] ^ 0x36363636;
a0[2] = w0[2] ^ 0x36363636;
a0[3] = w0[3] ^ 0x36363636;
a1[0] = w1[0] ^ 0x36363636;
a1[1] = w1[1] ^ 0x36363636;
a1[2] = w1[2] ^ 0x36363636;
a1[3] = w1[3] ^ 0x36363636;
a2[0] = w2[0] ^ 0x36363636;
a2[1] = w2[1] ^ 0x36363636;
a2[2] = w2[2] ^ 0x36363636;
a2[3] = w2[3] ^ 0x36363636;
a3[0] = w3[0] ^ 0x36363636;
a3[1] = w3[1] ^ 0x36363636;
a3[2] = w3[2] ^ 0x36363636;
a3[3] = w3[3] ^ 0x36363636;
whirlpool_init (&ctx->ipad, s_MT0, s_MT1, s_MT2, s_MT3, s_MT4, s_MT5, s_MT6, s_MT7);
whirlpool_update_64 (&ctx->ipad, t0, t1, t2, t3, 64);
whirlpool_update_64 (&ctx->ipad, a0, a1, a2, a3, 64);
// opad
t0[0] = w0[0] ^ 0x5c5c5c5c;
t0[1] = w0[1] ^ 0x5c5c5c5c;
t0[2] = w0[2] ^ 0x5c5c5c5c;
t0[3] = w0[3] ^ 0x5c5c5c5c;
t1[0] = w1[0] ^ 0x5c5c5c5c;
t1[1] = w1[1] ^ 0x5c5c5c5c;
t1[2] = w1[2] ^ 0x5c5c5c5c;
t1[3] = w1[3] ^ 0x5c5c5c5c;
t2[0] = w2[0] ^ 0x5c5c5c5c;
t2[1] = w2[1] ^ 0x5c5c5c5c;
t2[2] = w2[2] ^ 0x5c5c5c5c;
t2[3] = w2[3] ^ 0x5c5c5c5c;
t3[0] = w3[0] ^ 0x5c5c5c5c;
t3[1] = w3[1] ^ 0x5c5c5c5c;
t3[2] = w3[2] ^ 0x5c5c5c5c;
t3[3] = w3[3] ^ 0x5c5c5c5c;
u32 b0[4];
u32 b1[4];
u32 b2[4];
u32 b3[4];
b0[0] = w0[0] ^ 0x5c5c5c5c;
b0[1] = w0[1] ^ 0x5c5c5c5c;
b0[2] = w0[2] ^ 0x5c5c5c5c;
b0[3] = w0[3] ^ 0x5c5c5c5c;
b1[0] = w1[0] ^ 0x5c5c5c5c;
b1[1] = w1[1] ^ 0x5c5c5c5c;
b1[2] = w1[2] ^ 0x5c5c5c5c;
b1[3] = w1[3] ^ 0x5c5c5c5c;
b2[0] = w2[0] ^ 0x5c5c5c5c;
b2[1] = w2[1] ^ 0x5c5c5c5c;
b2[2] = w2[2] ^ 0x5c5c5c5c;
b2[3] = w2[3] ^ 0x5c5c5c5c;
b3[0] = w3[0] ^ 0x5c5c5c5c;
b3[1] = w3[1] ^ 0x5c5c5c5c;
b3[2] = w3[2] ^ 0x5c5c5c5c;
b3[3] = w3[3] ^ 0x5c5c5c5c;
whirlpool_init (&ctx->opad, s_MT0, s_MT1, s_MT2, s_MT3, s_MT4, s_MT5, s_MT6, s_MT7);
whirlpool_update_64 (&ctx->opad, t0, t1, t2, t3, 64);
whirlpool_update_64 (&ctx->opad, b0, b1, b2, b3, 64);
}
DECLSPEC void whirlpool_hmac_init (whirlpool_hmac_ctx_t *ctx, const u32 *w, const int len, SHM_TYPE u64 *s_MT0, SHM_TYPE u64 *s_MT1, SHM_TYPE u64 *s_MT2, SHM_TYPE u64 *s_MT3, SHM_TYPE u64 *s_MT4, SHM_TYPE u64 *s_MT5, SHM_TYPE u64 *s_MT6, SHM_TYPE u64 *s_MT7)
@ -2052,7 +2165,9 @@ DECLSPEC void whirlpool_init_vector_from_scalar (whirlpool_ctx_vector_t *ctx, wh
DECLSPEC void whirlpool_update_vector_64 (whirlpool_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len)
{
MAYBE_VOLATILE const int pos = ctx->len & 63;
if (len == 0) return;
const int pos = ctx->len & 63;
ctx->len += len;
@ -2426,7 +2541,7 @@ DECLSPEC void whirlpool_update_vector_utf16le_swap (whirlpool_ctx_vector_t *ctx,
DECLSPEC void whirlpool_final_vector (whirlpool_ctx_vector_t *ctx)
{
MAYBE_VOLATILE const int pos = ctx->len & 63;
const int pos = ctx->len & 63;
append_0x80_4x4 (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3);
@ -2462,56 +2577,61 @@ DECLSPEC void whirlpool_final_vector (whirlpool_ctx_vector_t *ctx)
DECLSPEC void whirlpool_hmac_init_vector_64 (whirlpool_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, SHM_TYPE u64 *s_MT0, SHM_TYPE u64 *s_MT1, SHM_TYPE u64 *s_MT2, SHM_TYPE u64 *s_MT3, SHM_TYPE u64 *s_MT4, SHM_TYPE u64 *s_MT5, SHM_TYPE u64 *s_MT6, SHM_TYPE u64 *s_MT7)
{
u32x t0[4];
u32x t1[4];
u32x t2[4];
u32x t3[4];
u32x a0[4];
u32x a1[4];
u32x a2[4];
u32x a3[4];
// ipad
t0[0] = w0[0] ^ 0x36363636;
t0[1] = w0[1] ^ 0x36363636;
t0[2] = w0[2] ^ 0x36363636;
t0[3] = w0[3] ^ 0x36363636;
t1[0] = w1[0] ^ 0x36363636;
t1[1] = w1[1] ^ 0x36363636;
t1[2] = w1[2] ^ 0x36363636;
t1[3] = w1[3] ^ 0x36363636;
t2[0] = w2[0] ^ 0x36363636;
t2[1] = w2[1] ^ 0x36363636;
t2[2] = w2[2] ^ 0x36363636;
t2[3] = w2[3] ^ 0x36363636;
t3[0] = w3[0] ^ 0x36363636;
t3[1] = w3[1] ^ 0x36363636;
t3[2] = w3[2] ^ 0x36363636;
t3[3] = w3[3] ^ 0x36363636;
a0[0] = w0[0] ^ 0x36363636;
a0[1] = w0[1] ^ 0x36363636;
a0[2] = w0[2] ^ 0x36363636;
a0[3] = w0[3] ^ 0x36363636;
a1[0] = w1[0] ^ 0x36363636;
a1[1] = w1[1] ^ 0x36363636;
a1[2] = w1[2] ^ 0x36363636;
a1[3] = w1[3] ^ 0x36363636;
a2[0] = w2[0] ^ 0x36363636;
a2[1] = w2[1] ^ 0x36363636;
a2[2] = w2[2] ^ 0x36363636;
a2[3] = w2[3] ^ 0x36363636;
a3[0] = w3[0] ^ 0x36363636;
a3[1] = w3[1] ^ 0x36363636;
a3[2] = w3[2] ^ 0x36363636;
a3[3] = w3[3] ^ 0x36363636;
whirlpool_init_vector (&ctx->ipad, s_MT0, s_MT1, s_MT2, s_MT3, s_MT4, s_MT5, s_MT6, s_MT7);
whirlpool_update_vector_64 (&ctx->ipad, t0, t1, t2, t3, 64);
whirlpool_update_vector_64 (&ctx->ipad, a0, a1, a2, a3, 64);
// opad
t0[0] = w0[0] ^ 0x5c5c5c5c;
t0[1] = w0[1] ^ 0x5c5c5c5c;
t0[2] = w0[2] ^ 0x5c5c5c5c;
t0[3] = w0[3] ^ 0x5c5c5c5c;
t1[0] = w1[0] ^ 0x5c5c5c5c;
t1[1] = w1[1] ^ 0x5c5c5c5c;
t1[2] = w1[2] ^ 0x5c5c5c5c;
t1[3] = w1[3] ^ 0x5c5c5c5c;
t2[0] = w2[0] ^ 0x5c5c5c5c;
t2[1] = w2[1] ^ 0x5c5c5c5c;
t2[2] = w2[2] ^ 0x5c5c5c5c;
t2[3] = w2[3] ^ 0x5c5c5c5c;
t3[0] = w3[0] ^ 0x5c5c5c5c;
t3[1] = w3[1] ^ 0x5c5c5c5c;
t3[2] = w3[2] ^ 0x5c5c5c5c;
t3[3] = w3[3] ^ 0x5c5c5c5c;
u32x b0[4];
u32x b1[4];
u32x b2[4];
u32x b3[4];
b0[0] = w0[0] ^ 0x5c5c5c5c;
b0[1] = w0[1] ^ 0x5c5c5c5c;
b0[2] = w0[2] ^ 0x5c5c5c5c;
b0[3] = w0[3] ^ 0x5c5c5c5c;
b1[0] = w1[0] ^ 0x5c5c5c5c;
b1[1] = w1[1] ^ 0x5c5c5c5c;
b1[2] = w1[2] ^ 0x5c5c5c5c;
b1[3] = w1[3] ^ 0x5c5c5c5c;
b2[0] = w2[0] ^ 0x5c5c5c5c;
b2[1] = w2[1] ^ 0x5c5c5c5c;
b2[2] = w2[2] ^ 0x5c5c5c5c;
b2[3] = w2[3] ^ 0x5c5c5c5c;
b3[0] = w3[0] ^ 0x5c5c5c5c;
b3[1] = w3[1] ^ 0x5c5c5c5c;
b3[2] = w3[2] ^ 0x5c5c5c5c;
b3[3] = w3[3] ^ 0x5c5c5c5c;
whirlpool_init_vector (&ctx->opad, s_MT0, s_MT1, s_MT2, s_MT3, s_MT4, s_MT5, s_MT6, s_MT7);
whirlpool_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64);
whirlpool_update_vector_64 (&ctx->opad, b0, b1, b2, b3, 64);
}
DECLSPEC void whirlpool_hmac_init_vector (whirlpool_hmac_ctx_vector_t *ctx, const u32x *w, const int len, SHM_TYPE u64 *s_MT0, SHM_TYPE u64 *s_MT1, SHM_TYPE u64 *s_MT2, SHM_TYPE u64 *s_MT3, SHM_TYPE u64 *s_MT4, SHM_TYPE u64 *s_MT5, SHM_TYPE u64 *s_MT6, SHM_TYPE u64 *s_MT7)

View File

@ -88,18 +88,21 @@ CONSTANT_VK u32 generic_constant[8192]; // 32k
#endif
DECLSPEC u32 atomic_dec (u32 *p)
DECLSPEC u32 hc_atomic_dec (GLOBAL_AS u32 *p)
{
return atomicSub (p, 1);
volatile const u32 val = 1;
return atomicSub (p, val);
}
DECLSPEC u32 atomic_inc (u32 *p)
DECLSPEC u32 hc_atomic_inc (GLOBAL_AS u32 *p)
{
return atomicAdd (p, 1);
volatile const u32 val = 1;
return atomicAdd (p, val);
}
DECLSPEC u32 atomic_or (u32 *p, u32 val)
DECLSPEC u32 hc_atomic_or (GLOBAL_AS u32 *p, volatile const u32 val)
{
return atomicOr (p, val);
}
@ -165,6 +168,26 @@ DECLSPEC u64 rotr64_S (const u64 a, const int n)
#endif
#ifdef IS_OPENCL
DECLSPEC u32 hc_atomic_dec (volatile GLOBAL_AS u32 *p)
{
volatile const u32 val = 1;
return atomic_sub (p, val);
}
DECLSPEC u32 hc_atomic_inc (volatile GLOBAL_AS u32 *p)
{
volatile const u32 val = 1;
return atomic_add (p, val);
}
DECLSPEC u32 hc_atomic_or (volatile GLOBAL_AS u32 *p, volatile const u32 val)
{
return atomic_or (p, val);
}
#define FIXED_THREAD_COUNT(n) __attribute__((reqd_work_group_size((n), 1, 1)))
#define SYNC_THREADS() barrier (CLK_LOCAL_MEM_FENCE)
#endif

View File

@ -6,7 +6,15 @@
#ifndef _INC_PLATFORM_H
#define _INC_PLATFORM_H
DECLSPEC u32 hc_atomic_dec (volatile GLOBAL_AS u32 *p);
DECLSPEC u32 hc_atomic_inc (volatile GLOBAL_AS u32 *p);
DECLSPEC u32 hc_atomic_or (volatile GLOBAL_AS u32 *p, volatile const u32 val);
#ifdef IS_AMD
DECLSPEC u32 hc_atomic_dec (volatile GLOBAL_AS u32 *p);
DECLSPEC u32 hc_atomic_inc (volatile GLOBAL_AS u32 *p);
DECLSPEC u32 hc_atomic_or (volatile GLOBAL_AS u32 *p, volatile const u32 val);
DECLSPEC u64x rotl64 (const u64x a, const int n);
DECLSPEC u64x rotr64 (const u64x a, const int n);
DECLSPEC u64 rotl64_S (const u64 a, const int n);
@ -14,9 +22,10 @@ DECLSPEC u64 rotr64_S (const u64 a, const int n);
#endif
#if defined IS_CUDA || defined IS_HIP
DECLSPEC u32 atomic_dec (u32 *p);
DECLSPEC u32 atomic_inc (u32 *p);
DECLSPEC u32 atomic_or (u32 *p, u32 val);
DECLSPEC u32 hc_atomic_dec (volatile GLOBAL_AS u32 *p);
DECLSPEC u32 hc_atomic_inc (volatile GLOBAL_AS u32 *p);
DECLSPEC u32 hc_atomic_or (volatile GLOBAL_AS u32 *p, volatile const u32 val);
DECLSPEC size_t get_global_id (const u32 dimindx __attribute__((unused)));
DECLSPEC size_t get_local_id (const u32 dimindx __attribute__((unused)));
DECLSPEC size_t get_local_size (const u32 dimindx __attribute__((unused)));
@ -33,6 +42,7 @@ DECLSPEC u64 rotr64_S (const u64 a, const int n);
#ifdef IS_HIP
#define rotate(a,n) (((a) << (n)) | ((a) >> (32 - (n))))
#endif
#define bitselect(a,b,c) ((a) ^ ((c) & ((b) ^ (a))))
#endif

View File

@ -688,7 +688,9 @@ DECLSPEC int mangle_dupeblock_last (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const
DECLSPEC int mangle_title_sep (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len)
{
if ((len + 4) >= RP_PASSWORD_SIZE) return (len); // cheap way to not need to check for overflow of i + 1
if (len >= RP_PASSWORD_SIZE) return (len);
u32 rem = 0xff;
for (int i = 0, idx = 0; i < len; i += 4, idx += 1)
{
@ -696,22 +698,18 @@ DECLSPEC int mangle_title_sep (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p
buf[idx] = t | generate_cmask (t);
u32 out0 = 0;
u32 out1 = 0;
u32 out = rem;
if (((t >> 0) & 0xff) == p0) out0 |= 0x0000ff00;
if (((t >> 8) & 0xff) == p0) out0 |= 0x00ff0000;
if (((t >> 16) & 0xff) == p0) out0 |= 0xff000000;
if (((t >> 24) & 0xff) == p0) out1 |= 0x000000ff;
rem = 0;
buf[idx + 0] &= ~(generate_cmask (buf[idx + 0]) & out0);
buf[idx + 1] &= ~(generate_cmask (buf[idx + 1]) & out1);
if (((t >> 0) & 0xff) == p0) out |= 0x0000ff00;
if (((t >> 8) & 0xff) == p0) out |= 0x00ff0000;
if (((t >> 16) & 0xff) == p0) out |= 0xff000000;
if (((t >> 24) & 0xff) == p0) rem |= 0x000000ff;
buf[idx] &= ~(generate_cmask (buf[idx]) & out);
}
const u32 t = buf[0];
buf[0] = t & ~(0x00000020 & generate_cmask (t));
return (len);
}

View File

@ -7,11 +7,11 @@
{ \
if (((h0) == search[0]) && ((h1) == search[1]) && ((h2) == search[2]) && ((h3) == search[3])) \
{ \
const u32 final_hash_pos = digests_offset + 0; \
const u32 final_hash_pos = DIGESTS_OFFSET + 0; \
\
if (atomic_inc (&hashes_shown[final_hash_pos]) == 0) \
if (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, 0, final_hash_pos, gid, il_pos, 0, 0); \
} \
} \
}
@ -27,15 +27,15 @@
bitmap_shift1, \
bitmap_shift2)) \
{ \
int digest_pos = find_hash (digest_tp0, digests_cnt, &digests_buf[digests_offset]); \
int digest_pos = find_hash (digest_tp0, digests_cnt, &digests_buf[DIGESTS_OFFSET]); \
\
if (digest_pos != -1) \
{ \
const u32 final_hash_pos = digests_offset + digest_pos; \
const u32 final_hash_pos = DIGESTS_OFFSET + digest_pos; \
\
if (atomic_inc (&hashes_shown[final_hash_pos]) == 0) \
if (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, digest_pos, final_hash_pos, gid, il_pos, 0, 0); \
} \
} \
} \

View File

@ -17,11 +17,11 @@
{ \
if (((h0) == search[0]) && ((h1) == search[1]) && ((h2) == search[2]) && ((h3) == search[3])) \
{ \
const u32 final_hash_pos = digests_offset + 0; \
const u32 final_hash_pos = DIGESTS_OFFSET + 0; \
\
if (atomic_inc (&hashes_shown[final_hash_pos]) == 0) \
if (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, 0, final_hash_pos, gid, il_pos, 0, 0); \
} \
} \
}
@ -37,15 +37,15 @@
bitmap_shift1, \
bitmap_shift2)) \
{ \
int digest_pos = find_hash (digest_tp0, digests_cnt, &digests_buf[digests_offset]); \
int digest_pos = find_hash (digest_tp0, digests_cnt, &digests_buf[DIGESTS_OFFSET]); \
\
if (digest_pos != -1) \
{ \
const u32 final_hash_pos = digests_offset + digest_pos; \
const u32 final_hash_pos = DIGESTS_OFFSET + digest_pos; \
\
if (atomic_inc (&hashes_shown[final_hash_pos]) == 0) \
if (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, digest_pos, final_hash_pos, gid, il_pos, 0, 0); \
} \
} \
} \
@ -66,21 +66,21 @@
{ \
if (((h0).s0 == search[0]) && ((h1).s0 == search[1]) && ((h2).s0 == search[2]) && ((h3).s0 == search[3])) \
{ \
const u32 final_hash_pos = digests_offset + 0; \
const u32 final_hash_pos = DIGESTS_OFFSET + 0; \
\
if (vector_accessible (il_pos, il_cnt, 0) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 0) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 0, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, 0, final_hash_pos, gid, il_pos + 0, 0, 0); \
} \
} \
\
if (((h0).s1 == search[0]) && ((h1).s1 == search[1]) && ((h2).s1 == search[2]) && ((h3).s1 == search[3])) \
{ \
const u32 final_hash_pos = digests_offset + 0; \
const u32 final_hash_pos = DIGESTS_OFFSET + 0; \
\
if (vector_accessible (il_pos, il_cnt, 1) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 1) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 1, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, 0, final_hash_pos, gid, il_pos + 1, 0, 0); \
} \
} \
}
@ -97,15 +97,15 @@
bitmap_shift1, \
bitmap_shift2)) \
{ \
int digest_pos = find_hash (digest_tp0, digests_cnt, &digests_buf[digests_offset]); \
int digest_pos = find_hash (digest_tp0, digests_cnt, &digests_buf[DIGESTS_OFFSET]); \
\
if (digest_pos != -1) \
{ \
const u32 final_hash_pos = digests_offset + digest_pos; \
const u32 final_hash_pos = DIGESTS_OFFSET + digest_pos; \
\
if (vector_accessible (il_pos, il_cnt, 0) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 0) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 0, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 0, 0, 0); \
} \
} \
} \
@ -117,15 +117,15 @@
bitmap_shift1, \
bitmap_shift2)) \
{ \
int digest_pos = find_hash (digest_tp1, digests_cnt, &digests_buf[digests_offset]); \
int digest_pos = find_hash (digest_tp1, digests_cnt, &digests_buf[DIGESTS_OFFSET]); \
\
if (digest_pos != -1) \
{ \
const u32 final_hash_pos = digests_offset + digest_pos; \
const u32 final_hash_pos = DIGESTS_OFFSET + digest_pos; \
\
if (vector_accessible (il_pos, il_cnt, 1) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 1) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 1, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 1, 0, 0); \
} \
} \
} \
@ -144,41 +144,41 @@
{ \
if (((h0).s0 == search[0]) && ((h1).s0 == search[1]) && ((h2).s0 == search[2]) && ((h3).s0 == search[3])) \
{ \
const u32 final_hash_pos = digests_offset + 0; \
const u32 final_hash_pos = DIGESTS_OFFSET + 0; \
\
if (vector_accessible (il_pos, il_cnt, 0) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 0) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 0, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, 0, final_hash_pos, gid, il_pos + 0, 0, 0); \
} \
} \
\
if (((h0).s1 == search[0]) && ((h1).s1 == search[1]) && ((h2).s1 == search[2]) && ((h3).s1 == search[3])) \
{ \
const u32 final_hash_pos = digests_offset + 0; \
const u32 final_hash_pos = DIGESTS_OFFSET + 0; \
\
if (vector_accessible (il_pos, il_cnt, 1) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 1) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 1, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, 0, final_hash_pos, gid, il_pos + 1, 0, 0); \
} \
} \
\
if (((h0).s2 == search[0]) && ((h1).s2 == search[1]) && ((h2).s2 == search[2]) && ((h3).s2 == search[3])) \
{ \
const u32 final_hash_pos = digests_offset + 0; \
const u32 final_hash_pos = DIGESTS_OFFSET + 0; \
\
if (vector_accessible (il_pos, il_cnt, 2) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 2) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 2, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, 0, final_hash_pos, gid, il_pos + 2, 0, 0); \
} \
} \
\
if (((h0).s3 == search[0]) && ((h1).s3 == search[1]) && ((h2).s3 == search[2]) && ((h3).s3 == search[3])) \
{ \
const u32 final_hash_pos = digests_offset + 0; \
const u32 final_hash_pos = DIGESTS_OFFSET + 0; \
\
if (vector_accessible (il_pos, il_cnt, 3) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 3) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 3, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, 0, final_hash_pos, gid, il_pos + 3, 0, 0); \
} \
} \
}
@ -197,15 +197,15 @@
bitmap_shift1, \
bitmap_shift2)) \
{ \
int digest_pos = find_hash (digest_tp0, digests_cnt, &digests_buf[digests_offset]); \
int digest_pos = find_hash (digest_tp0, digests_cnt, &digests_buf[DIGESTS_OFFSET]); \
\
if (digest_pos != -1) \
{ \
const u32 final_hash_pos = digests_offset + digest_pos; \
const u32 final_hash_pos = DIGESTS_OFFSET + digest_pos; \
\
if (vector_accessible (il_pos, il_cnt, 0) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 0) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 0, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 0, 0, 0); \
} \
} \
} \
@ -217,15 +217,15 @@
bitmap_shift1, \
bitmap_shift2)) \
{ \
int digest_pos = find_hash (digest_tp1, digests_cnt, &digests_buf[digests_offset]); \
int digest_pos = find_hash (digest_tp1, digests_cnt, &digests_buf[DIGESTS_OFFSET]); \
\
if (digest_pos != -1) \
{ \
const u32 final_hash_pos = digests_offset + digest_pos; \
const u32 final_hash_pos = DIGESTS_OFFSET + digest_pos; \
\
if (vector_accessible (il_pos, il_cnt, 1) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 1) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 1, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 1, 0, 0); \
} \
} \
} \
@ -237,15 +237,15 @@
bitmap_shift1, \
bitmap_shift2)) \
{ \
int digest_pos = find_hash (digest_tp2, digests_cnt, &digests_buf[digests_offset]); \
int digest_pos = find_hash (digest_tp2, digests_cnt, &digests_buf[DIGESTS_OFFSET]); \
\
if (digest_pos != -1) \
{ \
const u32 final_hash_pos = digests_offset + digest_pos; \
const u32 final_hash_pos = DIGESTS_OFFSET + digest_pos; \
\
if (vector_accessible (il_pos, il_cnt, 2) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 2) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 2, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 2, 0, 0); \
} \
} \
} \
@ -257,15 +257,15 @@
bitmap_shift1, \
bitmap_shift2)) \
{ \
int digest_pos = find_hash (digest_tp3, digests_cnt, &digests_buf[digests_offset]); \
int digest_pos = find_hash (digest_tp3, digests_cnt, &digests_buf[DIGESTS_OFFSET]); \
\
if (digest_pos != -1) \
{ \
const u32 final_hash_pos = digests_offset + digest_pos; \
const u32 final_hash_pos = DIGESTS_OFFSET + digest_pos; \
\
if (vector_accessible (il_pos, il_cnt, 3) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 3) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 3, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 3, 0, 0); \
} \
} \
} \
@ -284,80 +284,80 @@
{ \
if (((h0).s0 == search[0]) && ((h1).s0 == search[1]) && ((h2).s0 == search[2]) && ((h3).s0 == search[3])) \
{ \
const u32 final_hash_pos = digests_offset + 0; \
const u32 final_hash_pos = DIGESTS_OFFSET + 0; \
\
if (vector_accessible (il_pos, il_cnt, 0) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 0) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 0, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, 0, final_hash_pos, gid, il_pos + 0, 0, 0); \
} \
} \
\
if (((h0).s1 == search[0]) && ((h1).s1 == search[1]) && ((h2).s1 == search[2]) && ((h3).s1 == search[3])) \
{ \
const u32 final_hash_pos = digests_offset + 0; \
const u32 final_hash_pos = DIGESTS_OFFSET + 0; \
\
if (vector_accessible (il_pos, il_cnt, 1) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 1) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 1, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, 0, final_hash_pos, gid, il_pos + 1, 0, 0); \
} \
} \
\
if (((h0).s2 == search[0]) && ((h1).s2 == search[1]) && ((h2).s2 == search[2]) && ((h3).s2 == search[3])) \
{ \
const u32 final_hash_pos = digests_offset + 0; \
const u32 final_hash_pos = DIGESTS_OFFSET + 0; \
\
if (vector_accessible (il_pos, il_cnt, 2) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 2) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 2, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, 0, final_hash_pos, gid, il_pos + 2, 0, 0); \
} \
} \
\
if (((h0).s3 == search[0]) && ((h1).s3 == search[1]) && ((h2).s3 == search[2]) && ((h3).s3 == search[3])) \
{ \
const u32 final_hash_pos = digests_offset + 0; \
const u32 final_hash_pos = DIGESTS_OFFSET + 0; \
\
if (vector_accessible (il_pos, il_cnt, 3) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 3) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 3, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, 0, final_hash_pos, gid, il_pos + 3, 0, 0); \
} \
} \
if (((h0).s4 == search[0]) && ((h1).s4 == search[1]) && ((h2).s4 == search[2]) && ((h3).s4 == search[3])) \
{ \
const u32 final_hash_pos = digests_offset + 0; \
const u32 final_hash_pos = DIGESTS_OFFSET + 0; \
\
if (vector_accessible (il_pos, il_cnt, 4) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 4) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 4, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, 0, final_hash_pos, gid, il_pos + 4, 0, 0); \
} \
} \
\
if (((h0).s5 == search[0]) && ((h1).s5 == search[1]) && ((h2).s5 == search[2]) && ((h3).s5 == search[3])) \
{ \
const u32 final_hash_pos = digests_offset + 0; \
const u32 final_hash_pos = DIGESTS_OFFSET + 0; \
\
if (vector_accessible (il_pos, il_cnt, 5) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 5) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 5, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, 0, final_hash_pos, gid, il_pos + 5, 0, 0); \
} \
} \
\
if (((h0).s6 == search[0]) && ((h1).s6 == search[1]) && ((h2).s6 == search[2]) && ((h3).s6 == search[3])) \
{ \
const u32 final_hash_pos = digests_offset + 0; \
const u32 final_hash_pos = DIGESTS_OFFSET + 0; \
\
if (vector_accessible (il_pos, il_cnt, 6) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 6) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 6, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, 0, final_hash_pos, gid, il_pos + 6, 0, 0); \
} \
} \
\
if (((h0).s7 == search[0]) && ((h1).s7 == search[1]) && ((h2).s7 == search[2]) && ((h3).s7 == search[3])) \
{ \
const u32 final_hash_pos = digests_offset + 0; \
const u32 final_hash_pos = DIGESTS_OFFSET + 0; \
\
if (vector_accessible (il_pos, il_cnt, 7) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 7) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 7, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, 0, final_hash_pos, gid, il_pos + 7, 0, 0); \
} \
} \
}
@ -380,15 +380,15 @@
bitmap_shift1, \
bitmap_shift2)) \
{ \
int digest_pos = find_hash (digest_tp0, digests_cnt, &digests_buf[digests_offset]); \
int digest_pos = find_hash (digest_tp0, digests_cnt, &digests_buf[DIGESTS_OFFSET]); \
\
if (digest_pos != -1) \
{ \
const u32 final_hash_pos = digests_offset + digest_pos; \
const u32 final_hash_pos = DIGESTS_OFFSET + digest_pos; \
\
if (vector_accessible (il_pos, il_cnt, 0) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 0) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 0, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 0, 0, 0); \
} \
} \
} \
@ -400,15 +400,15 @@
bitmap_shift1, \
bitmap_shift2)) \
{ \
int digest_pos = find_hash (digest_tp1, digests_cnt, &digests_buf[digests_offset]); \
int digest_pos = find_hash (digest_tp1, digests_cnt, &digests_buf[DIGESTS_OFFSET]); \
\
if (digest_pos != -1) \
{ \
const u32 final_hash_pos = digests_offset + digest_pos; \
const u32 final_hash_pos = DIGESTS_OFFSET + digest_pos; \
\
if (vector_accessible (il_pos, il_cnt, 1) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 1) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 1, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 1, 0, 0); \
} \
} \
} \
@ -420,15 +420,15 @@
bitmap_shift1, \
bitmap_shift2)) \
{ \
int digest_pos = find_hash (digest_tp2, digests_cnt, &digests_buf[digests_offset]); \
int digest_pos = find_hash (digest_tp2, digests_cnt, &digests_buf[DIGESTS_OFFSET]); \
\
if (digest_pos != -1) \
{ \
const u32 final_hash_pos = digests_offset + digest_pos; \
const u32 final_hash_pos = DIGESTS_OFFSET + digest_pos; \
\
if (vector_accessible (il_pos, il_cnt, 2) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 2) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 2, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 2, 0, 0); \
} \
} \
} \
@ -440,15 +440,15 @@
bitmap_shift1, \
bitmap_shift2)) \
{ \
int digest_pos = find_hash (digest_tp3, digests_cnt, &digests_buf[digests_offset]); \
int digest_pos = find_hash (digest_tp3, digests_cnt, &digests_buf[DIGESTS_OFFSET]); \
\
if (digest_pos != -1) \
{ \
const u32 final_hash_pos = digests_offset + digest_pos; \
const u32 final_hash_pos = DIGESTS_OFFSET + digest_pos; \
\
if (vector_accessible (il_pos, il_cnt, 3) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 3) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 3, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 3, 0, 0); \
} \
} \
} \
@ -459,15 +459,15 @@
bitmap_shift1, \
bitmap_shift2)) \
{ \
int digest_pos = find_hash (digest_tp4, digests_cnt, &digests_buf[digests_offset]); \
int digest_pos = find_hash (digest_tp4, digests_cnt, &digests_buf[DIGESTS_OFFSET]); \
\
if (digest_pos != -1) \
{ \
const u32 final_hash_pos = digests_offset + digest_pos; \
const u32 final_hash_pos = DIGESTS_OFFSET + digest_pos; \
\
if (vector_accessible (il_pos, il_cnt, 4) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 4) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 4, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 4, 0, 0); \
} \
} \
} \
@ -479,15 +479,15 @@
bitmap_shift1, \
bitmap_shift2)) \
{ \
int digest_pos = find_hash (digest_tp5, digests_cnt, &digests_buf[digests_offset]); \
int digest_pos = find_hash (digest_tp5, digests_cnt, &digests_buf[DIGESTS_OFFSET]); \
\
if (digest_pos != -1) \
{ \
const u32 final_hash_pos = digests_offset + digest_pos; \
const u32 final_hash_pos = DIGESTS_OFFSET + digest_pos; \
\
if (vector_accessible (il_pos, il_cnt, 5) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 5) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 5, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 5, 0, 0); \
} \
} \
} \
@ -499,15 +499,15 @@
bitmap_shift1, \
bitmap_shift2)) \
{ \
int digest_pos = find_hash (digest_tp6, digests_cnt, &digests_buf[digests_offset]); \
int digest_pos = find_hash (digest_tp6, digests_cnt, &digests_buf[DIGESTS_OFFSET]); \
\
if (digest_pos != -1) \
{ \
const u32 final_hash_pos = digests_offset + digest_pos; \
const u32 final_hash_pos = DIGESTS_OFFSET + digest_pos; \
\
if (vector_accessible (il_pos, il_cnt, 6) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 6) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 6, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 6, 0, 0); \
} \
} \
} \
@ -519,15 +519,15 @@
bitmap_shift1, \
bitmap_shift2)) \
{ \
int digest_pos = find_hash (digest_tp7, digests_cnt, &digests_buf[digests_offset]); \
int digest_pos = find_hash (digest_tp7, digests_cnt, &digests_buf[DIGESTS_OFFSET]); \
\
if (digest_pos != -1) \
{ \
const u32 final_hash_pos = digests_offset + digest_pos; \
const u32 final_hash_pos = DIGESTS_OFFSET + digest_pos; \
\
if (vector_accessible (il_pos, il_cnt, 7) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 7) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 7, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 7, 0, 0); \
} \
} \
} \
@ -546,160 +546,160 @@
{ \
if (((h0).s0 == search[0]) && ((h1).s0 == search[1]) && ((h2).s0 == search[2]) && ((h3).s0 == search[3])) \
{ \
const u32 final_hash_pos = digests_offset + 0; \
const u32 final_hash_pos = DIGESTS_OFFSET + 0; \
\
if (vector_accessible (il_pos, il_cnt, 0) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 0) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 0, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, 0, final_hash_pos, gid, il_pos + 0, 0, 0); \
} \
} \
\
if (((h0).s1 == search[0]) && ((h1).s1 == search[1]) && ((h2).s1 == search[2]) && ((h3).s1 == search[3])) \
{ \
const u32 final_hash_pos = digests_offset + 0; \
const u32 final_hash_pos = DIGESTS_OFFSET + 0; \
\
if (vector_accessible (il_pos, il_cnt, 1) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 1) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 1, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, 0, final_hash_pos, gid, il_pos + 1, 0, 0); \
} \
} \
\
if (((h0).s2 == search[0]) && ((h1).s2 == search[1]) && ((h2).s2 == search[2]) && ((h3).s2 == search[3])) \
{ \
const u32 final_hash_pos = digests_offset + 0; \
const u32 final_hash_pos = DIGESTS_OFFSET + 0; \
\
if (vector_accessible (il_pos, il_cnt, 2) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 2) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 2, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, 0, final_hash_pos, gid, il_pos + 2, 0, 0); \
} \
} \
\
if (((h0).s3 == search[0]) && ((h1).s3 == search[1]) && ((h2).s3 == search[2]) && ((h3).s3 == search[3])) \
{ \
const u32 final_hash_pos = digests_offset + 0; \
const u32 final_hash_pos = DIGESTS_OFFSET + 0; \
\
if (vector_accessible (il_pos, il_cnt, 3) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 3) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 3, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, 0, final_hash_pos, gid, il_pos + 3, 0, 0); \
} \
} \
if (((h0).s4 == search[0]) && ((h1).s4 == search[1]) && ((h2).s4 == search[2]) && ((h3).s4 == search[3])) \
{ \
const u32 final_hash_pos = digests_offset + 0; \
const u32 final_hash_pos = DIGESTS_OFFSET + 0; \
\
if (vector_accessible (il_pos, il_cnt, 4) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 4) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 4, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, 0, final_hash_pos, gid, il_pos + 4, 0, 0); \
} \
} \
\
if (((h0).s5 == search[0]) && ((h1).s5 == search[1]) && ((h2).s5 == search[2]) && ((h3).s5 == search[3])) \
{ \
const u32 final_hash_pos = digests_offset + 0; \
const u32 final_hash_pos = DIGESTS_OFFSET + 0; \
\
if (vector_accessible (il_pos, il_cnt, 5) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 5) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 5, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, 0, final_hash_pos, gid, il_pos + 5, 0, 0); \
} \
} \
\
if (((h0).s6 == search[0]) && ((h1).s6 == search[1]) && ((h2).s6 == search[2]) && ((h3).s6 == search[3])) \
{ \
const u32 final_hash_pos = digests_offset + 0; \
const u32 final_hash_pos = DIGESTS_OFFSET + 0; \
\
if (vector_accessible (il_pos, il_cnt, 6) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 6) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 6, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, 0, final_hash_pos, gid, il_pos + 6, 0, 0); \
} \
} \
\
if (((h0).s7 == search[0]) && ((h1).s7 == search[1]) && ((h2).s7 == search[2]) && ((h3).s7 == search[3])) \
{ \
const u32 final_hash_pos = digests_offset + 0; \
const u32 final_hash_pos = DIGESTS_OFFSET + 0; \
\
if (vector_accessible (il_pos, il_cnt, 7) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 7) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 7, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, 0, final_hash_pos, gid, il_pos + 7, 0, 0); \
} \
} \
\
if (((h0).s8 == search[0]) && ((h1).s8 == search[1]) && ((h2).s8 == search[2]) && ((h3).s8 == search[3])) \
{ \
const u32 final_hash_pos = digests_offset + 0; \
const u32 final_hash_pos = DIGESTS_OFFSET + 0; \
\
if (vector_accessible (il_pos, il_cnt, 8) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 8) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 8, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, 0, final_hash_pos, gid, il_pos + 8, 0, 0); \
} \
} \
\
if (((h0).s9 == search[0]) && ((h1).s9 == search[1]) && ((h2).s9 == search[2]) && ((h3).s9 == search[3])) \
{ \
const u32 final_hash_pos = digests_offset + 0; \
const u32 final_hash_pos = DIGESTS_OFFSET + 0; \
\
if (vector_accessible (il_pos, il_cnt, 9) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 9) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 9, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, 0, final_hash_pos, gid, il_pos + 9, 0, 0); \
} \
} \
\
if (((h0).sa == search[0]) && ((h1).sa == search[1]) && ((h2).sa == search[2]) && ((h3).sa == search[3])) \
{ \
const u32 final_hash_pos = digests_offset + 0; \
const u32 final_hash_pos = DIGESTS_OFFSET + 0; \
\
if (vector_accessible (il_pos, il_cnt, 10) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 10) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 10, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, 0, final_hash_pos, gid, il_pos + 10, 0, 0); \
} \
} \
\
if (((h0).sb == search[0]) && ((h1).sb == search[1]) && ((h2).sb == search[2]) && ((h3).sb == search[3])) \
{ \
const u32 final_hash_pos = digests_offset + 0; \
const u32 final_hash_pos = DIGESTS_OFFSET + 0; \
\
if (vector_accessible (il_pos, il_cnt, 11) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 11) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 11, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, 0, final_hash_pos, gid, il_pos + 11, 0, 0); \
} \
} \
\
if (((h0).sc == search[0]) && ((h1).sc == search[1]) && ((h2).sc == search[2]) && ((h3).sc == search[3])) \
{ \
const u32 final_hash_pos = digests_offset + 0; \
const u32 final_hash_pos = DIGESTS_OFFSET + 0; \
\
if (vector_accessible (il_pos, il_cnt, 12) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 12) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 12, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, 0, final_hash_pos, gid, il_pos + 12, 0, 0); \
} \
} \
\
if (((h0).sd == search[0]) && ((h1).sd == search[1]) && ((h2).sd == search[2]) && ((h3).sd == search[3])) \
{ \
const u32 final_hash_pos = digests_offset + 0; \
const u32 final_hash_pos = DIGESTS_OFFSET + 0; \
\
if (vector_accessible (il_pos, il_cnt, 13) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 13) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 13, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, 0, final_hash_pos, gid, il_pos + 13, 0, 0); \
} \
} \
\
if (((h0).se == search[0]) && ((h1).se == search[1]) && ((h2).se == search[2]) && ((h3).se == search[3])) \
{ \
const u32 final_hash_pos = digests_offset + 0; \
const u32 final_hash_pos = DIGESTS_OFFSET + 0; \
\
if (vector_accessible (il_pos, il_cnt, 14) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 14) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 14, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, 0, final_hash_pos, gid, il_pos + 14, 0, 0); \
} \
} \
\
if (((h0).sf == search[0]) && ((h1).sf == search[1]) && ((h2).sf == search[2]) && ((h3).sf == search[3])) \
{ \
const u32 final_hash_pos = digests_offset + 0; \
const u32 final_hash_pos = DIGESTS_OFFSET + 0; \
\
if (vector_accessible (il_pos, il_cnt, 15) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 15) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 15, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, 0, final_hash_pos, gid, il_pos + 15, 0, 0); \
} \
} \
}
@ -730,15 +730,15 @@
bitmap_shift1, \
bitmap_shift2)) \
{ \
int digest_pos = find_hash (digest_tp00, digests_cnt, &digests_buf[digests_offset]); \
int digest_pos = find_hash (digest_tp00, digests_cnt, &digests_buf[DIGESTS_OFFSET]); \
\
if (digest_pos != -1) \
{ \
const u32 final_hash_pos = digests_offset + digest_pos; \
const u32 final_hash_pos = DIGESTS_OFFSET + digest_pos; \
\
if (vector_accessible (il_pos, il_cnt, 0) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 0) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 0, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 0, 0, 0); \
} \
} \
} \
@ -750,15 +750,15 @@
bitmap_shift1, \
bitmap_shift2)) \
{ \
int digest_pos = find_hash (digest_tp01, digests_cnt, &digests_buf[digests_offset]); \
int digest_pos = find_hash (digest_tp01, digests_cnt, &digests_buf[DIGESTS_OFFSET]); \
\
if (digest_pos != -1) \
{ \
const u32 final_hash_pos = digests_offset + digest_pos; \
const u32 final_hash_pos = DIGESTS_OFFSET + digest_pos; \
\
if (vector_accessible (il_pos, il_cnt, 1) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 1) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 1, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 1, 0, 0); \
} \
} \
} \
@ -770,15 +770,15 @@
bitmap_shift1, \
bitmap_shift2)) \
{ \
int digest_pos = find_hash (digest_tp02, digests_cnt, &digests_buf[digests_offset]); \
int digest_pos = find_hash (digest_tp02, digests_cnt, &digests_buf[DIGESTS_OFFSET]); \
\
if (digest_pos != -1) \
{ \
const u32 final_hash_pos = digests_offset + digest_pos; \
const u32 final_hash_pos = DIGESTS_OFFSET + digest_pos; \
\
if (vector_accessible (il_pos, il_cnt, 2) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 2) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 2, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 2, 0, 0); \
} \
} \
} \
@ -790,15 +790,15 @@
bitmap_shift1, \
bitmap_shift2)) \
{ \
int digest_pos = find_hash (digest_tp03, digests_cnt, &digests_buf[digests_offset]); \
int digest_pos = find_hash (digest_tp03, digests_cnt, &digests_buf[DIGESTS_OFFSET]); \
\
if (digest_pos != -1) \
{ \
const u32 final_hash_pos = digests_offset + digest_pos; \
const u32 final_hash_pos = DIGESTS_OFFSET + digest_pos; \
\
if (vector_accessible (il_pos, il_cnt, 3) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 3) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 3, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 3, 0, 0); \
} \
} \
} \
@ -810,15 +810,15 @@
bitmap_shift1, \
bitmap_shift2)) \
{ \
int digest_pos = find_hash (digest_tp04, digests_cnt, &digests_buf[digests_offset]); \
int digest_pos = find_hash (digest_tp04, digests_cnt, &digests_buf[DIGESTS_OFFSET]); \
\
if (digest_pos != -1) \
{ \
const u32 final_hash_pos = digests_offset + digest_pos; \
const u32 final_hash_pos = DIGESTS_OFFSET + digest_pos; \
\
if (vector_accessible (il_pos, il_cnt, 4) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 4) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 4, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 4, 0, 0); \
} \
} \
} \
@ -830,15 +830,15 @@
bitmap_shift1, \
bitmap_shift2)) \
{ \
int digest_pos = find_hash (digest_tp05, digests_cnt, &digests_buf[digests_offset]); \
int digest_pos = find_hash (digest_tp05, digests_cnt, &digests_buf[DIGESTS_OFFSET]); \
\
if (digest_pos != -1) \
{ \
const u32 final_hash_pos = digests_offset + digest_pos; \
const u32 final_hash_pos = DIGESTS_OFFSET + digest_pos; \
\
if (vector_accessible (il_pos, il_cnt, 5) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 5) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 5, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 5, 0, 0); \
} \
} \
} \
@ -850,15 +850,15 @@
bitmap_shift1, \
bitmap_shift2)) \
{ \
int digest_pos = find_hash (digest_tp06, digests_cnt, &digests_buf[digests_offset]); \
int digest_pos = find_hash (digest_tp06, digests_cnt, &digests_buf[DIGESTS_OFFSET]); \
\
if (digest_pos != -1) \
{ \
const u32 final_hash_pos = digests_offset + digest_pos; \
const u32 final_hash_pos = DIGESTS_OFFSET + digest_pos; \
\
if (vector_accessible (il_pos, il_cnt, 6) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 6) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 6, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 6, 0, 0); \
} \
} \
} \
@ -870,15 +870,15 @@
bitmap_shift1, \
bitmap_shift2)) \
{ \
int digest_pos = find_hash (digest_tp07, digests_cnt, &digests_buf[digests_offset]); \
int digest_pos = find_hash (digest_tp07, digests_cnt, &digests_buf[DIGESTS_OFFSET]); \
\
if (digest_pos != -1) \
{ \
const u32 final_hash_pos = digests_offset + digest_pos; \
const u32 final_hash_pos = DIGESTS_OFFSET + digest_pos; \
\
if (vector_accessible (il_pos, il_cnt, 7) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 7) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 7, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 7, 0, 0); \
} \
} \
} \
@ -890,15 +890,15 @@
bitmap_shift1, \
bitmap_shift2)) \
{ \
int digest_pos = find_hash (digest_tp08, digests_cnt, &digests_buf[digests_offset]); \
int digest_pos = find_hash (digest_tp08, digests_cnt, &digests_buf[DIGESTS_OFFSET]); \
\
if (digest_pos != -1) \
{ \
const u32 final_hash_pos = digests_offset + digest_pos; \
const u32 final_hash_pos = DIGESTS_OFFSET + digest_pos; \
\
if (vector_accessible (il_pos, il_cnt, 8) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 8) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 8, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 8, 0, 0); \
} \
} \
} \
@ -910,15 +910,15 @@
bitmap_shift1, \
bitmap_shift2)) \
{ \
int digest_pos = find_hash (digest_tp09, digests_cnt, &digests_buf[digests_offset]); \
int digest_pos = find_hash (digest_tp09, digests_cnt, &digests_buf[DIGESTS_OFFSET]); \
\
if (digest_pos != -1) \
{ \
const u32 final_hash_pos = digests_offset + digest_pos; \
const u32 final_hash_pos = DIGESTS_OFFSET + digest_pos; \
\
if (vector_accessible (il_pos, il_cnt, 9) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 9) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 9, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 9, 0, 0); \
} \
} \
} \
@ -930,15 +930,15 @@
bitmap_shift1, \
bitmap_shift2)) \
{ \
int digest_pos = find_hash (digest_tp10, digests_cnt, &digests_buf[digests_offset]); \
int digest_pos = find_hash (digest_tp10, digests_cnt, &digests_buf[DIGESTS_OFFSET]); \
\
if (digest_pos != -1) \
{ \
const u32 final_hash_pos = digests_offset + digest_pos; \
const u32 final_hash_pos = DIGESTS_OFFSET + digest_pos; \
\
if (vector_accessible (il_pos, il_cnt, 10) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 10) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 10, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 10, 0, 0); \
} \
} \
} \
@ -950,15 +950,15 @@
bitmap_shift1, \
bitmap_shift2)) \
{ \
int digest_pos = find_hash (digest_tp11, digests_cnt, &digests_buf[digests_offset]); \
int digest_pos = find_hash (digest_tp11, digests_cnt, &digests_buf[DIGESTS_OFFSET]); \
\
if (digest_pos != -1) \
{ \
const u32 final_hash_pos = digests_offset + digest_pos; \
const u32 final_hash_pos = DIGESTS_OFFSET + digest_pos; \
\
if (vector_accessible (il_pos, il_cnt, 11) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 11) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 11, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 11, 0, 0); \
} \
} \
} \
@ -970,15 +970,15 @@
bitmap_shift1, \
bitmap_shift2)) \
{ \
int digest_pos = find_hash (digest_tp12, digests_cnt, &digests_buf[digests_offset]); \
int digest_pos = find_hash (digest_tp12, digests_cnt, &digests_buf[DIGESTS_OFFSET]); \
\
if (digest_pos != -1) \
{ \
const u32 final_hash_pos = digests_offset + digest_pos; \
const u32 final_hash_pos = DIGESTS_OFFSET + digest_pos; \
\
if (vector_accessible (il_pos, il_cnt, 12) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 12) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 12, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 12, 0, 0); \
} \
} \
} \
@ -990,15 +990,15 @@
bitmap_shift1, \
bitmap_shift2)) \
{ \
int digest_pos = find_hash (digest_tp13, digests_cnt, &digests_buf[digests_offset]); \
int digest_pos = find_hash (digest_tp13, digests_cnt, &digests_buf[DIGESTS_OFFSET]); \
\
if (digest_pos != -1) \
{ \
const u32 final_hash_pos = digests_offset + digest_pos; \
const u32 final_hash_pos = DIGESTS_OFFSET + digest_pos; \
\
if (vector_accessible (il_pos, il_cnt, 13) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 13) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 13, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 13, 0, 0); \
} \
} \
} \
@ -1010,15 +1010,15 @@
bitmap_shift1, \
bitmap_shift2)) \
{ \
int digest_pos = find_hash (digest_tp14, digests_cnt, &digests_buf[digests_offset]); \
int digest_pos = find_hash (digest_tp14, digests_cnt, &digests_buf[DIGESTS_OFFSET]); \
\
if (digest_pos != -1) \
{ \
const u32 final_hash_pos = digests_offset + digest_pos; \
const u32 final_hash_pos = DIGESTS_OFFSET + digest_pos; \
\
if (vector_accessible (il_pos, il_cnt, 14) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 14) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 14, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 14, 0, 0); \
} \
} \
} \
@ -1030,15 +1030,15 @@
bitmap_shift1, \
bitmap_shift2)) \
{ \
int digest_pos = find_hash (digest_tp15, digests_cnt, &digests_buf[digests_offset]); \
int digest_pos = find_hash (digest_tp15, digests_cnt, &digests_buf[DIGESTS_OFFSET]); \
\
if (digest_pos != -1) \
{ \
const u32 final_hash_pos = digests_offset + digest_pos; \
const u32 final_hash_pos = DIGESTS_OFFSET + digest_pos; \
\
if (vector_accessible (il_pos, il_cnt, 15) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
if (vector_accessible (il_pos, il_cnt, 15) && (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 15, 0, 0); \
mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 15, 0, 0); \
} \
} \
} \

View File

@ -33,3 +33,67 @@ DECLSPEC u32 u8add (const u32 a, const u32 b)
return r;
}
DECLSPEC u32 hc_apply_keyfile_tc (u32 *w, const int pw_len, const GLOBAL_AS tc_t *tc)
{
if (tc->keyfile_enabled == 0) return pw_len;
if (pw_len > 64)
{
w[ 0] = u8add (w[ 0], tc->keyfile_buf32[ 0]);
w[ 1] = u8add (w[ 1], tc->keyfile_buf32[ 1]);
w[ 2] = u8add (w[ 2], tc->keyfile_buf32[ 2]);
w[ 3] = u8add (w[ 3], tc->keyfile_buf32[ 3]);
w[ 4] = u8add (w[ 4], tc->keyfile_buf32[ 4]);
w[ 5] = u8add (w[ 5], tc->keyfile_buf32[ 5]);
w[ 6] = u8add (w[ 6], tc->keyfile_buf32[ 6]);
w[ 7] = u8add (w[ 7], tc->keyfile_buf32[ 7]);
w[ 8] = u8add (w[ 8], tc->keyfile_buf32[ 8]);
w[ 9] = u8add (w[ 9], tc->keyfile_buf32[ 9]);
w[10] = u8add (w[10], tc->keyfile_buf32[10]);
w[11] = u8add (w[11], tc->keyfile_buf32[11]);
w[12] = u8add (w[12], tc->keyfile_buf32[12]);
w[13] = u8add (w[13], tc->keyfile_buf32[13]);
w[14] = u8add (w[14], tc->keyfile_buf32[14]);
w[15] = u8add (w[15], tc->keyfile_buf32[15]);
w[16] = u8add (w[16], tc->keyfile_buf32[16]);
w[17] = u8add (w[17], tc->keyfile_buf32[17]);
w[18] = u8add (w[18], tc->keyfile_buf32[18]);
w[19] = u8add (w[19], tc->keyfile_buf32[19]);
w[20] = u8add (w[20], tc->keyfile_buf32[20]);
w[21] = u8add (w[21], tc->keyfile_buf32[21]);
w[22] = u8add (w[22], tc->keyfile_buf32[22]);
w[23] = u8add (w[23], tc->keyfile_buf32[23]);
w[24] = u8add (w[24], tc->keyfile_buf32[24]);
w[25] = u8add (w[25], tc->keyfile_buf32[25]);
w[26] = u8add (w[26], tc->keyfile_buf32[26]);
w[27] = u8add (w[27], tc->keyfile_buf32[27]);
w[28] = u8add (w[28], tc->keyfile_buf32[28]);
w[29] = u8add (w[29], tc->keyfile_buf32[29]);
w[30] = u8add (w[30], tc->keyfile_buf32[30]);
w[31] = u8add (w[31], tc->keyfile_buf32[31]);
return 128;
}
else
{
w[ 0] = u8add (w[ 0], tc->keyfile_buf16[ 0]);
w[ 1] = u8add (w[ 1], tc->keyfile_buf16[ 1]);
w[ 2] = u8add (w[ 2], tc->keyfile_buf16[ 2]);
w[ 3] = u8add (w[ 3], tc->keyfile_buf16[ 3]);
w[ 4] = u8add (w[ 4], tc->keyfile_buf16[ 4]);
w[ 5] = u8add (w[ 5], tc->keyfile_buf16[ 5]);
w[ 6] = u8add (w[ 6], tc->keyfile_buf16[ 6]);
w[ 7] = u8add (w[ 7], tc->keyfile_buf16[ 7]);
w[ 8] = u8add (w[ 8], tc->keyfile_buf16[ 8]);
w[ 9] = u8add (w[ 9], tc->keyfile_buf16[ 9]);
w[10] = u8add (w[10], tc->keyfile_buf16[10]);
w[11] = u8add (w[11], tc->keyfile_buf16[11]);
w[12] = u8add (w[12], tc->keyfile_buf16[12]);
w[13] = u8add (w[13], tc->keyfile_buf16[13]);
w[14] = u8add (w[14], tc->keyfile_buf16[14]);
w[15] = u8add (w[15], tc->keyfile_buf16[15]);
return 64;
}
}

View File

@ -7,5 +7,6 @@
#define _INC_TRUECRYPT_KEYFILE_H
DECLSPEC u32 u8add (const u32 a, const u32 b);
DECLSPEC u32 hc_apply_keyfile_tc (u32 *w, const int pw_len, const GLOBAL_AS tc_t *tc);
#endif // _INC_TRUECRYPT_KEYFILE_H

View File

@ -6,6 +6,16 @@
#ifndef _INC_TYPES_H
#define _INC_TYPES_H
#if ATTACK_MODE == 9
#define SALT_POS (pws_pos + gid)
#define DIGESTS_CNT 1
#define DIGESTS_OFFSET (pws_pos + gid)
#else
#define SALT_POS salt_pos_host
#define DIGESTS_CNT digests_cnt_host
#define DIGESTS_OFFSET digests_offset_host
#endif
#if defined IS_CUDA || defined IS_HIP
//https://docs.nvidia.com/cuda/nvrtc/index.html#integer-size
typedef unsigned char uchar;
@ -14,7 +24,6 @@ typedef unsigned int uint;
typedef unsigned long long xulong;
#endif
#ifdef KERNEL_STATIC
typedef uchar u8;
typedef ushort u16;
@ -162,6 +171,9 @@ inline __device__ u32x operator - (const u32x a, const u32x b) { return u32x ((
inline __device__ u32x operator * (const u32x a, const u32 b) { return u32x ((a.s0 * b), (a.s1 * b) ); }
inline __device__ u32x operator * (const u32x a, const u32x b) { return u32x ((a.s0 * b.s0), (a.s1 * b.s1)); }
inline __device__ u32x operator % (const u32x a, const u32 b) { return u32x ((a.s0 % b), (a.s1 % b) ); }
inline __device__ u32x operator % (const u32x a, const u32x b) { return u32x ((a.s0 % b.s0), (a.s1 % b.s1)); }
inline __device__ u32x operator ~ (const u32x a) { return u32x (~a.s0, ~a.s1); }
inline __device__ bool operator != (const u64x a, const u64 b) { return ((a.s0 != b) && (a.s1 != b)); }
@ -215,6 +227,9 @@ inline __device__ u64x operator - (const u64x a, const u64x b) { return u64x ((
inline __device__ u64x operator * (const u64x a, const u64 b) { return u64x ((a.s0 * b), (a.s1 * b) ); }
inline __device__ u64x operator * (const u64x a, const u64x b) { return u64x ((a.s0 * b.s0), (a.s1 * b.s1)); }
inline __device__ u64x operator % (const u64x a, const u64 b) { return u64x ((a.s0 % b), (a.s1 % b) ); }
inline __device__ u64x operator % (const u64x a, const u64x b) { return u64x ((a.s0 % b.s0), (a.s1 % b.s1)); }
inline __device__ u64x operator ~ (const u64x a) { return u64x (~a.s0, ~a.s1); }
#endif
@ -328,6 +343,9 @@ inline __device__ u32x operator - (const u32x a, const u32x b) { return u32x ((
inline __device__ u32x operator * (const u32x a, const u32 b) { return u32x ((a.s0 * b), (a.s1 * b) , (a.s2 * b), (a.s3 * b) ); }
inline __device__ u32x operator * (const u32x a, const u32x b) { return u32x ((a.s0 * b.s0), (a.s1 * b.s1), (a.s2 * b.s2), (a.s3 * b.s3)); }
inline __device__ u32x operator % (const u32x a, const u32 b) { return u32x ((a.s0 % b), (a.s1 % b) , (a.s2 % b), (a.s3 % b) ); }
inline __device__ u32x operator % (const u32x a, const u32x b) { return u32x ((a.s0 % b.s0), (a.s1 % b.s1), (a.s2 % b.s2), (a.s3 % b.s3)); }
inline __device__ u32x operator ~ (const u32x a) { return u32x (~a.s0, ~a.s1, ~a.s2, ~a.s3); }
inline __device__ bool operator != (const u64x a, const u64 b) { return ((a.s0 != b) && (a.s1 != b) && (a.s2 != b) && (a.s3 != b) ); }
@ -381,6 +399,9 @@ inline __device__ u64x operator - (const u64x a, const u64x b) { return u64x ((
inline __device__ u64x operator * (const u64x a, const u64 b) { return u64x ((a.s0 * b), (a.s1 * b) , (a.s2 * b), (a.s3 * b) ); }
inline __device__ u64x operator * (const u64x a, const u64x b) { return u64x ((a.s0 * b.s0), (a.s1 * b.s1), (a.s2 * b.s2), (a.s3 * b.s3)); }
inline __device__ u64x operator % (const u64x a, const u32 b) { return u64x ((a.s0 % b), (a.s1 % b) , (a.s2 % b), (a.s3 % b) ); }
inline __device__ u64x operator % (const u64x a, const u64x b) { return u64x ((a.s0 % b.s0), (a.s1 % b.s1), (a.s2 % b.s2), (a.s3 % b.s3)); }
inline __device__ u64x operator ~ (const u64x a) { return u64x (~a.s0, ~a.s1, ~a.s2, ~a.s3); }
#endif
@ -510,6 +531,9 @@ inline __device__ u32x operator - (const u32x a, const u32x b) { return u32x ((
inline __device__ u32x operator * (const u32x a, const u32 b) { return u32x ((a.s0 * b), (a.s1 * b) , (a.s2 * b), (a.s3 * b) , (a.s4 * b), (a.s5 * b) , (a.s6 * b), (a.s7 * b) ); }
inline __device__ u32x operator * (const u32x a, const u32x b) { return u32x ((a.s0 * b.s0), (a.s1 * b.s1), (a.s2 * b.s2), (a.s3 * b.s3), (a.s4 * b.s4), (a.s5 * b.s5), (a.s6 * b.s6), (a.s7 * b.s7)); }
inline __device__ u32x operator % (const u32x a, const u32 b) { return u32x ((a.s0 % b), (a.s1 % b) , (a.s2 % b), (a.s3 % b) , (a.s4 % b), (a.s5 % b) , (a.s6 % b), (a.s7 % b) ); }
inline __device__ u32x operator % (const u32x a, const u32x b) { return u32x ((a.s0 % b.s0), (a.s1 % b.s1), (a.s2 % b.s2), (a.s3 % b.s3), (a.s4 % b.s4), (a.s5 % b.s5), (a.s6 % b.s6), (a.s7 % b.s7)); }
inline __device__ u32x operator ~ (const u32x a) { return u32x (~a.s0, ~a.s1, ~a.s2, ~a.s3, ~a.s4, ~a.s5, ~a.s6, ~a.s7); }
inline __device__ bool operator != (const u64x a, const u64 b) { return ((a.s0 != b) && (a.s1 != b) && (a.s2 != b) && (a.s3 != b) && (a.s4 != b) && (a.s5 != b) && (a.s6 != b) && (a.s7 != b) ); }
@ -563,6 +587,9 @@ inline __device__ u64x operator - (const u64x a, const u64x b) { return u64x ((
inline __device__ u64x operator * (const u64x a, const u64 b) { return u64x ((a.s0 * b), (a.s1 * b) , (a.s2 * b), (a.s3 * b) , (a.s4 * b), (a.s5 * b) , (a.s6 * b), (a.s7 * b) ); }
inline __device__ u64x operator * (const u64x a, const u64x b) { return u64x ((a.s0 * b.s0), (a.s1 * b.s1), (a.s2 * b.s2), (a.s3 * b.s3), (a.s4 * b.s4), (a.s5 * b.s5), (a.s6 * b.s6), (a.s7 * b.s7)); }
inline __device__ u64x operator % (const u64x a, const u64 b) { return u64x ((a.s0 % b), (a.s1 % b) , (a.s2 % b), (a.s3 % b) , (a.s4 % b), (a.s5 % b) , (a.s6 % b), (a.s7 % b) ); }
inline __device__ u64x operator % (const u64x a, const u64x b) { return u64x ((a.s0 % b.s0), (a.s1 % b.s1), (a.s2 % b.s2), (a.s3 % b.s3), (a.s4 % b.s4), (a.s5 % b.s5), (a.s6 % b.s6), (a.s7 % b.s7)); }
inline __device__ u64x operator ~ (const u64x a) { return u64x (~a.s0, ~a.s1, ~a.s2, ~a.s3, ~a.s4, ~a.s5, ~a.s6, ~a.s7); }
#endif
@ -724,6 +751,9 @@ inline __device__ u32x operator - (const u32x a, const u32x b) { return u32x ((
inline __device__ u32x operator * (const u32x a, const u32 b) { return u32x ((a.s0 * b), (a.s1 * b) , (a.s2 * b), (a.s3 * b) , (a.s4 * b), (a.s5 * b) , (a.s6 * b), (a.s7 * b), (a.s8 * b), (a.s9 * b) , (a.sa * b), (a.sb * b) , (a.sc * b), (a.sd * b) , (a.se * b), (a.sf * b) ); }
inline __device__ u32x operator * (const u32x a, const u32x b) { return u32x ((a.s0 * b.s0), (a.s1 * b.s1), (a.s2 * b.s2), (a.s3 * b.s3), (a.s4 * b.s4), (a.s5 * b.s5), (a.s6 * b.s6), (a.s7 * b.s7), (a.s8 * b.s8), (a.s9 * b.s9), (a.sa * b.sa), (a.sb * b.sb), (a.sc * b.sc), (a.sd * b.sd), (a.se * b.se), (a.sf * b.sf)); }
inline __device__ u32x operator % (const u32x a, const u32 b) { return u32x ((a.s0 % b), (a.s1 % b) , (a.s2 % b), (a.s3 % b) , (a.s4 % b), (a.s5 % b) , (a.s6 % b), (a.s7 % b), (a.s8 % b), (a.s9 % b) , (a.sa % b), (a.sb % b) , (a.sc % b), (a.sd % b) , (a.se % b), (a.sf % b) ); }
inline __device__ u32x operator % (const u32x a, const u32x b) { return u32x ((a.s0 % b.s0), (a.s1 % b.s1), (a.s2 % b.s2), (a.s3 % b.s3), (a.s4 % b.s4), (a.s5 % b.s5), (a.s6 % b.s6), (a.s7 % b.s7), (a.s8 % b.s8), (a.s9 % b.s9), (a.sa % b.sa), (a.sb % b.sb), (a.sc % b.sc), (a.sd % b.sd), (a.se % b.se), (a.sf % b.sf)); }
inline __device__ u32x operator ~ (const u32x a) { return u32x (~a.s0, ~a.s1, ~a.s2, ~a.s3, ~a.s4, ~a.s5, ~a.s6, ~a.s7, ~a.s8, ~a.s9, ~a.sa, ~a.sb, ~a.sc, ~a.sd, ~a.se, ~a.sf); }
inline __device__ bool operator != (const u64x a, const u64 b) { return ((a.s0 != b) && (a.s1 != b) && (a.s2 != b) && (a.s3 != b) && (a.s4 != b) && (a.s5 != b) && (a.s6 != b) && (a.s7 != b) && (a.s8 != b) && (a.s9 != b) && (a.sa != b) && (a.sb != b) && (a.sc != b) && (a.sd != b) && (a.se != b) && (a.sf != b) ); }
@ -777,6 +807,9 @@ inline __device__ u64x operator - (const u64x a, const u64x b) { return u64x ((
inline __device__ u64x operator * (const u64x a, const u64 b) { return u64x ((a.s0 * b), (a.s1 * b) , (a.s2 * b), (a.s3 * b) , (a.s4 * b), (a.s5 * b) , (a.s6 * b), (a.s7 * b), (a.s8 * b), (a.s9 * b) , (a.sa * b), (a.sb * b) , (a.sc * b), (a.sd * b) , (a.se * b), (a.sf * b) ); }
inline __device__ u64x operator * (const u64x a, const u64x b) { return u64x ((a.s0 * b.s0), (a.s1 * b.s1), (a.s2 * b.s2), (a.s3 * b.s3), (a.s4 * b.s4), (a.s5 * b.s5), (a.s6 * b.s6), (a.s7 * b.s7), (a.s8 * b.s8), (a.s9 * b.s9), (a.sa * b.sa), (a.sb * b.sb), (a.sc * b.sc), (a.sd * b.sd), (a.se * b.se), (a.sf * b.sf)); }
inline __device__ u64x operator % (const u64x a, const u64 b) { return u64x ((a.s0 % b), (a.s1 % b) , (a.s2 % b), (a.s3 % b) , (a.s4 % b), (a.s5 % b) , (a.s6 % b), (a.s7 % b), (a.s8 % b), (a.s9 % b) , (a.sa % b), (a.sb % b) , (a.sc % b), (a.sd % b) , (a.se % b), (a.sf % b) ); }
inline __device__ u64x operator % (const u64x a, const u64x b) { return u64x ((a.s0 % b.s0), (a.s1 % b.s1), (a.s2 % b.s2), (a.s3 % b.s3), (a.s4 % b.s4), (a.s5 % b.s5), (a.s6 % b.s6), (a.s7 % b.s7), (a.s8 % b.s8), (a.s9 % b.s9), (a.sa % b.sa), (a.sb % b.sb), (a.sc % b.sc), (a.sd % b.sd), (a.se % b.se), (a.sf % b.sf)); }
inline __device__ u64x operator ~ (const u64x a) { return u64x (~a.s0, ~a.s1, ~a.s2, ~a.s3, ~a.s4, ~a.s5, ~a.s6, ~a.s7, ~a.s8, ~a.s9, ~a.sa, ~a.sb, ~a.sc, ~a.sd, ~a.se, ~a.sf); }
#endif
@ -1609,6 +1642,9 @@ typedef struct salt
u32 salt_iter;
u32 salt_iter2;
u32 salt_sign[2];
u32 salt_repeats;
u32 orig_pos;
u32 digests_cnt;
u32 digests_done;
@ -1690,4 +1726,13 @@ typedef struct keyboard_layout_mapping
} keyboard_layout_mapping_t;
typedef struct hc_enc
{
int pos; // source offset
u32 cbuf; // carry buffer
int clen; // carry length
} hc_enc_t;
#endif

View File

@ -39,10 +39,6 @@
#define KERNEL_FQ __kernel
#endif
#ifndef MAYBE_VOLATILE
#define MAYBE_VOLATILE
#endif
#ifndef MAYBE_UNUSED
#define MAYBE_UNUSED
#endif

View File

@ -0,0 +1,99 @@
/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
#include "inc_vendor.h"
#include "inc_types.h"
#include "inc_platform.h"
#include "inc_common.h"
#include "inc_veracrypt_keyfile.h"
DECLSPEC u32 u8add (const u32 a, const u32 b)
{
const u32 a1 = (a >> 0) & 0xff;
const u32 a2 = (a >> 8) & 0xff;
const u32 a3 = (a >> 16) & 0xff;
const u32 a4 = (a >> 24) & 0xff;
const u32 b1 = (b >> 0) & 0xff;
const u32 b2 = (b >> 8) & 0xff;
const u32 b3 = (b >> 16) & 0xff;
const u32 b4 = (b >> 24) & 0xff;
const u32 r1 = (a1 + b1) & 0xff;
const u32 r2 = (a2 + b2) & 0xff;
const u32 r3 = (a3 + b3) & 0xff;
const u32 r4 = (a4 + b4) & 0xff;
const u32 r = r1 << 0
| r2 << 8
| r3 << 16
| r4 << 24;
return r;
}
DECLSPEC u32 hc_apply_keyfile_vc (u32 *w, const int pw_len, const GLOBAL_AS vc_t *vc)
{
if (vc->keyfile_enabled == 0) return pw_len;
if (pw_len > 64)
{
w[ 0] = u8add (w[ 0], vc->keyfile_buf32[ 0]);
w[ 1] = u8add (w[ 1], vc->keyfile_buf32[ 1]);
w[ 2] = u8add (w[ 2], vc->keyfile_buf32[ 2]);
w[ 3] = u8add (w[ 3], vc->keyfile_buf32[ 3]);
w[ 4] = u8add (w[ 4], vc->keyfile_buf32[ 4]);
w[ 5] = u8add (w[ 5], vc->keyfile_buf32[ 5]);
w[ 6] = u8add (w[ 6], vc->keyfile_buf32[ 6]);
w[ 7] = u8add (w[ 7], vc->keyfile_buf32[ 7]);
w[ 8] = u8add (w[ 8], vc->keyfile_buf32[ 8]);
w[ 9] = u8add (w[ 9], vc->keyfile_buf32[ 9]);
w[10] = u8add (w[10], vc->keyfile_buf32[10]);
w[11] = u8add (w[11], vc->keyfile_buf32[11]);
w[12] = u8add (w[12], vc->keyfile_buf32[12]);
w[13] = u8add (w[13], vc->keyfile_buf32[13]);
w[14] = u8add (w[14], vc->keyfile_buf32[14]);
w[15] = u8add (w[15], vc->keyfile_buf32[15]);
w[16] = u8add (w[16], vc->keyfile_buf32[16]);
w[17] = u8add (w[17], vc->keyfile_buf32[17]);
w[18] = u8add (w[18], vc->keyfile_buf32[18]);
w[19] = u8add (w[19], vc->keyfile_buf32[19]);
w[20] = u8add (w[20], vc->keyfile_buf32[20]);
w[21] = u8add (w[21], vc->keyfile_buf32[21]);
w[22] = u8add (w[22], vc->keyfile_buf32[22]);
w[23] = u8add (w[23], vc->keyfile_buf32[23]);
w[24] = u8add (w[24], vc->keyfile_buf32[24]);
w[25] = u8add (w[25], vc->keyfile_buf32[25]);
w[26] = u8add (w[26], vc->keyfile_buf32[26]);
w[27] = u8add (w[27], vc->keyfile_buf32[27]);
w[28] = u8add (w[28], vc->keyfile_buf32[28]);
w[29] = u8add (w[29], vc->keyfile_buf32[29]);
w[30] = u8add (w[30], vc->keyfile_buf32[30]);
w[31] = u8add (w[31], vc->keyfile_buf32[31]);
return 128;
}
else
{
w[ 0] = u8add (w[ 0], vc->keyfile_buf16[ 0]);
w[ 1] = u8add (w[ 1], vc->keyfile_buf16[ 1]);
w[ 2] = u8add (w[ 2], vc->keyfile_buf16[ 2]);
w[ 3] = u8add (w[ 3], vc->keyfile_buf16[ 3]);
w[ 4] = u8add (w[ 4], vc->keyfile_buf16[ 4]);
w[ 5] = u8add (w[ 5], vc->keyfile_buf16[ 5]);
w[ 6] = u8add (w[ 6], vc->keyfile_buf16[ 6]);
w[ 7] = u8add (w[ 7], vc->keyfile_buf16[ 7]);
w[ 8] = u8add (w[ 8], vc->keyfile_buf16[ 8]);
w[ 9] = u8add (w[ 9], vc->keyfile_buf16[ 9]);
w[10] = u8add (w[10], vc->keyfile_buf16[10]);
w[11] = u8add (w[11], vc->keyfile_buf16[11]);
w[12] = u8add (w[12], vc->keyfile_buf16[12]);
w[13] = u8add (w[13], vc->keyfile_buf16[13]);
w[14] = u8add (w[14], vc->keyfile_buf16[14]);
w[15] = u8add (w[15], vc->keyfile_buf16[15]);
return 64;
}
}

View File

@ -0,0 +1,12 @@
/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
#ifndef _INC_VERACRYPT_KEYFILE_H
#define _INC_VERACRYPT_KEYFILE_H
DECLSPEC u32 u8add (const u32 a, const u32 b);
DECLSPEC u32 hc_apply_keyfile_vc (u32 *w, const int pw_len, const GLOBAL_AS vc_t *vc);
#endif // _INC_VERACRYPT_KEYFILE_H

View File

@ -187,10 +187,10 @@ KERNEL_FQ void m00000_s04 (KERN_ATTR_RULES ())
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**

View File

@ -77,10 +77,10 @@ KERNEL_FQ void m00000_sxx (KERN_ATTR_RULES ())
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**

View File

@ -245,10 +245,10 @@ KERNEL_FQ void m00000_s04 (KERN_ATTR_BASIC ())
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**

View File

@ -73,10 +73,10 @@ KERNEL_FQ void m00000_sxx (KERN_ATTR_BASIC ())
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**

View File

@ -290,20 +290,20 @@ DECLSPEC void m00000s (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**
* reverse
*/
u32 a_rev = digests_buf[digests_offset].digest_buf[0];
u32 b_rev = digests_buf[digests_offset].digest_buf[1];
u32 c_rev = digests_buf[digests_offset].digest_buf[2];
u32 d_rev = digests_buf[digests_offset].digest_buf[3];
u32 a_rev = digests_buf[DIGESTS_OFFSET].digest_buf[0];
u32 b_rev = digests_buf[DIGESTS_OFFSET].digest_buf[1];
u32 c_rev = digests_buf[DIGESTS_OFFSET].digest_buf[2];
u32 d_rev = digests_buf[DIGESTS_OFFSET].digest_buf[3];
MD5_STEP_REV (MD5_I_S, b_rev, c_rev, d_rev, a_rev, w[ 9], MD5C3f, MD5S33);
MD5_STEP_REV (MD5_I_S, c_rev, d_rev, a_rev, b_rev, w[ 2], MD5C3e, MD5S32);
@ -464,7 +464,7 @@ KERNEL_FQ void m00000_m04 (KERN_ATTR_VECTOR ())
* main
*/
m00000m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max);
m00000m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}
KERNEL_FQ void m00000_m08 (KERN_ATTR_VECTOR ())
@ -502,7 +502,7 @@ KERNEL_FQ void m00000_m08 (KERN_ATTR_VECTOR ())
* main
*/
m00000m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max);
m00000m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}
KERNEL_FQ void m00000_m16 (KERN_ATTR_VECTOR ())
@ -540,7 +540,7 @@ KERNEL_FQ void m00000_m16 (KERN_ATTR_VECTOR ())
* main
*/
m00000m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max);
m00000m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}
KERNEL_FQ void m00000_s04 (KERN_ATTR_VECTOR ())
@ -578,7 +578,7 @@ KERNEL_FQ void m00000_s04 (KERN_ATTR_VECTOR ())
* main
*/
m00000s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max);
m00000s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}
KERNEL_FQ void m00000_s08 (KERN_ATTR_VECTOR ())
@ -616,7 +616,7 @@ KERNEL_FQ void m00000_s08 (KERN_ATTR_VECTOR ())
* main
*/
m00000s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max);
m00000s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}
KERNEL_FQ void m00000_s16 (KERN_ATTR_VECTOR ())
@ -654,5 +654,5 @@ KERNEL_FQ void m00000_s16 (KERN_ATTR_VECTOR ())
* main
*/
m00000s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max);
m00000s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}

View File

@ -86,10 +86,10 @@ KERNEL_FQ void m00000_sxx (KERN_ATTR_VECTOR ())
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**

View File

@ -55,24 +55,24 @@ KERNEL_FQ void m00010_m04 (KERN_ATTR_RULES ())
u32 salt_buf2[4];
u32 salt_buf3[4];
salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
salt_buf0[0] = salt_bufs[SALT_POS].salt_buf[ 0];
salt_buf0[1] = salt_bufs[SALT_POS].salt_buf[ 1];
salt_buf0[2] = salt_bufs[SALT_POS].salt_buf[ 2];
salt_buf0[3] = salt_bufs[SALT_POS].salt_buf[ 3];
salt_buf1[0] = salt_bufs[SALT_POS].salt_buf[ 4];
salt_buf1[1] = salt_bufs[SALT_POS].salt_buf[ 5];
salt_buf1[2] = salt_bufs[SALT_POS].salt_buf[ 6];
salt_buf1[3] = salt_bufs[SALT_POS].salt_buf[ 7];
salt_buf2[0] = salt_bufs[SALT_POS].salt_buf[ 8];
salt_buf2[1] = salt_bufs[SALT_POS].salt_buf[ 9];
salt_buf2[2] = salt_bufs[SALT_POS].salt_buf[10];
salt_buf2[3] = salt_bufs[SALT_POS].salt_buf[11];
salt_buf3[0] = salt_bufs[SALT_POS].salt_buf[12];
salt_buf3[1] = salt_bufs[SALT_POS].salt_buf[13];
salt_buf3[2] = salt_bufs[SALT_POS].salt_buf[14];
salt_buf3[3] = salt_bufs[SALT_POS].salt_buf[15];
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
/**
* loop
@ -264,24 +264,24 @@ KERNEL_FQ void m00010_s04 (KERN_ATTR_RULES ())
u32 salt_buf2[4];
u32 salt_buf3[4];
salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
salt_buf0[0] = salt_bufs[SALT_POS].salt_buf[ 0];
salt_buf0[1] = salt_bufs[SALT_POS].salt_buf[ 1];
salt_buf0[2] = salt_bufs[SALT_POS].salt_buf[ 2];
salt_buf0[3] = salt_bufs[SALT_POS].salt_buf[ 3];
salt_buf1[0] = salt_bufs[SALT_POS].salt_buf[ 4];
salt_buf1[1] = salt_bufs[SALT_POS].salt_buf[ 5];
salt_buf1[2] = salt_bufs[SALT_POS].salt_buf[ 6];
salt_buf1[3] = salt_bufs[SALT_POS].salt_buf[ 7];
salt_buf2[0] = salt_bufs[SALT_POS].salt_buf[ 8];
salt_buf2[1] = salt_bufs[SALT_POS].salt_buf[ 9];
salt_buf2[2] = salt_bufs[SALT_POS].salt_buf[10];
salt_buf2[3] = salt_bufs[SALT_POS].salt_buf[11];
salt_buf3[0] = salt_bufs[SALT_POS].salt_buf[12];
salt_buf3[1] = salt_bufs[SALT_POS].salt_buf[13];
salt_buf3[2] = salt_bufs[SALT_POS].salt_buf[14];
salt_buf3[3] = salt_bufs[SALT_POS].salt_buf[15];
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
/**
* digest
@ -289,10 +289,10 @@ KERNEL_FQ void m00010_s04 (KERN_ATTR_RULES ())
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**

View File

@ -33,13 +33,13 @@ KERNEL_FQ void m00010_mxx (KERN_ATTR_RULES ())
COPY_PW (pws[gid]);
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
u32 s[64] = { 0 };
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
s[idx] = salt_bufs[SALT_POS].salt_buf[idx];
}
/**
@ -88,10 +88,10 @@ KERNEL_FQ void m00010_sxx (KERN_ATTR_RULES ())
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**
@ -100,13 +100,13 @@ KERNEL_FQ void m00010_sxx (KERN_ATTR_RULES ())
COPY_PW (pws[gid]);
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
u32 s[64] = { 0 };
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
s[idx] = salt_bufs[SALT_POS].salt_buf[idx];
}
/**

View File

@ -53,24 +53,24 @@ KERNEL_FQ void m00010_m04 (KERN_ATTR_BASIC ())
u32 salt_buf2[4];
u32 salt_buf3[4];
salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
salt_buf0[0] = salt_bufs[SALT_POS].salt_buf[ 0];
salt_buf0[1] = salt_bufs[SALT_POS].salt_buf[ 1];
salt_buf0[2] = salt_bufs[SALT_POS].salt_buf[ 2];
salt_buf0[3] = salt_bufs[SALT_POS].salt_buf[ 3];
salt_buf1[0] = salt_bufs[SALT_POS].salt_buf[ 4];
salt_buf1[1] = salt_bufs[SALT_POS].salt_buf[ 5];
salt_buf1[2] = salt_bufs[SALT_POS].salt_buf[ 6];
salt_buf1[3] = salt_bufs[SALT_POS].salt_buf[ 7];
salt_buf2[0] = salt_bufs[SALT_POS].salt_buf[ 8];
salt_buf2[1] = salt_bufs[SALT_POS].salt_buf[ 9];
salt_buf2[2] = salt_bufs[SALT_POS].salt_buf[10];
salt_buf2[3] = salt_bufs[SALT_POS].salt_buf[11];
salt_buf3[0] = salt_bufs[SALT_POS].salt_buf[12];
salt_buf3[1] = salt_bufs[SALT_POS].salt_buf[13];
salt_buf3[2] = salt_bufs[SALT_POS].salt_buf[14];
salt_buf3[3] = salt_bufs[SALT_POS].salt_buf[15];
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
/**
* loop
@ -322,24 +322,24 @@ KERNEL_FQ void m00010_s04 (KERN_ATTR_BASIC ())
u32 salt_buf2[4];
u32 salt_buf3[4];
salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
salt_buf0[0] = salt_bufs[SALT_POS].salt_buf[ 0];
salt_buf0[1] = salt_bufs[SALT_POS].salt_buf[ 1];
salt_buf0[2] = salt_bufs[SALT_POS].salt_buf[ 2];
salt_buf0[3] = salt_bufs[SALT_POS].salt_buf[ 3];
salt_buf1[0] = salt_bufs[SALT_POS].salt_buf[ 4];
salt_buf1[1] = salt_bufs[SALT_POS].salt_buf[ 5];
salt_buf1[2] = salt_bufs[SALT_POS].salt_buf[ 6];
salt_buf1[3] = salt_bufs[SALT_POS].salt_buf[ 7];
salt_buf2[0] = salt_bufs[SALT_POS].salt_buf[ 8];
salt_buf2[1] = salt_bufs[SALT_POS].salt_buf[ 9];
salt_buf2[2] = salt_bufs[SALT_POS].salt_buf[10];
salt_buf2[3] = salt_bufs[SALT_POS].salt_buf[11];
salt_buf3[0] = salt_bufs[SALT_POS].salt_buf[12];
salt_buf3[1] = salt_bufs[SALT_POS].salt_buf[13];
salt_buf3[2] = salt_bufs[SALT_POS].salt_buf[14];
salt_buf3[3] = salt_bufs[SALT_POS].salt_buf[15];
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
/**
* digest
@ -347,10 +347,10 @@ KERNEL_FQ void m00010_s04 (KERN_ATTR_BASIC ())
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**

View File

@ -29,13 +29,13 @@ KERNEL_FQ void m00010_mxx (KERN_ATTR_BASIC ())
* base
*/
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
u32 s[64] = { 0 };
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
s[idx] = salt_bufs[SALT_POS].salt_buf[idx];
}
md5_ctx_t ctx0;
@ -84,23 +84,23 @@ KERNEL_FQ void m00010_sxx (KERN_ATTR_BASIC ())
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**
* base
*/
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
u32 s[64] = { 0 };
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
s[idx] = salt_bufs[SALT_POS].salt_buf[idx];
}
md5_ctx_t ctx0;

View File

@ -49,24 +49,24 @@ DECLSPEC void m00010m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
u32 salt_buf2[4];
u32 salt_buf3[4];
salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
salt_buf0[0] = salt_bufs[SALT_POS].salt_buf[ 0];
salt_buf0[1] = salt_bufs[SALT_POS].salt_buf[ 1];
salt_buf0[2] = salt_bufs[SALT_POS].salt_buf[ 2];
salt_buf0[3] = salt_bufs[SALT_POS].salt_buf[ 3];
salt_buf1[0] = salt_bufs[SALT_POS].salt_buf[ 4];
salt_buf1[1] = salt_bufs[SALT_POS].salt_buf[ 5];
salt_buf1[2] = salt_bufs[SALT_POS].salt_buf[ 6];
salt_buf1[3] = salt_bufs[SALT_POS].salt_buf[ 7];
salt_buf2[0] = salt_bufs[SALT_POS].salt_buf[ 8];
salt_buf2[1] = salt_bufs[SALT_POS].salt_buf[ 9];
salt_buf2[2] = salt_bufs[SALT_POS].salt_buf[10];
salt_buf2[3] = salt_bufs[SALT_POS].salt_buf[11];
salt_buf3[0] = salt_bufs[SALT_POS].salt_buf[12];
salt_buf3[1] = salt_bufs[SALT_POS].salt_buf[13];
salt_buf3[2] = salt_bufs[SALT_POS].salt_buf[14];
salt_buf3[3] = salt_bufs[SALT_POS].salt_buf[15];
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
const u32 pw_salt_len = pw_len + salt_len;
@ -339,20 +339,20 @@ DECLSPEC void m00010s (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**
* reverse
*/
u32 a_rev = digests_buf[digests_offset].digest_buf[0];
u32 b_rev = digests_buf[digests_offset].digest_buf[1];
u32 c_rev = digests_buf[digests_offset].digest_buf[2];
u32 d_rev = digests_buf[digests_offset].digest_buf[3];
u32 a_rev = digests_buf[DIGESTS_OFFSET].digest_buf[0];
u32 b_rev = digests_buf[DIGESTS_OFFSET].digest_buf[1];
u32 c_rev = digests_buf[DIGESTS_OFFSET].digest_buf[2];
u32 d_rev = digests_buf[DIGESTS_OFFSET].digest_buf[3];
MD5_STEP_REV (MD5_I_S, b_rev, c_rev, d_rev, a_rev, w[ 9], MD5C3f, MD5S33);
MD5_STEP_REV (MD5_I_S, c_rev, d_rev, a_rev, b_rev, w[ 2], MD5C3e, MD5S32);
@ -513,7 +513,7 @@ KERNEL_FQ void m00010_m04 (KERN_ATTR_VECTOR ())
* main
*/
m00010m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max);
m00010m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}
KERNEL_FQ void m00010_m08 (KERN_ATTR_VECTOR ())
@ -551,7 +551,7 @@ KERNEL_FQ void m00010_m08 (KERN_ATTR_VECTOR ())
* main
*/
m00010m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max);
m00010m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}
KERNEL_FQ void m00010_m16 (KERN_ATTR_VECTOR ())
@ -589,7 +589,7 @@ KERNEL_FQ void m00010_m16 (KERN_ATTR_VECTOR ())
* main
*/
m00010m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max);
m00010m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}
KERNEL_FQ void m00010_s04 (KERN_ATTR_VECTOR ())
@ -627,7 +627,7 @@ KERNEL_FQ void m00010_s04 (KERN_ATTR_VECTOR ())
* main
*/
m00010s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max);
m00010s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}
KERNEL_FQ void m00010_s08 (KERN_ATTR_VECTOR ())
@ -665,7 +665,7 @@ KERNEL_FQ void m00010_s08 (KERN_ATTR_VECTOR ())
* main
*/
m00010s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max);
m00010s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}
KERNEL_FQ void m00010_s16 (KERN_ATTR_VECTOR ())
@ -703,5 +703,5 @@ KERNEL_FQ void m00010_s16 (KERN_ATTR_VECTOR ())
* main
*/
m00010s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max);
m00010s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}

View File

@ -38,13 +38,13 @@ KERNEL_FQ void m00010_mxx (KERN_ATTR_VECTOR ())
w[idx] = pws[gid].i[idx];
}
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
u32x s[64] = { 0 };
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
s[idx] = salt_bufs[SALT_POS].salt_buf[idx];
}
/**
@ -97,10 +97,10 @@ KERNEL_FQ void m00010_sxx (KERN_ATTR_VECTOR ())
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**
@ -116,13 +116,13 @@ KERNEL_FQ void m00010_sxx (KERN_ATTR_VECTOR ())
w[idx] = pws[gid].i[idx];
}
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
u32x s[64] = { 0 };
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
s[idx] = salt_bufs[SALT_POS].salt_buf[idx];
}
/**

View File

@ -55,24 +55,24 @@ KERNEL_FQ void m00020_m04 (KERN_ATTR_RULES ())
u32 salt_buf2[4];
u32 salt_buf3[4];
salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
salt_buf0[0] = salt_bufs[SALT_POS].salt_buf[ 0];
salt_buf0[1] = salt_bufs[SALT_POS].salt_buf[ 1];
salt_buf0[2] = salt_bufs[SALT_POS].salt_buf[ 2];
salt_buf0[3] = salt_bufs[SALT_POS].salt_buf[ 3];
salt_buf1[0] = salt_bufs[SALT_POS].salt_buf[ 4];
salt_buf1[1] = salt_bufs[SALT_POS].salt_buf[ 5];
salt_buf1[2] = salt_bufs[SALT_POS].salt_buf[ 6];
salt_buf1[3] = salt_bufs[SALT_POS].salt_buf[ 7];
salt_buf2[0] = salt_bufs[SALT_POS].salt_buf[ 8];
salt_buf2[1] = salt_bufs[SALT_POS].salt_buf[ 9];
salt_buf2[2] = salt_bufs[SALT_POS].salt_buf[10];
salt_buf2[3] = salt_bufs[SALT_POS].salt_buf[11];
salt_buf3[0] = salt_bufs[SALT_POS].salt_buf[12];
salt_buf3[1] = salt_bufs[SALT_POS].salt_buf[13];
salt_buf3[2] = salt_bufs[SALT_POS].salt_buf[14];
salt_buf3[3] = salt_bufs[SALT_POS].salt_buf[15];
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
/**
* loop
@ -244,24 +244,24 @@ KERNEL_FQ void m00020_s04 (KERN_ATTR_RULES ())
u32 salt_buf2[4];
u32 salt_buf3[4];
salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
salt_buf0[0] = salt_bufs[SALT_POS].salt_buf[ 0];
salt_buf0[1] = salt_bufs[SALT_POS].salt_buf[ 1];
salt_buf0[2] = salt_bufs[SALT_POS].salt_buf[ 2];
salt_buf0[3] = salt_bufs[SALT_POS].salt_buf[ 3];
salt_buf1[0] = salt_bufs[SALT_POS].salt_buf[ 4];
salt_buf1[1] = salt_bufs[SALT_POS].salt_buf[ 5];
salt_buf1[2] = salt_bufs[SALT_POS].salt_buf[ 6];
salt_buf1[3] = salt_bufs[SALT_POS].salt_buf[ 7];
salt_buf2[0] = salt_bufs[SALT_POS].salt_buf[ 8];
salt_buf2[1] = salt_bufs[SALT_POS].salt_buf[ 9];
salt_buf2[2] = salt_bufs[SALT_POS].salt_buf[10];
salt_buf2[3] = salt_bufs[SALT_POS].salt_buf[11];
salt_buf3[0] = salt_bufs[SALT_POS].salt_buf[12];
salt_buf3[1] = salt_bufs[SALT_POS].salt_buf[13];
salt_buf3[2] = salt_bufs[SALT_POS].salt_buf[14];
salt_buf3[3] = salt_bufs[SALT_POS].salt_buf[15];
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
/**
* digest
@ -269,10 +269,10 @@ KERNEL_FQ void m00020_s04 (KERN_ATTR_RULES ())
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**

View File

@ -37,7 +37,7 @@ KERNEL_FQ void m00020_mxx (KERN_ATTR_RULES ())
md5_init (&ctx0);
md5_update_global (&ctx0, salt_bufs[salt_pos].salt_buf, salt_bufs[salt_pos].salt_len);
md5_update_global (&ctx0, salt_bufs[SALT_POS].salt_buf, salt_bufs[SALT_POS].salt_len);
/**
* loop
@ -81,10 +81,10 @@ KERNEL_FQ void m00020_sxx (KERN_ATTR_RULES ())
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**
@ -97,7 +97,7 @@ KERNEL_FQ void m00020_sxx (KERN_ATTR_RULES ())
md5_init (&ctx0);
md5_update_global (&ctx0, salt_bufs[salt_pos].salt_buf, salt_bufs[salt_pos].salt_len);
md5_update_global (&ctx0, salt_bufs[SALT_POS].salt_buf, salt_bufs[SALT_POS].salt_len);
/**
* loop

View File

@ -53,24 +53,24 @@ KERNEL_FQ void m00020_m04 (KERN_ATTR_BASIC ())
u32 salt_buf2[4];
u32 salt_buf3[4];
salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
salt_buf0[0] = salt_bufs[SALT_POS].salt_buf[ 0];
salt_buf0[1] = salt_bufs[SALT_POS].salt_buf[ 1];
salt_buf0[2] = salt_bufs[SALT_POS].salt_buf[ 2];
salt_buf0[3] = salt_bufs[SALT_POS].salt_buf[ 3];
salt_buf1[0] = salt_bufs[SALT_POS].salt_buf[ 4];
salt_buf1[1] = salt_bufs[SALT_POS].salt_buf[ 5];
salt_buf1[2] = salt_bufs[SALT_POS].salt_buf[ 6];
salt_buf1[3] = salt_bufs[SALT_POS].salt_buf[ 7];
salt_buf2[0] = salt_bufs[SALT_POS].salt_buf[ 8];
salt_buf2[1] = salt_bufs[SALT_POS].salt_buf[ 9];
salt_buf2[2] = salt_bufs[SALT_POS].salt_buf[10];
salt_buf2[3] = salt_bufs[SALT_POS].salt_buf[11];
salt_buf3[0] = salt_bufs[SALT_POS].salt_buf[12];
salt_buf3[1] = salt_bufs[SALT_POS].salt_buf[13];
salt_buf3[2] = salt_bufs[SALT_POS].salt_buf[14];
salt_buf3[3] = salt_bufs[SALT_POS].salt_buf[15];
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
/**
* loop
@ -300,24 +300,24 @@ KERNEL_FQ void m00020_s04 (KERN_ATTR_BASIC ())
u32 salt_buf2[4];
u32 salt_buf3[4];
salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
salt_buf0[0] = salt_bufs[SALT_POS].salt_buf[ 0];
salt_buf0[1] = salt_bufs[SALT_POS].salt_buf[ 1];
salt_buf0[2] = salt_bufs[SALT_POS].salt_buf[ 2];
salt_buf0[3] = salt_bufs[SALT_POS].salt_buf[ 3];
salt_buf1[0] = salt_bufs[SALT_POS].salt_buf[ 4];
salt_buf1[1] = salt_bufs[SALT_POS].salt_buf[ 5];
salt_buf1[2] = salt_bufs[SALT_POS].salt_buf[ 6];
salt_buf1[3] = salt_bufs[SALT_POS].salt_buf[ 7];
salt_buf2[0] = salt_bufs[SALT_POS].salt_buf[ 8];
salt_buf2[1] = salt_bufs[SALT_POS].salt_buf[ 9];
salt_buf2[2] = salt_bufs[SALT_POS].salt_buf[10];
salt_buf2[3] = salt_bufs[SALT_POS].salt_buf[11];
salt_buf3[0] = salt_bufs[SALT_POS].salt_buf[12];
salt_buf3[1] = salt_bufs[SALT_POS].salt_buf[13];
salt_buf3[2] = salt_bufs[SALT_POS].salt_buf[14];
salt_buf3[3] = salt_bufs[SALT_POS].salt_buf[15];
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
/**
* digest
@ -325,10 +325,10 @@ KERNEL_FQ void m00020_s04 (KERN_ATTR_BASIC ())
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**

View File

@ -33,7 +33,7 @@ KERNEL_FQ void m00020_mxx (KERN_ATTR_BASIC ())
md5_init (&ctx0);
md5_update_global (&ctx0, salt_bufs[salt_pos].salt_buf, salt_bufs[salt_pos].salt_len);
md5_update_global (&ctx0, salt_bufs[SALT_POS].salt_buf, salt_bufs[SALT_POS].salt_len);
md5_update_global (&ctx0, pws[gid].i, pws[gid].pw_len);
@ -75,10 +75,10 @@ KERNEL_FQ void m00020_sxx (KERN_ATTR_BASIC ())
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**
@ -89,7 +89,7 @@ KERNEL_FQ void m00020_sxx (KERN_ATTR_BASIC ())
md5_init (&ctx0);
md5_update_global (&ctx0, salt_bufs[salt_pos].salt_buf, salt_bufs[salt_pos].salt_len);
md5_update_global (&ctx0, salt_bufs[SALT_POS].salt_buf, salt_bufs[SALT_POS].salt_len);
md5_update_global (&ctx0, pws[gid].i, pws[gid].pw_len);

View File

@ -32,24 +32,24 @@ DECLSPEC void m00020m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KER
u32 salt_buf2[4];
u32 salt_buf3[4];
salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
salt_buf0[0] = salt_bufs[SALT_POS].salt_buf[ 0];
salt_buf0[1] = salt_bufs[SALT_POS].salt_buf[ 1];
salt_buf0[2] = salt_bufs[SALT_POS].salt_buf[ 2];
salt_buf0[3] = salt_bufs[SALT_POS].salt_buf[ 3];
salt_buf1[0] = salt_bufs[SALT_POS].salt_buf[ 4];
salt_buf1[1] = salt_bufs[SALT_POS].salt_buf[ 5];
salt_buf1[2] = salt_bufs[SALT_POS].salt_buf[ 6];
salt_buf1[3] = salt_bufs[SALT_POS].salt_buf[ 7];
salt_buf2[0] = salt_bufs[SALT_POS].salt_buf[ 8];
salt_buf2[1] = salt_bufs[SALT_POS].salt_buf[ 9];
salt_buf2[2] = salt_bufs[SALT_POS].salt_buf[10];
salt_buf2[3] = salt_bufs[SALT_POS].salt_buf[11];
salt_buf3[0] = salt_bufs[SALT_POS].salt_buf[12];
salt_buf3[1] = salt_bufs[SALT_POS].salt_buf[13];
salt_buf3[2] = salt_bufs[SALT_POS].salt_buf[14];
salt_buf3[3] = salt_bufs[SALT_POS].salt_buf[15];
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
const u32 pw_salt_len = pw_len + salt_len;
@ -204,10 +204,10 @@ DECLSPEC void m00020s (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KER
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**
@ -219,24 +219,24 @@ DECLSPEC void m00020s (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KER
u32 salt_buf2[4];
u32 salt_buf3[4];
salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
salt_buf0[0] = salt_bufs[SALT_POS].salt_buf[ 0];
salt_buf0[1] = salt_bufs[SALT_POS].salt_buf[ 1];
salt_buf0[2] = salt_bufs[SALT_POS].salt_buf[ 2];
salt_buf0[3] = salt_bufs[SALT_POS].salt_buf[ 3];
salt_buf1[0] = salt_bufs[SALT_POS].salt_buf[ 4];
salt_buf1[1] = salt_bufs[SALT_POS].salt_buf[ 5];
salt_buf1[2] = salt_bufs[SALT_POS].salt_buf[ 6];
salt_buf1[3] = salt_bufs[SALT_POS].salt_buf[ 7];
salt_buf2[0] = salt_bufs[SALT_POS].salt_buf[ 8];
salt_buf2[1] = salt_bufs[SALT_POS].salt_buf[ 9];
salt_buf2[2] = salt_bufs[SALT_POS].salt_buf[10];
salt_buf2[3] = salt_bufs[SALT_POS].salt_buf[11];
salt_buf3[0] = salt_bufs[SALT_POS].salt_buf[12];
salt_buf3[1] = salt_bufs[SALT_POS].salt_buf[13];
salt_buf3[2] = salt_bufs[SALT_POS].salt_buf[14];
salt_buf3[3] = salt_bufs[SALT_POS].salt_buf[15];
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
const u32 pw_salt_len = pw_len + salt_len;
@ -423,7 +423,7 @@ KERNEL_FQ void m00020_m04 (KERN_ATTR_BASIC ())
* main
*/
m00020m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max);
m00020m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}
KERNEL_FQ void m00020_m08 (KERN_ATTR_BASIC ())
@ -470,7 +470,7 @@ KERNEL_FQ void m00020_m08 (KERN_ATTR_BASIC ())
* main
*/
m00020m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max);
m00020m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}
KERNEL_FQ void m00020_m16 (KERN_ATTR_BASIC ())
@ -517,7 +517,7 @@ KERNEL_FQ void m00020_m16 (KERN_ATTR_BASIC ())
* main
*/
m00020m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max);
m00020m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}
KERNEL_FQ void m00020_s04 (KERN_ATTR_BASIC ())
@ -564,7 +564,7 @@ KERNEL_FQ void m00020_s04 (KERN_ATTR_BASIC ())
* main
*/
m00020s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max);
m00020s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}
KERNEL_FQ void m00020_s08 (KERN_ATTR_BASIC ())
@ -611,7 +611,7 @@ KERNEL_FQ void m00020_s08 (KERN_ATTR_BASIC ())
* main
*/
m00020s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max);
m00020s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}
KERNEL_FQ void m00020_s16 (KERN_ATTR_BASIC ())
@ -658,5 +658,5 @@ KERNEL_FQ void m00020_s16 (KERN_ATTR_BASIC ())
* main
*/
m00020s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max);
m00020s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}

View File

@ -42,7 +42,7 @@ KERNEL_FQ void m00020_mxx (KERN_ATTR_VECTOR ())
md5_init (&ctx0);
md5_update_global (&ctx0, salt_bufs[salt_pos].salt_buf, salt_bufs[salt_pos].salt_len);
md5_update_global (&ctx0, salt_bufs[SALT_POS].salt_buf, salt_bufs[SALT_POS].salt_len);
/**
* loop
@ -92,10 +92,10 @@ KERNEL_FQ void m00020_sxx (KERN_ATTR_VECTOR ())
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**
@ -115,7 +115,7 @@ KERNEL_FQ void m00020_sxx (KERN_ATTR_VECTOR ())
md5_init (&ctx0);
md5_update_global (&ctx0, salt_bufs[salt_pos].salt_buf, salt_bufs[salt_pos].salt_len);
md5_update_global (&ctx0, salt_bufs[SALT_POS].salt_buf, salt_bufs[SALT_POS].salt_len);
/**
* loop

View File

@ -55,24 +55,24 @@ KERNEL_FQ void m00030_m04 (KERN_ATTR_RULES ())
u32 salt_buf2[4];
u32 salt_buf3[4];
salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
salt_buf0[0] = salt_bufs[SALT_POS].salt_buf[ 0];
salt_buf0[1] = salt_bufs[SALT_POS].salt_buf[ 1];
salt_buf0[2] = salt_bufs[SALT_POS].salt_buf[ 2];
salt_buf0[3] = salt_bufs[SALT_POS].salt_buf[ 3];
salt_buf1[0] = salt_bufs[SALT_POS].salt_buf[ 4];
salt_buf1[1] = salt_bufs[SALT_POS].salt_buf[ 5];
salt_buf1[2] = salt_bufs[SALT_POS].salt_buf[ 6];
salt_buf1[3] = salt_bufs[SALT_POS].salt_buf[ 7];
salt_buf2[0] = salt_bufs[SALT_POS].salt_buf[ 8];
salt_buf2[1] = salt_bufs[SALT_POS].salt_buf[ 9];
salt_buf2[2] = salt_bufs[SALT_POS].salt_buf[10];
salt_buf2[3] = salt_bufs[SALT_POS].salt_buf[11];
salt_buf3[0] = salt_bufs[SALT_POS].salt_buf[12];
salt_buf3[1] = salt_bufs[SALT_POS].salt_buf[13];
salt_buf3[2] = salt_bufs[SALT_POS].salt_buf[14];
salt_buf3[3] = salt_bufs[SALT_POS].salt_buf[15];
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
/**
* loop
@ -269,24 +269,24 @@ KERNEL_FQ void m00030_s04 (KERN_ATTR_RULES ())
u32 salt_buf2[4];
u32 salt_buf3[4];
salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
salt_buf0[0] = salt_bufs[SALT_POS].salt_buf[ 0];
salt_buf0[1] = salt_bufs[SALT_POS].salt_buf[ 1];
salt_buf0[2] = salt_bufs[SALT_POS].salt_buf[ 2];
salt_buf0[3] = salt_bufs[SALT_POS].salt_buf[ 3];
salt_buf1[0] = salt_bufs[SALT_POS].salt_buf[ 4];
salt_buf1[1] = salt_bufs[SALT_POS].salt_buf[ 5];
salt_buf1[2] = salt_bufs[SALT_POS].salt_buf[ 6];
salt_buf1[3] = salt_bufs[SALT_POS].salt_buf[ 7];
salt_buf2[0] = salt_bufs[SALT_POS].salt_buf[ 8];
salt_buf2[1] = salt_bufs[SALT_POS].salt_buf[ 9];
salt_buf2[2] = salt_bufs[SALT_POS].salt_buf[10];
salt_buf2[3] = salt_bufs[SALT_POS].salt_buf[11];
salt_buf3[0] = salt_bufs[SALT_POS].salt_buf[12];
salt_buf3[1] = salt_bufs[SALT_POS].salt_buf[13];
salt_buf3[2] = salt_bufs[SALT_POS].salt_buf[14];
salt_buf3[3] = salt_bufs[SALT_POS].salt_buf[15];
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
/**
* digest
@ -294,10 +294,10 @@ KERNEL_FQ void m00030_s04 (KERN_ATTR_RULES ())
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**

View File

@ -33,13 +33,13 @@ KERNEL_FQ void m00030_mxx (KERN_ATTR_RULES ())
COPY_PW (pws[gid]);
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
u32 s[64] = { 0 };
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
s[idx] = salt_bufs[SALT_POS].salt_buf[idx];
}
/**
@ -88,10 +88,10 @@ KERNEL_FQ void m00030_sxx (KERN_ATTR_RULES ())
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**
@ -100,13 +100,13 @@ KERNEL_FQ void m00030_sxx (KERN_ATTR_RULES ())
COPY_PW (pws[gid]);
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
u32 s[64] = { 0 };
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
s[idx] = salt_bufs[SALT_POS].salt_buf[idx];
}
/**

View File

@ -53,24 +53,24 @@ KERNEL_FQ void m00030_m04 (KERN_ATTR_BASIC ())
u32 salt_buf2[4];
u32 salt_buf3[4];
salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
salt_buf0[0] = salt_bufs[SALT_POS].salt_buf[ 0];
salt_buf0[1] = salt_bufs[SALT_POS].salt_buf[ 1];
salt_buf0[2] = salt_bufs[SALT_POS].salt_buf[ 2];
salt_buf0[3] = salt_bufs[SALT_POS].salt_buf[ 3];
salt_buf1[0] = salt_bufs[SALT_POS].salt_buf[ 4];
salt_buf1[1] = salt_bufs[SALT_POS].salt_buf[ 5];
salt_buf1[2] = salt_bufs[SALT_POS].salt_buf[ 6];
salt_buf1[3] = salt_bufs[SALT_POS].salt_buf[ 7];
salt_buf2[0] = salt_bufs[SALT_POS].salt_buf[ 8];
salt_buf2[1] = salt_bufs[SALT_POS].salt_buf[ 9];
salt_buf2[2] = salt_bufs[SALT_POS].salt_buf[10];
salt_buf2[3] = salt_bufs[SALT_POS].salt_buf[11];
salt_buf3[0] = salt_bufs[SALT_POS].salt_buf[12];
salt_buf3[1] = salt_bufs[SALT_POS].salt_buf[13];
salt_buf3[2] = salt_bufs[SALT_POS].salt_buf[14];
salt_buf3[3] = salt_bufs[SALT_POS].salt_buf[15];
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
/**
* loop
@ -327,24 +327,24 @@ KERNEL_FQ void m00030_s04 (KERN_ATTR_BASIC ())
u32 salt_buf2[4];
u32 salt_buf3[4];
salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
salt_buf0[0] = salt_bufs[SALT_POS].salt_buf[ 0];
salt_buf0[1] = salt_bufs[SALT_POS].salt_buf[ 1];
salt_buf0[2] = salt_bufs[SALT_POS].salt_buf[ 2];
salt_buf0[3] = salt_bufs[SALT_POS].salt_buf[ 3];
salt_buf1[0] = salt_bufs[SALT_POS].salt_buf[ 4];
salt_buf1[1] = salt_bufs[SALT_POS].salt_buf[ 5];
salt_buf1[2] = salt_bufs[SALT_POS].salt_buf[ 6];
salt_buf1[3] = salt_bufs[SALT_POS].salt_buf[ 7];
salt_buf2[0] = salt_bufs[SALT_POS].salt_buf[ 8];
salt_buf2[1] = salt_bufs[SALT_POS].salt_buf[ 9];
salt_buf2[2] = salt_bufs[SALT_POS].salt_buf[10];
salt_buf2[3] = salt_bufs[SALT_POS].salt_buf[11];
salt_buf3[0] = salt_bufs[SALT_POS].salt_buf[12];
salt_buf3[1] = salt_bufs[SALT_POS].salt_buf[13];
salt_buf3[2] = salt_bufs[SALT_POS].salt_buf[14];
salt_buf3[3] = salt_bufs[SALT_POS].salt_buf[15];
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
/**
* digest
@ -352,10 +352,10 @@ KERNEL_FQ void m00030_s04 (KERN_ATTR_BASIC ())
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**

View File

@ -29,13 +29,13 @@ KERNEL_FQ void m00030_mxx (KERN_ATTR_BASIC ())
* base
*/
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
u32 s[64] = { 0 };
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
s[idx] = salt_bufs[SALT_POS].salt_buf[idx];
}
md5_ctx_t ctx0;
@ -84,23 +84,23 @@ KERNEL_FQ void m00030_sxx (KERN_ATTR_BASIC ())
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**
* base
*/
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
u32 s[64] = { 0 };
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
s[idx] = salt_bufs[SALT_POS].salt_buf[idx];
}
md5_ctx_t ctx0;

View File

@ -49,24 +49,24 @@ DECLSPEC void m00030m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
u32 salt_buf2[4];
u32 salt_buf3[4];
salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
salt_buf0[0] = salt_bufs[SALT_POS].salt_buf[ 0];
salt_buf0[1] = salt_bufs[SALT_POS].salt_buf[ 1];
salt_buf0[2] = salt_bufs[SALT_POS].salt_buf[ 2];
salt_buf0[3] = salt_bufs[SALT_POS].salt_buf[ 3];
salt_buf1[0] = salt_bufs[SALT_POS].salt_buf[ 4];
salt_buf1[1] = salt_bufs[SALT_POS].salt_buf[ 5];
salt_buf1[2] = salt_bufs[SALT_POS].salt_buf[ 6];
salt_buf1[3] = salt_bufs[SALT_POS].salt_buf[ 7];
salt_buf2[0] = salt_bufs[SALT_POS].salt_buf[ 8];
salt_buf2[1] = salt_bufs[SALT_POS].salt_buf[ 9];
salt_buf2[2] = salt_bufs[SALT_POS].salt_buf[10];
salt_buf2[3] = salt_bufs[SALT_POS].salt_buf[11];
salt_buf3[0] = salt_bufs[SALT_POS].salt_buf[12];
salt_buf3[1] = salt_bufs[SALT_POS].salt_buf[13];
salt_buf3[2] = salt_bufs[SALT_POS].salt_buf[14];
salt_buf3[3] = salt_bufs[SALT_POS].salt_buf[15];
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
const u32 pw_salt_len = pw_len + salt_len;
@ -339,20 +339,20 @@ DECLSPEC void m00030s (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**
* reverse
*/
u32 a_rev = digests_buf[digests_offset].digest_buf[0];
u32 b_rev = digests_buf[digests_offset].digest_buf[1];
u32 c_rev = digests_buf[digests_offset].digest_buf[2];
u32 d_rev = digests_buf[digests_offset].digest_buf[3];
u32 a_rev = digests_buf[DIGESTS_OFFSET].digest_buf[0];
u32 b_rev = digests_buf[DIGESTS_OFFSET].digest_buf[1];
u32 c_rev = digests_buf[DIGESTS_OFFSET].digest_buf[2];
u32 d_rev = digests_buf[DIGESTS_OFFSET].digest_buf[3];
MD5_STEP_REV (MD5_I_S, b_rev, c_rev, d_rev, a_rev, w[ 9], MD5C3f, MD5S33);
MD5_STEP_REV (MD5_I_S, c_rev, d_rev, a_rev, b_rev, w[ 2], MD5C3e, MD5S32);
@ -513,7 +513,7 @@ KERNEL_FQ void m00030_m04 (KERN_ATTR_VECTOR ())
* main
*/
m00030m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max);
m00030m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}
KERNEL_FQ void m00030_m08 (KERN_ATTR_VECTOR ())
@ -551,7 +551,7 @@ KERNEL_FQ void m00030_m08 (KERN_ATTR_VECTOR ())
* main
*/
m00030m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max);
m00030m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}
KERNEL_FQ void m00030_m16 (KERN_ATTR_VECTOR ())
@ -589,7 +589,7 @@ KERNEL_FQ void m00030_m16 (KERN_ATTR_VECTOR ())
* main
*/
m00030m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max);
m00030m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}
KERNEL_FQ void m00030_s04 (KERN_ATTR_VECTOR ())
@ -627,7 +627,7 @@ KERNEL_FQ void m00030_s04 (KERN_ATTR_VECTOR ())
* main
*/
m00030s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max);
m00030s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}
KERNEL_FQ void m00030_s08 (KERN_ATTR_VECTOR ())
@ -665,7 +665,7 @@ KERNEL_FQ void m00030_s08 (KERN_ATTR_VECTOR ())
* main
*/
m00030s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max);
m00030s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}
KERNEL_FQ void m00030_s16 (KERN_ATTR_VECTOR ())
@ -703,5 +703,5 @@ KERNEL_FQ void m00030_s16 (KERN_ATTR_VECTOR ())
* main
*/
m00030s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max);
m00030s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}

View File

@ -38,13 +38,13 @@ KERNEL_FQ void m00030_mxx (KERN_ATTR_VECTOR ())
w[idx] = pws[gid].i[idx];
}
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
u32x s[64] = { 0 };
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
s[idx] = salt_bufs[SALT_POS].salt_buf[idx];
}
/**
@ -97,10 +97,10 @@ KERNEL_FQ void m00030_sxx (KERN_ATTR_VECTOR ())
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**
@ -116,13 +116,13 @@ KERNEL_FQ void m00030_sxx (KERN_ATTR_VECTOR ())
w[idx] = pws[gid].i[idx];
}
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
u32x s[64] = { 0 };
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
s[idx] = salt_bufs[SALT_POS].salt_buf[idx];
}
/**

View File

@ -55,24 +55,24 @@ KERNEL_FQ void m00040_m04 (KERN_ATTR_RULES ())
u32 salt_buf2[4];
u32 salt_buf3[4];
salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
salt_buf0[0] = salt_bufs[SALT_POS].salt_buf[ 0];
salt_buf0[1] = salt_bufs[SALT_POS].salt_buf[ 1];
salt_buf0[2] = salt_bufs[SALT_POS].salt_buf[ 2];
salt_buf0[3] = salt_bufs[SALT_POS].salt_buf[ 3];
salt_buf1[0] = salt_bufs[SALT_POS].salt_buf[ 4];
salt_buf1[1] = salt_bufs[SALT_POS].salt_buf[ 5];
salt_buf1[2] = salt_bufs[SALT_POS].salt_buf[ 6];
salt_buf1[3] = salt_bufs[SALT_POS].salt_buf[ 7];
salt_buf2[0] = salt_bufs[SALT_POS].salt_buf[ 8];
salt_buf2[1] = salt_bufs[SALT_POS].salt_buf[ 9];
salt_buf2[2] = salt_bufs[SALT_POS].salt_buf[10];
salt_buf2[3] = salt_bufs[SALT_POS].salt_buf[11];
salt_buf3[0] = salt_bufs[SALT_POS].salt_buf[12];
salt_buf3[1] = salt_bufs[SALT_POS].salt_buf[13];
salt_buf3[2] = salt_bufs[SALT_POS].salt_buf[14];
salt_buf3[3] = salt_bufs[SALT_POS].salt_buf[15];
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
/**
* loop
@ -249,24 +249,24 @@ KERNEL_FQ void m00040_s04 (KERN_ATTR_RULES ())
u32 salt_buf2[4];
u32 salt_buf3[4];
salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
salt_buf0[0] = salt_bufs[SALT_POS].salt_buf[ 0];
salt_buf0[1] = salt_bufs[SALT_POS].salt_buf[ 1];
salt_buf0[2] = salt_bufs[SALT_POS].salt_buf[ 2];
salt_buf0[3] = salt_bufs[SALT_POS].salt_buf[ 3];
salt_buf1[0] = salt_bufs[SALT_POS].salt_buf[ 4];
salt_buf1[1] = salt_bufs[SALT_POS].salt_buf[ 5];
salt_buf1[2] = salt_bufs[SALT_POS].salt_buf[ 6];
salt_buf1[3] = salt_bufs[SALT_POS].salt_buf[ 7];
salt_buf2[0] = salt_bufs[SALT_POS].salt_buf[ 8];
salt_buf2[1] = salt_bufs[SALT_POS].salt_buf[ 9];
salt_buf2[2] = salt_bufs[SALT_POS].salt_buf[10];
salt_buf2[3] = salt_bufs[SALT_POS].salt_buf[11];
salt_buf3[0] = salt_bufs[SALT_POS].salt_buf[12];
salt_buf3[1] = salt_bufs[SALT_POS].salt_buf[13];
salt_buf3[2] = salt_bufs[SALT_POS].salt_buf[14];
salt_buf3[3] = salt_bufs[SALT_POS].salt_buf[15];
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
/**
* digest
@ -274,10 +274,10 @@ KERNEL_FQ void m00040_s04 (KERN_ATTR_RULES ())
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**

View File

@ -37,7 +37,7 @@ KERNEL_FQ void m00040_mxx (KERN_ATTR_RULES ())
md5_init (&ctx0);
md5_update_global (&ctx0, salt_bufs[salt_pos].salt_buf, salt_bufs[salt_pos].salt_len);
md5_update_global (&ctx0, salt_bufs[SALT_POS].salt_buf, salt_bufs[SALT_POS].salt_len);
/**
* loop
@ -81,10 +81,10 @@ KERNEL_FQ void m00040_sxx (KERN_ATTR_RULES ())
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**
@ -97,7 +97,7 @@ KERNEL_FQ void m00040_sxx (KERN_ATTR_RULES ())
md5_init (&ctx0);
md5_update_global (&ctx0, salt_bufs[salt_pos].salt_buf, salt_bufs[salt_pos].salt_len);
md5_update_global (&ctx0, salt_bufs[SALT_POS].salt_buf, salt_bufs[SALT_POS].salt_len);
/**
* loop

View File

@ -53,24 +53,24 @@ KERNEL_FQ void m00040_m04 (KERN_ATTR_BASIC ())
u32 salt_buf2[4];
u32 salt_buf3[4];
salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
salt_buf0[0] = salt_bufs[SALT_POS].salt_buf[ 0];
salt_buf0[1] = salt_bufs[SALT_POS].salt_buf[ 1];
salt_buf0[2] = salt_bufs[SALT_POS].salt_buf[ 2];
salt_buf0[3] = salt_bufs[SALT_POS].salt_buf[ 3];
salt_buf1[0] = salt_bufs[SALT_POS].salt_buf[ 4];
salt_buf1[1] = salt_bufs[SALT_POS].salt_buf[ 5];
salt_buf1[2] = salt_bufs[SALT_POS].salt_buf[ 6];
salt_buf1[3] = salt_bufs[SALT_POS].salt_buf[ 7];
salt_buf2[0] = salt_bufs[SALT_POS].salt_buf[ 8];
salt_buf2[1] = salt_bufs[SALT_POS].salt_buf[ 9];
salt_buf2[2] = salt_bufs[SALT_POS].salt_buf[10];
salt_buf2[3] = salt_bufs[SALT_POS].salt_buf[11];
salt_buf3[0] = salt_bufs[SALT_POS].salt_buf[12];
salt_buf3[1] = salt_bufs[SALT_POS].salt_buf[13];
salt_buf3[2] = salt_bufs[SALT_POS].salt_buf[14];
salt_buf3[3] = salt_bufs[SALT_POS].salt_buf[15];
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
/**
* loop
@ -305,24 +305,24 @@ KERNEL_FQ void m00040_s04 (KERN_ATTR_BASIC ())
u32 salt_buf2[4];
u32 salt_buf3[4];
salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
salt_buf0[0] = salt_bufs[SALT_POS].salt_buf[ 0];
salt_buf0[1] = salt_bufs[SALT_POS].salt_buf[ 1];
salt_buf0[2] = salt_bufs[SALT_POS].salt_buf[ 2];
salt_buf0[3] = salt_bufs[SALT_POS].salt_buf[ 3];
salt_buf1[0] = salt_bufs[SALT_POS].salt_buf[ 4];
salt_buf1[1] = salt_bufs[SALT_POS].salt_buf[ 5];
salt_buf1[2] = salt_bufs[SALT_POS].salt_buf[ 6];
salt_buf1[3] = salt_bufs[SALT_POS].salt_buf[ 7];
salt_buf2[0] = salt_bufs[SALT_POS].salt_buf[ 8];
salt_buf2[1] = salt_bufs[SALT_POS].salt_buf[ 9];
salt_buf2[2] = salt_bufs[SALT_POS].salt_buf[10];
salt_buf2[3] = salt_bufs[SALT_POS].salt_buf[11];
salt_buf3[0] = salt_bufs[SALT_POS].salt_buf[12];
salt_buf3[1] = salt_bufs[SALT_POS].salt_buf[13];
salt_buf3[2] = salt_bufs[SALT_POS].salt_buf[14];
salt_buf3[3] = salt_bufs[SALT_POS].salt_buf[15];
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
/**
* digest
@ -330,10 +330,10 @@ KERNEL_FQ void m00040_s04 (KERN_ATTR_BASIC ())
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**

View File

@ -33,7 +33,7 @@ KERNEL_FQ void m00040_mxx (KERN_ATTR_BASIC ())
md5_init (&ctx0);
md5_update_global (&ctx0, salt_bufs[salt_pos].salt_buf, salt_bufs[salt_pos].salt_len);
md5_update_global (&ctx0, salt_bufs[SALT_POS].salt_buf, salt_bufs[SALT_POS].salt_len);
md5_update_global_utf16le (&ctx0, pws[gid].i, pws[gid].pw_len);
@ -75,10 +75,10 @@ KERNEL_FQ void m00040_sxx (KERN_ATTR_BASIC ())
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**
@ -89,7 +89,7 @@ KERNEL_FQ void m00040_sxx (KERN_ATTR_BASIC ())
md5_init (&ctx0);
md5_update_global (&ctx0, salt_bufs[salt_pos].salt_buf, salt_bufs[salt_pos].salt_len);
md5_update_global (&ctx0, salt_bufs[SALT_POS].salt_buf, salt_bufs[SALT_POS].salt_len);
md5_update_global_utf16le (&ctx0, pws[gid].i, pws[gid].pw_len);

View File

@ -32,24 +32,24 @@ DECLSPEC void m00040m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KER
u32 salt_buf2[4];
u32 salt_buf3[4];
salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
salt_buf0[0] = salt_bufs[SALT_POS].salt_buf[ 0];
salt_buf0[1] = salt_bufs[SALT_POS].salt_buf[ 1];
salt_buf0[2] = salt_bufs[SALT_POS].salt_buf[ 2];
salt_buf0[3] = salt_bufs[SALT_POS].salt_buf[ 3];
salt_buf1[0] = salt_bufs[SALT_POS].salt_buf[ 4];
salt_buf1[1] = salt_bufs[SALT_POS].salt_buf[ 5];
salt_buf1[2] = salt_bufs[SALT_POS].salt_buf[ 6];
salt_buf1[3] = salt_bufs[SALT_POS].salt_buf[ 7];
salt_buf2[0] = salt_bufs[SALT_POS].salt_buf[ 8];
salt_buf2[1] = salt_bufs[SALT_POS].salt_buf[ 9];
salt_buf2[2] = salt_bufs[SALT_POS].salt_buf[10];
salt_buf2[3] = salt_bufs[SALT_POS].salt_buf[11];
salt_buf3[0] = salt_bufs[SALT_POS].salt_buf[12];
salt_buf3[1] = salt_bufs[SALT_POS].salt_buf[13];
salt_buf3[2] = salt_bufs[SALT_POS].salt_buf[14];
salt_buf3[3] = salt_bufs[SALT_POS].salt_buf[15];
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
const u32 pw_salt_len = pw_len + salt_len;
@ -204,10 +204,10 @@ DECLSPEC void m00040s (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KER
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**
@ -219,24 +219,24 @@ DECLSPEC void m00040s (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KER
u32 salt_buf2[4];
u32 salt_buf3[4];
salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
salt_buf0[0] = salt_bufs[SALT_POS].salt_buf[ 0];
salt_buf0[1] = salt_bufs[SALT_POS].salt_buf[ 1];
salt_buf0[2] = salt_bufs[SALT_POS].salt_buf[ 2];
salt_buf0[3] = salt_bufs[SALT_POS].salt_buf[ 3];
salt_buf1[0] = salt_bufs[SALT_POS].salt_buf[ 4];
salt_buf1[1] = salt_bufs[SALT_POS].salt_buf[ 5];
salt_buf1[2] = salt_bufs[SALT_POS].salt_buf[ 6];
salt_buf1[3] = salt_bufs[SALT_POS].salt_buf[ 7];
salt_buf2[0] = salt_bufs[SALT_POS].salt_buf[ 8];
salt_buf2[1] = salt_bufs[SALT_POS].salt_buf[ 9];
salt_buf2[2] = salt_bufs[SALT_POS].salt_buf[10];
salt_buf2[3] = salt_bufs[SALT_POS].salt_buf[11];
salt_buf3[0] = salt_bufs[SALT_POS].salt_buf[12];
salt_buf3[1] = salt_bufs[SALT_POS].salt_buf[13];
salt_buf3[2] = salt_bufs[SALT_POS].salt_buf[14];
salt_buf3[3] = salt_bufs[SALT_POS].salt_buf[15];
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
const u32 pw_salt_len = pw_len + salt_len;
@ -423,7 +423,7 @@ KERNEL_FQ void m00040_m04 (KERN_ATTR_BASIC ())
* main
*/
m00040m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max);
m00040m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}
KERNEL_FQ void m00040_m08 (KERN_ATTR_BASIC ())
@ -470,7 +470,7 @@ KERNEL_FQ void m00040_m08 (KERN_ATTR_BASIC ())
* main
*/
m00040m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max);
m00040m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}
KERNEL_FQ void m00040_m16 (KERN_ATTR_BASIC ())
@ -517,7 +517,7 @@ KERNEL_FQ void m00040_m16 (KERN_ATTR_BASIC ())
* main
*/
m00040m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max);
m00040m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}
KERNEL_FQ void m00040_s04 (KERN_ATTR_BASIC ())
@ -564,7 +564,7 @@ KERNEL_FQ void m00040_s04 (KERN_ATTR_BASIC ())
* main
*/
m00040s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max);
m00040s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}
KERNEL_FQ void m00040_s08 (KERN_ATTR_BASIC ())
@ -611,7 +611,7 @@ KERNEL_FQ void m00040_s08 (KERN_ATTR_BASIC ())
* main
*/
m00040s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max);
m00040s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}
KERNEL_FQ void m00040_s16 (KERN_ATTR_BASIC ())
@ -658,5 +658,5 @@ KERNEL_FQ void m00040_s16 (KERN_ATTR_BASIC ())
* main
*/
m00040s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max);
m00040s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}

View File

@ -42,7 +42,7 @@ KERNEL_FQ void m00040_mxx (KERN_ATTR_VECTOR ())
md5_init (&ctx0);
md5_update_global (&ctx0, salt_bufs[salt_pos].salt_buf, salt_bufs[salt_pos].salt_len);
md5_update_global (&ctx0, salt_bufs[SALT_POS].salt_buf, salt_bufs[SALT_POS].salt_len);
/**
* loop
@ -92,10 +92,10 @@ KERNEL_FQ void m00040_sxx (KERN_ATTR_VECTOR ())
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**
@ -115,7 +115,7 @@ KERNEL_FQ void m00040_sxx (KERN_ATTR_VECTOR ())
md5_init (&ctx0);
md5_update_global (&ctx0, salt_bufs[salt_pos].salt_buf, salt_bufs[salt_pos].salt_len);
md5_update_global (&ctx0, salt_bufs[SALT_POS].salt_buf, salt_bufs[SALT_POS].salt_len);
/**
* loop

View File

@ -140,24 +140,24 @@ KERNEL_FQ void m00050_m04 (KERN_ATTR_RULES ())
u32 salt_buf2[4];
u32 salt_buf3[4];
salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
salt_buf0[0] = salt_bufs[SALT_POS].salt_buf[ 0];
salt_buf0[1] = salt_bufs[SALT_POS].salt_buf[ 1];
salt_buf0[2] = salt_bufs[SALT_POS].salt_buf[ 2];
salt_buf0[3] = salt_bufs[SALT_POS].salt_buf[ 3];
salt_buf1[0] = salt_bufs[SALT_POS].salt_buf[ 4];
salt_buf1[1] = salt_bufs[SALT_POS].salt_buf[ 5];
salt_buf1[2] = salt_bufs[SALT_POS].salt_buf[ 6];
salt_buf1[3] = salt_bufs[SALT_POS].salt_buf[ 7];
salt_buf2[0] = salt_bufs[SALT_POS].salt_buf[ 8];
salt_buf2[1] = salt_bufs[SALT_POS].salt_buf[ 9];
salt_buf2[2] = salt_bufs[SALT_POS].salt_buf[10];
salt_buf2[3] = salt_bufs[SALT_POS].salt_buf[11];
salt_buf3[0] = salt_bufs[SALT_POS].salt_buf[12];
salt_buf3[1] = salt_bufs[SALT_POS].salt_buf[13];
salt_buf3[2] = salt_bufs[SALT_POS].salt_buf[14];
salt_buf3[3] = salt_bufs[SALT_POS].salt_buf[15];
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
/**
* loop
@ -253,24 +253,24 @@ KERNEL_FQ void m00050_s04 (KERN_ATTR_RULES ())
u32 salt_buf2[4];
u32 salt_buf3[4];
salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
salt_buf0[0] = salt_bufs[SALT_POS].salt_buf[ 0];
salt_buf0[1] = salt_bufs[SALT_POS].salt_buf[ 1];
salt_buf0[2] = salt_bufs[SALT_POS].salt_buf[ 2];
salt_buf0[3] = salt_bufs[SALT_POS].salt_buf[ 3];
salt_buf1[0] = salt_bufs[SALT_POS].salt_buf[ 4];
salt_buf1[1] = salt_bufs[SALT_POS].salt_buf[ 5];
salt_buf1[2] = salt_bufs[SALT_POS].salt_buf[ 6];
salt_buf1[3] = salt_bufs[SALT_POS].salt_buf[ 7];
salt_buf2[0] = salt_bufs[SALT_POS].salt_buf[ 8];
salt_buf2[1] = salt_bufs[SALT_POS].salt_buf[ 9];
salt_buf2[2] = salt_bufs[SALT_POS].salt_buf[10];
salt_buf2[3] = salt_bufs[SALT_POS].salt_buf[11];
salt_buf3[0] = salt_bufs[SALT_POS].salt_buf[12];
salt_buf3[1] = salt_bufs[SALT_POS].salt_buf[13];
salt_buf3[2] = salt_bufs[SALT_POS].salt_buf[14];
salt_buf3[3] = salt_bufs[SALT_POS].salt_buf[15];
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
/**
* digest
@ -278,10 +278,10 @@ KERNEL_FQ void m00050_s04 (KERN_ATTR_RULES ())
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**

View File

@ -33,13 +33,13 @@ KERNEL_FQ void m00050_mxx (KERN_ATTR_RULES ())
COPY_PW (pws[gid]);
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
u32 s[64] = { 0 };
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
s[idx] = salt_bufs[SALT_POS].salt_buf[idx];
}
/**
@ -86,10 +86,10 @@ KERNEL_FQ void m00050_sxx (KERN_ATTR_RULES ())
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**
@ -98,13 +98,13 @@ KERNEL_FQ void m00050_sxx (KERN_ATTR_RULES ())
COPY_PW (pws[gid]);
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
u32 s[64] = { 0 };
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
s[idx] = salt_bufs[SALT_POS].salt_buf[idx];
}
/**

View File

@ -138,24 +138,24 @@ KERNEL_FQ void m00050_m04 (KERN_ATTR_BASIC ())
u32 salt_buf2[4];
u32 salt_buf3[4];
salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
salt_buf0[0] = salt_bufs[SALT_POS].salt_buf[ 0];
salt_buf0[1] = salt_bufs[SALT_POS].salt_buf[ 1];
salt_buf0[2] = salt_bufs[SALT_POS].salt_buf[ 2];
salt_buf0[3] = salt_bufs[SALT_POS].salt_buf[ 3];
salt_buf1[0] = salt_bufs[SALT_POS].salt_buf[ 4];
salt_buf1[1] = salt_bufs[SALT_POS].salt_buf[ 5];
salt_buf1[2] = salt_bufs[SALT_POS].salt_buf[ 6];
salt_buf1[3] = salt_bufs[SALT_POS].salt_buf[ 7];
salt_buf2[0] = salt_bufs[SALT_POS].salt_buf[ 8];
salt_buf2[1] = salt_bufs[SALT_POS].salt_buf[ 9];
salt_buf2[2] = salt_bufs[SALT_POS].salt_buf[10];
salt_buf2[3] = salt_bufs[SALT_POS].salt_buf[11];
salt_buf3[0] = salt_bufs[SALT_POS].salt_buf[12];
salt_buf3[1] = salt_bufs[SALT_POS].salt_buf[13];
salt_buf3[2] = salt_bufs[SALT_POS].salt_buf[14];
salt_buf3[3] = salt_bufs[SALT_POS].salt_buf[15];
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
/**
* loop
@ -311,24 +311,24 @@ KERNEL_FQ void m00050_s04 (KERN_ATTR_BASIC ())
u32 salt_buf2[4];
u32 salt_buf3[4];
salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
salt_buf0[0] = salt_bufs[SALT_POS].salt_buf[ 0];
salt_buf0[1] = salt_bufs[SALT_POS].salt_buf[ 1];
salt_buf0[2] = salt_bufs[SALT_POS].salt_buf[ 2];
salt_buf0[3] = salt_bufs[SALT_POS].salt_buf[ 3];
salt_buf1[0] = salt_bufs[SALT_POS].salt_buf[ 4];
salt_buf1[1] = salt_bufs[SALT_POS].salt_buf[ 5];
salt_buf1[2] = salt_bufs[SALT_POS].salt_buf[ 6];
salt_buf1[3] = salt_bufs[SALT_POS].salt_buf[ 7];
salt_buf2[0] = salt_bufs[SALT_POS].salt_buf[ 8];
salt_buf2[1] = salt_bufs[SALT_POS].salt_buf[ 9];
salt_buf2[2] = salt_bufs[SALT_POS].salt_buf[10];
salt_buf2[3] = salt_bufs[SALT_POS].salt_buf[11];
salt_buf3[0] = salt_bufs[SALT_POS].salt_buf[12];
salt_buf3[1] = salt_bufs[SALT_POS].salt_buf[13];
salt_buf3[2] = salt_bufs[SALT_POS].salt_buf[14];
salt_buf3[3] = salt_bufs[SALT_POS].salt_buf[15];
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
/**
* digest
@ -336,10 +336,10 @@ KERNEL_FQ void m00050_s04 (KERN_ATTR_BASIC ())
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**

View File

@ -38,13 +38,13 @@ KERNEL_FQ void m00050_mxx (KERN_ATTR_BASIC ())
w[idx] = pws[gid].i[idx];
}
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
u32 s[64] = { 0 };
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
s[idx] = salt_bufs[SALT_POS].salt_buf[idx];
}
/**
@ -109,10 +109,10 @@ KERNEL_FQ void m00050_sxx (KERN_ATTR_BASIC ())
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**
@ -128,13 +128,13 @@ KERNEL_FQ void m00050_sxx (KERN_ATTR_BASIC ())
w[idx] = pws[gid].i[idx];
}
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
u32 s[64] = { 0 };
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
s[idx] = salt_bufs[SALT_POS].salt_buf[idx];
}
/**

View File

@ -117,24 +117,24 @@ DECLSPEC void m00050m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KER
u32 salt_buf2[4];
u32 salt_buf3[4];
salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
salt_buf0[0] = salt_bufs[SALT_POS].salt_buf[ 0];
salt_buf0[1] = salt_bufs[SALT_POS].salt_buf[ 1];
salt_buf0[2] = salt_bufs[SALT_POS].salt_buf[ 2];
salt_buf0[3] = salt_bufs[SALT_POS].salt_buf[ 3];
salt_buf1[0] = salt_bufs[SALT_POS].salt_buf[ 4];
salt_buf1[1] = salt_bufs[SALT_POS].salt_buf[ 5];
salt_buf1[2] = salt_bufs[SALT_POS].salt_buf[ 6];
salt_buf1[3] = salt_bufs[SALT_POS].salt_buf[ 7];
salt_buf2[0] = salt_bufs[SALT_POS].salt_buf[ 8];
salt_buf2[1] = salt_bufs[SALT_POS].salt_buf[ 9];
salt_buf2[2] = salt_bufs[SALT_POS].salt_buf[10];
salt_buf2[3] = salt_bufs[SALT_POS].salt_buf[11];
salt_buf3[0] = salt_bufs[SALT_POS].salt_buf[12];
salt_buf3[1] = salt_bufs[SALT_POS].salt_buf[13];
salt_buf3[2] = salt_bufs[SALT_POS].salt_buf[14];
salt_buf3[3] = salt_bufs[SALT_POS].salt_buf[15];
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
/**
* loop
@ -222,24 +222,24 @@ DECLSPEC void m00050s (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KER
u32 salt_buf2[4];
u32 salt_buf3[4];
salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
salt_buf0[0] = salt_bufs[SALT_POS].salt_buf[ 0];
salt_buf0[1] = salt_bufs[SALT_POS].salt_buf[ 1];
salt_buf0[2] = salt_bufs[SALT_POS].salt_buf[ 2];
salt_buf0[3] = salt_bufs[SALT_POS].salt_buf[ 3];
salt_buf1[0] = salt_bufs[SALT_POS].salt_buf[ 4];
salt_buf1[1] = salt_bufs[SALT_POS].salt_buf[ 5];
salt_buf1[2] = salt_bufs[SALT_POS].salt_buf[ 6];
salt_buf1[3] = salt_bufs[SALT_POS].salt_buf[ 7];
salt_buf2[0] = salt_bufs[SALT_POS].salt_buf[ 8];
salt_buf2[1] = salt_bufs[SALT_POS].salt_buf[ 9];
salt_buf2[2] = salt_bufs[SALT_POS].salt_buf[10];
salt_buf2[3] = salt_bufs[SALT_POS].salt_buf[11];
salt_buf3[0] = salt_bufs[SALT_POS].salt_buf[12];
salt_buf3[1] = salt_bufs[SALT_POS].salt_buf[13];
salt_buf3[2] = salt_bufs[SALT_POS].salt_buf[14];
salt_buf3[3] = salt_bufs[SALT_POS].salt_buf[15];
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
/**
* digest
@ -247,10 +247,10 @@ DECLSPEC void m00050s (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KER
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**
@ -365,7 +365,7 @@ KERNEL_FQ void m00050_m04 (KERN_ATTR_BASIC ())
* main
*/
m00050m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max);
m00050m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}
KERNEL_FQ void m00050_m08 (KERN_ATTR_BASIC ())
@ -412,7 +412,7 @@ KERNEL_FQ void m00050_m08 (KERN_ATTR_BASIC ())
* main
*/
m00050m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max);
m00050m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}
KERNEL_FQ void m00050_m16 (KERN_ATTR_BASIC ())
@ -459,7 +459,7 @@ KERNEL_FQ void m00050_m16 (KERN_ATTR_BASIC ())
* main
*/
m00050m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max);
m00050m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}
KERNEL_FQ void m00050_s04 (KERN_ATTR_BASIC ())
@ -506,7 +506,7 @@ KERNEL_FQ void m00050_s04 (KERN_ATTR_BASIC ())
* main
*/
m00050s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max);
m00050s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}
KERNEL_FQ void m00050_s08 (KERN_ATTR_BASIC ())
@ -553,7 +553,7 @@ KERNEL_FQ void m00050_s08 (KERN_ATTR_BASIC ())
* main
*/
m00050s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max);
m00050s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}
KERNEL_FQ void m00050_s16 (KERN_ATTR_BASIC ())
@ -600,5 +600,5 @@ KERNEL_FQ void m00050_s16 (KERN_ATTR_BASIC ())
* main
*/
m00050s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max);
m00050s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}

View File

@ -38,13 +38,13 @@ KERNEL_FQ void m00050_mxx (KERN_ATTR_VECTOR ())
w[idx] = pws[gid].i[idx];
}
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
u32x s[64] = { 0 };
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
s[idx] = salt_bufs[SALT_POS].salt_buf[idx];
}
/**
@ -95,10 +95,10 @@ KERNEL_FQ void m00050_sxx (KERN_ATTR_VECTOR ())
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**
@ -114,13 +114,13 @@ KERNEL_FQ void m00050_sxx (KERN_ATTR_VECTOR ())
w[idx] = pws[gid].i[idx];
}
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
u32x s[64] = { 0 };
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
s[idx] = salt_bufs[SALT_POS].salt_buf[idx];
}
/**

View File

@ -140,22 +140,22 @@ KERNEL_FQ void m00060_m04 (KERN_ATTR_RULES ())
u32 salt_buf2[4];
u32 salt_buf3[4];
salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
salt_buf0[0] = salt_bufs[SALT_POS].salt_buf[ 0];
salt_buf0[1] = salt_bufs[SALT_POS].salt_buf[ 1];
salt_buf0[2] = salt_bufs[SALT_POS].salt_buf[ 2];
salt_buf0[3] = salt_bufs[SALT_POS].salt_buf[ 3];
salt_buf1[0] = salt_bufs[SALT_POS].salt_buf[ 4];
salt_buf1[1] = salt_bufs[SALT_POS].salt_buf[ 5];
salt_buf1[2] = salt_bufs[SALT_POS].salt_buf[ 6];
salt_buf1[3] = salt_bufs[SALT_POS].salt_buf[ 7];
salt_buf2[0] = salt_bufs[SALT_POS].salt_buf[ 8];
salt_buf2[1] = salt_bufs[SALT_POS].salt_buf[ 9];
salt_buf2[2] = salt_bufs[SALT_POS].salt_buf[10];
salt_buf2[3] = salt_bufs[SALT_POS].salt_buf[11];
salt_buf3[0] = salt_bufs[SALT_POS].salt_buf[12];
salt_buf3[1] = salt_bufs[SALT_POS].salt_buf[13];
salt_buf3[2] = salt_bufs[SALT_POS].salt_buf[14];
salt_buf3[3] = salt_bufs[SALT_POS].salt_buf[15];
/**
* pads
@ -275,22 +275,22 @@ KERNEL_FQ void m00060_s04 (KERN_ATTR_RULES ())
u32 salt_buf2[4];
u32 salt_buf3[4];
salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
salt_buf0[0] = salt_bufs[SALT_POS].salt_buf[ 0];
salt_buf0[1] = salt_bufs[SALT_POS].salt_buf[ 1];
salt_buf0[2] = salt_bufs[SALT_POS].salt_buf[ 2];
salt_buf0[3] = salt_bufs[SALT_POS].salt_buf[ 3];
salt_buf1[0] = salt_bufs[SALT_POS].salt_buf[ 4];
salt_buf1[1] = salt_bufs[SALT_POS].salt_buf[ 5];
salt_buf1[2] = salt_bufs[SALT_POS].salt_buf[ 6];
salt_buf1[3] = salt_bufs[SALT_POS].salt_buf[ 7];
salt_buf2[0] = salt_bufs[SALT_POS].salt_buf[ 8];
salt_buf2[1] = salt_bufs[SALT_POS].salt_buf[ 9];
salt_buf2[2] = salt_bufs[SALT_POS].salt_buf[10];
salt_buf2[3] = salt_bufs[SALT_POS].salt_buf[11];
salt_buf3[0] = salt_bufs[SALT_POS].salt_buf[12];
salt_buf3[1] = salt_bufs[SALT_POS].salt_buf[13];
salt_buf3[2] = salt_bufs[SALT_POS].salt_buf[14];
salt_buf3[3] = salt_bufs[SALT_POS].salt_buf[15];
/**
* pads
@ -329,10 +329,10 @@ KERNEL_FQ void m00060_s04 (KERN_ATTR_RULES ())
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**

View File

@ -33,13 +33,13 @@ KERNEL_FQ void m00060_mxx (KERN_ATTR_RULES ())
COPY_PW (pws[gid]);
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
u32 s[64] = { 0 };
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
s[idx] = salt_bufs[SALT_POS].salt_buf[idx];
}
md5_hmac_ctx_t ctx0;
@ -88,10 +88,10 @@ KERNEL_FQ void m00060_sxx (KERN_ATTR_RULES ())
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**
@ -100,13 +100,13 @@ KERNEL_FQ void m00060_sxx (KERN_ATTR_RULES ())
COPY_PW (pws[gid]);
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
u32 s[64] = { 0 };
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
s[idx] = salt_bufs[SALT_POS].salt_buf[idx];
}
md5_hmac_ctx_t ctx0;

View File

@ -138,22 +138,22 @@ KERNEL_FQ void m00060_m04 (KERN_ATTR_BASIC ())
u32 salt_buf2[4];
u32 salt_buf3[4];
salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
salt_buf0[0] = salt_bufs[SALT_POS].salt_buf[ 0];
salt_buf0[1] = salt_bufs[SALT_POS].salt_buf[ 1];
salt_buf0[2] = salt_bufs[SALT_POS].salt_buf[ 2];
salt_buf0[3] = salt_bufs[SALT_POS].salt_buf[ 3];
salt_buf1[0] = salt_bufs[SALT_POS].salt_buf[ 4];
salt_buf1[1] = salt_bufs[SALT_POS].salt_buf[ 5];
salt_buf1[2] = salt_bufs[SALT_POS].salt_buf[ 6];
salt_buf1[3] = salt_bufs[SALT_POS].salt_buf[ 7];
salt_buf2[0] = salt_bufs[SALT_POS].salt_buf[ 8];
salt_buf2[1] = salt_bufs[SALT_POS].salt_buf[ 9];
salt_buf2[2] = salt_bufs[SALT_POS].salt_buf[10];
salt_buf2[3] = salt_bufs[SALT_POS].salt_buf[11];
salt_buf3[0] = salt_bufs[SALT_POS].salt_buf[12];
salt_buf3[1] = salt_bufs[SALT_POS].salt_buf[13];
salt_buf3[2] = salt_bufs[SALT_POS].salt_buf[14];
salt_buf3[3] = salt_bufs[SALT_POS].salt_buf[15];
/**
* pads
@ -314,22 +314,22 @@ KERNEL_FQ void m00060_s04 (KERN_ATTR_BASIC ())
u32 salt_buf2[4];
u32 salt_buf3[4];
salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
salt_buf0[0] = salt_bufs[SALT_POS].salt_buf[ 0];
salt_buf0[1] = salt_bufs[SALT_POS].salt_buf[ 1];
salt_buf0[2] = salt_bufs[SALT_POS].salt_buf[ 2];
salt_buf0[3] = salt_bufs[SALT_POS].salt_buf[ 3];
salt_buf1[0] = salt_bufs[SALT_POS].salt_buf[ 4];
salt_buf1[1] = salt_bufs[SALT_POS].salt_buf[ 5];
salt_buf1[2] = salt_bufs[SALT_POS].salt_buf[ 6];
salt_buf1[3] = salt_bufs[SALT_POS].salt_buf[ 7];
salt_buf2[0] = salt_bufs[SALT_POS].salt_buf[ 8];
salt_buf2[1] = salt_bufs[SALT_POS].salt_buf[ 9];
salt_buf2[2] = salt_bufs[SALT_POS].salt_buf[10];
salt_buf2[3] = salt_bufs[SALT_POS].salt_buf[11];
salt_buf3[0] = salt_bufs[SALT_POS].salt_buf[12];
salt_buf3[1] = salt_bufs[SALT_POS].salt_buf[13];
salt_buf3[2] = salt_bufs[SALT_POS].salt_buf[14];
salt_buf3[3] = salt_bufs[SALT_POS].salt_buf[15];
/**
* pads
@ -368,10 +368,10 @@ KERNEL_FQ void m00060_s04 (KERN_ATTR_BASIC ())
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**

View File

@ -38,13 +38,13 @@ KERNEL_FQ void m00060_mxx (KERN_ATTR_BASIC ())
w[idx] = pws[gid].i[idx];
}
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
u32 s[64] = { 0 };
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
s[idx] = salt_bufs[SALT_POS].salt_buf[idx];
}
md5_hmac_ctx_t ctx0;
@ -111,10 +111,10 @@ KERNEL_FQ void m00060_sxx (KERN_ATTR_BASIC ())
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**
@ -130,13 +130,13 @@ KERNEL_FQ void m00060_sxx (KERN_ATTR_BASIC ())
w[idx] = pws[gid].i[idx];
}
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
u32 s[64] = { 0 };
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
s[idx] = salt_bufs[SALT_POS].salt_buf[idx];
}
md5_hmac_ctx_t ctx0;

View File

@ -117,22 +117,22 @@ DECLSPEC void m00060m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KER
u32 salt_buf2[4];
u32 salt_buf3[4];
salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
salt_buf0[0] = salt_bufs[SALT_POS].salt_buf[ 0];
salt_buf0[1] = salt_bufs[SALT_POS].salt_buf[ 1];
salt_buf0[2] = salt_bufs[SALT_POS].salt_buf[ 2];
salt_buf0[3] = salt_bufs[SALT_POS].salt_buf[ 3];
salt_buf1[0] = salt_bufs[SALT_POS].salt_buf[ 4];
salt_buf1[1] = salt_bufs[SALT_POS].salt_buf[ 5];
salt_buf1[2] = salt_bufs[SALT_POS].salt_buf[ 6];
salt_buf1[3] = salt_bufs[SALT_POS].salt_buf[ 7];
salt_buf2[0] = salt_bufs[SALT_POS].salt_buf[ 8];
salt_buf2[1] = salt_bufs[SALT_POS].salt_buf[ 9];
salt_buf2[2] = salt_bufs[SALT_POS].salt_buf[10];
salt_buf2[3] = salt_bufs[SALT_POS].salt_buf[11];
salt_buf3[0] = salt_bufs[SALT_POS].salt_buf[12];
salt_buf3[1] = salt_bufs[SALT_POS].salt_buf[13];
salt_buf3[2] = salt_bufs[SALT_POS].salt_buf[14];
salt_buf3[3] = salt_bufs[SALT_POS].salt_buf[15];
/**
* pads
@ -220,22 +220,22 @@ DECLSPEC void m00060s (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KER
u32 salt_buf2[4];
u32 salt_buf3[4];
salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
salt_buf0[0] = salt_bufs[SALT_POS].salt_buf[ 0];
salt_buf0[1] = salt_bufs[SALT_POS].salt_buf[ 1];
salt_buf0[2] = salt_bufs[SALT_POS].salt_buf[ 2];
salt_buf0[3] = salt_bufs[SALT_POS].salt_buf[ 3];
salt_buf1[0] = salt_bufs[SALT_POS].salt_buf[ 4];
salt_buf1[1] = salt_bufs[SALT_POS].salt_buf[ 5];
salt_buf1[2] = salt_bufs[SALT_POS].salt_buf[ 6];
salt_buf1[3] = salt_bufs[SALT_POS].salt_buf[ 7];
salt_buf2[0] = salt_bufs[SALT_POS].salt_buf[ 8];
salt_buf2[1] = salt_bufs[SALT_POS].salt_buf[ 9];
salt_buf2[2] = salt_bufs[SALT_POS].salt_buf[10];
salt_buf2[3] = salt_bufs[SALT_POS].salt_buf[11];
salt_buf3[0] = salt_bufs[SALT_POS].salt_buf[12];
salt_buf3[1] = salt_bufs[SALT_POS].salt_buf[13];
salt_buf3[2] = salt_bufs[SALT_POS].salt_buf[14];
salt_buf3[3] = salt_bufs[SALT_POS].salt_buf[15];
/**
* pads
@ -274,10 +274,10 @@ DECLSPEC void m00060s (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KER
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**
@ -361,7 +361,7 @@ KERNEL_FQ void m00060_m04 (KERN_ATTR_BASIC ())
* main
*/
m00060m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max);
m00060m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}
KERNEL_FQ void m00060_m08 (KERN_ATTR_BASIC ())
@ -408,7 +408,7 @@ KERNEL_FQ void m00060_m08 (KERN_ATTR_BASIC ())
* main
*/
m00060m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max);
m00060m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}
KERNEL_FQ void m00060_m16 (KERN_ATTR_BASIC ())
@ -455,7 +455,7 @@ KERNEL_FQ void m00060_m16 (KERN_ATTR_BASIC ())
* main
*/
m00060m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max);
m00060m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}
KERNEL_FQ void m00060_s04 (KERN_ATTR_BASIC ())
@ -502,7 +502,7 @@ KERNEL_FQ void m00060_s04 (KERN_ATTR_BASIC ())
* main
*/
m00060s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max);
m00060s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}
KERNEL_FQ void m00060_s08 (KERN_ATTR_BASIC ())
@ -549,7 +549,7 @@ KERNEL_FQ void m00060_s08 (KERN_ATTR_BASIC ())
* main
*/
m00060s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max);
m00060s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}
KERNEL_FQ void m00060_s16 (KERN_ATTR_BASIC ())
@ -596,5 +596,5 @@ KERNEL_FQ void m00060_s16 (KERN_ATTR_BASIC ())
* main
*/
m00060s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max);
m00060s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}

View File

@ -38,13 +38,13 @@ KERNEL_FQ void m00060_mxx (KERN_ATTR_VECTOR ())
w[idx] = pws[gid].i[idx];
}
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
u32x s[64] = { 0 };
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
s[idx] = salt_bufs[SALT_POS].salt_buf[idx];
}
md5_hmac_ctx_vector_t ctx0;
@ -97,10 +97,10 @@ KERNEL_FQ void m00060_sxx (KERN_ATTR_VECTOR ())
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**
@ -116,13 +116,13 @@ KERNEL_FQ void m00060_sxx (KERN_ATTR_VECTOR ())
w[idx] = pws[gid].i[idx];
}
const u32 salt_len = salt_bufs[salt_pos].salt_len;
const u32 salt_len = salt_bufs[SALT_POS].salt_len;
u32x s[64] = { 0 };
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
s[idx] = salt_bufs[SALT_POS].salt_buf[idx];
}
md5_hmac_ctx_vector_t ctx0;

View File

@ -0,0 +1,320 @@
/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
#define NEW_SIMD_CODE
#ifdef KERNEL_STATIC
#include "inc_vendor.h"
#include "inc_types.h"
#include "inc_platform.cl"
#include "inc_common.cl"
#include "inc_rp_optimized.h"
#include "inc_rp_optimized.cl"
#include "inc_simd.cl"
#include "inc_hash_md5.cl"
#endif
KERNEL_FQ void m00070_m04 (KERN_ATTR_RULES ())
{
/**
* modifier
*/
const u64 lid = get_local_id (0);
/**
* base
*/
const u64 gid = get_global_id (0);
if (gid >= gid_max) return;
u32 pw_buf0[4];
u32 pw_buf1[4];
pw_buf0[0] = pws[gid].i[0];
pw_buf0[1] = pws[gid].i[1];
pw_buf0[2] = pws[gid].i[2];
pw_buf0[3] = pws[gid].i[3];
pw_buf1[0] = pws[gid].i[4];
pw_buf1[1] = pws[gid].i[5];
pw_buf1[2] = pws[gid].i[6];
pw_buf1[3] = pws[gid].i[7];
const u32 pw_len = pws[gid].pw_len & 63;
/**
* loop
*/
for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
{
u32x w0[4] = { 0 };
u32x w1[4] = { 0 };
u32x w2[4] = { 0 };
u32x w3[4] = { 0 };
const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
make_utf16le (w1, w2, w3);
make_utf16le (w0, w0, w1);
const u32x out_len2 = out_len * 2;
append_0x80_4x4_VV (w0, w1, w2, w3, out_len2);
w3[2] = out_len2 * 8;
w3[3] = 0;
/**
* md5
*/
u32x a = MD5M_A;
u32x b = MD5M_B;
u32x c = MD5M_C;
u32x d = MD5M_D;
MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
u32x t;
MD5_STEP (MD5_H1, a, b, c, d, w1[1], MD5C20, MD5S20);
MD5_STEP (MD5_H2, d, a, b, c, w2[0], MD5C21, MD5S21);
MD5_STEP (MD5_H1, c, d, a, b, w2[3], MD5C22, MD5S22);
MD5_STEP (MD5_H2, b, c, d, a, w3[2], MD5C23, MD5S23);
MD5_STEP (MD5_H1, a, b, c, d, w0[1], MD5C24, MD5S20);
MD5_STEP (MD5_H2, d, a, b, c, w1[0], MD5C25, MD5S21);
MD5_STEP (MD5_H1, c, d, a, b, w1[3], MD5C26, MD5S22);
MD5_STEP (MD5_H2, b, c, d, a, w2[2], MD5C27, MD5S23);
MD5_STEP (MD5_H1, a, b, c, d, w3[1], MD5C28, MD5S20);
MD5_STEP (MD5_H2, d, a, b, c, w0[0], MD5C29, MD5S21);
MD5_STEP (MD5_H1, c, d, a, b, w0[3], MD5C2a, MD5S22);
MD5_STEP (MD5_H2, b, c, d, a, w1[2], MD5C2b, MD5S23);
MD5_STEP (MD5_H1, a, b, c, d, w2[1], MD5C2c, MD5S20);
MD5_STEP (MD5_H2, d, a, b, c, w3[0], MD5C2d, MD5S21);
MD5_STEP (MD5_H1, c, d, a, b, w3[3], MD5C2e, MD5S22);
MD5_STEP (MD5_H2, b, c, d, a, w0[2], MD5C2f, MD5S23);
MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
COMPARE_M_SIMD (a, d, c, b);
}
}
KERNEL_FQ void m00070_m08 (KERN_ATTR_RULES ())
{
}
KERNEL_FQ void m00070_m16 (KERN_ATTR_RULES ())
{
}
KERNEL_FQ void m00070_s04 (KERN_ATTR_RULES ())
{
/**
* modifier
*/
const u64 lid = get_local_id (0);
/**
* base
*/
const u64 gid = get_global_id (0);
if (gid >= gid_max) return;
u32 pw_buf0[4];
u32 pw_buf1[4];
pw_buf0[0] = pws[gid].i[0];
pw_buf0[1] = pws[gid].i[1];
pw_buf0[2] = pws[gid].i[2];
pw_buf0[3] = pws[gid].i[3];
pw_buf1[0] = pws[gid].i[4];
pw_buf1[1] = pws[gid].i[5];
pw_buf1[2] = pws[gid].i[6];
pw_buf1[3] = pws[gid].i[7];
const u32 pw_len = pws[gid].pw_len & 63;
/**
* digest
*/
const u32 search[4] =
{
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**
* loop
*/
for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
{
u32x w0[4] = { 0 };
u32x w1[4] = { 0 };
u32x w2[4] = { 0 };
u32x w3[4] = { 0 };
const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
make_utf16le (w1, w2, w3);
make_utf16le (w0, w0, w1);
const u32x out_len2 = out_len * 2;
append_0x80_4x4_VV (w0, w1, w2, w3, out_len2);
w3[2] = out_len2 * 8;
w3[3] = 0;
/**
* md5
*/
u32x a = MD5M_A;
u32x b = MD5M_B;
u32x c = MD5M_C;
u32x d = MD5M_D;
MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
u32x t;
MD5_STEP (MD5_H1, a, b, c, d, w1[1], MD5C20, MD5S20);
MD5_STEP (MD5_H2, d, a, b, c, w2[0], MD5C21, MD5S21);
MD5_STEP (MD5_H1, c, d, a, b, w2[3], MD5C22, MD5S22);
MD5_STEP (MD5_H2, b, c, d, a, w3[2], MD5C23, MD5S23);
MD5_STEP (MD5_H1, a, b, c, d, w0[1], MD5C24, MD5S20);
MD5_STEP (MD5_H2, d, a, b, c, w1[0], MD5C25, MD5S21);
MD5_STEP (MD5_H1, c, d, a, b, w1[3], MD5C26, MD5S22);
MD5_STEP (MD5_H2, b, c, d, a, w2[2], MD5C27, MD5S23);
MD5_STEP (MD5_H1, a, b, c, d, w3[1], MD5C28, MD5S20);
MD5_STEP (MD5_H2, d, a, b, c, w0[0], MD5C29, MD5S21);
MD5_STEP (MD5_H1, c, d, a, b, w0[3], MD5C2a, MD5S22);
MD5_STEP (MD5_H2, b, c, d, a, w1[2], MD5C2b, MD5S23);
MD5_STEP (MD5_H1, a, b, c, d, w2[1], MD5C2c, MD5S20);
MD5_STEP (MD5_H2, d, a, b, c, w3[0], MD5C2d, MD5S21);
MD5_STEP (MD5_H1, c, d, a, b, w3[3], MD5C2e, MD5S22);
MD5_STEP (MD5_H2, b, c, d, a, w0[2], MD5C2f, MD5S23);
MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
if (MATCHES_NONE_VS (a, search[0])) continue;
MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
COMPARE_S_SIMD (a, d, c, b);
}
}
KERNEL_FQ void m00070_s08 (KERN_ATTR_RULES ())
{
}
KERNEL_FQ void m00070_s16 (KERN_ATTR_RULES ())
{
}

117
OpenCL/m00070_a0-pure.cl Normal file
View File

@ -0,0 +1,117 @@
/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
//#define NEW_SIMD_CODE
#ifdef KERNEL_STATIC
#include "inc_vendor.h"
#include "inc_types.h"
#include "inc_platform.cl"
#include "inc_common.cl"
#include "inc_rp.h"
#include "inc_rp.cl"
#include "inc_scalar.cl"
#include "inc_hash_md5.cl"
#endif
KERNEL_FQ void m00070_mxx (KERN_ATTR_RULES ())
{
/**
* modifier
*/
const u64 lid = get_local_id (0);
const u64 gid = get_global_id (0);
if (gid >= gid_max) return;
/**
* base
*/
COPY_PW (pws[gid]);
/**
* loop
*/
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
{
pw_t tmp = PASTE_PW;
tmp.pw_len = apply_rules (rules_buf[il_pos].cmds, tmp.i, tmp.pw_len);
md5_ctx_t ctx;
md5_init (&ctx);
md5_update_utf16le (&ctx, tmp.i, tmp.pw_len);
md5_final (&ctx);
const u32 r0 = ctx.h[DGST_R0];
const u32 r1 = ctx.h[DGST_R1];
const u32 r2 = ctx.h[DGST_R2];
const u32 r3 = ctx.h[DGST_R3];
COMPARE_M_SCALAR (r0, r1, r2, r3);
}
}
KERNEL_FQ void m00070_sxx (KERN_ATTR_RULES ())
{
/**
* modifier
*/
const u64 lid = get_local_id (0);
const u64 gid = get_global_id (0);
if (gid >= gid_max) return;
/**
* digest
*/
const u32 search[4] =
{
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**
* base
*/
COPY_PW (pws[gid]);
/**
* loop
*/
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
{
pw_t tmp = PASTE_PW;
tmp.pw_len = apply_rules (rules_buf[il_pos].cmds, tmp.i, tmp.pw_len);
md5_ctx_t ctx;
md5_init (&ctx);
md5_update_utf16le (&ctx, tmp.i, tmp.pw_len);
md5_final (&ctx);
const u32 r0 = ctx.h[DGST_R0];
const u32 r1 = ctx.h[DGST_R1];
const u32 r2 = ctx.h[DGST_R2];
const u32 r3 = ctx.h[DGST_R3];
COMPARE_S_SCALAR (r0, r1, r2, r3);
}
}

View File

@ -0,0 +1,438 @@
/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
#define NEW_SIMD_CODE
#ifdef KERNEL_STATIC
#include "inc_vendor.h"
#include "inc_types.h"
#include "inc_platform.cl"
#include "inc_common.cl"
#include "inc_simd.cl"
#include "inc_hash_md5.cl"
#endif
KERNEL_FQ void m00070_m04 (KERN_ATTR_BASIC ())
{
/**
* modifier
*/
const u64 lid = get_local_id (0);
/**
* base
*/
const u64 gid = get_global_id (0);
if (gid >= gid_max) return;
u32 pw_buf0[4];
u32 pw_buf1[4];
pw_buf0[0] = pws[gid].i[0];
pw_buf0[1] = pws[gid].i[1];
pw_buf0[2] = pws[gid].i[2];
pw_buf0[3] = pws[gid].i[3];
pw_buf1[0] = pws[gid].i[4];
pw_buf1[1] = pws[gid].i[5];
pw_buf1[2] = pws[gid].i[6];
pw_buf1[3] = pws[gid].i[7];
const u32 pw_l_len = pws[gid].pw_len & 63;
/**
* loop
*/
for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
{
const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos) & 63;
const u32x pw_len = (pw_l_len + pw_r_len) & 63;
/**
* concat password candidate
*/
u32x wordl0[4] = { 0 };
u32x wordl1[4] = { 0 };
u32x wordl2[4] = { 0 };
u32x wordl3[4] = { 0 };
wordl0[0] = pw_buf0[0];
wordl0[1] = pw_buf0[1];
wordl0[2] = pw_buf0[2];
wordl0[3] = pw_buf0[3];
wordl1[0] = pw_buf1[0];
wordl1[1] = pw_buf1[1];
wordl1[2] = pw_buf1[2];
wordl1[3] = pw_buf1[3];
u32x wordr0[4] = { 0 };
u32x wordr1[4] = { 0 };
u32x wordr2[4] = { 0 };
u32x wordr3[4] = { 0 };
wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
{
switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len);
}
else
{
switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len);
}
u32x w0[4];
u32x w1[4];
u32x w2[4];
u32x w3[4];
w0[0] = wordl0[0] | wordr0[0];
w0[1] = wordl0[1] | wordr0[1];
w0[2] = wordl0[2] | wordr0[2];
w0[3] = wordl0[3] | wordr0[3];
w1[0] = wordl1[0] | wordr1[0];
w1[1] = wordl1[1] | wordr1[1];
w1[2] = wordl1[2] | wordr1[2];
w1[3] = wordl1[3] | wordr1[3];
w2[0] = wordl2[0] | wordr2[0];
w2[1] = wordl2[1] | wordr2[1];
w2[2] = wordl2[2] | wordr2[2];
w2[3] = wordl2[3] | wordr2[3];
w3[0] = wordl3[0] | wordr3[0];
w3[1] = wordl3[1] | wordr3[1];
w3[2] = wordl3[2] | wordr3[2];
w3[3] = wordl3[3] | wordr3[3];
make_utf16le (w1, w2, w3);
make_utf16le (w0, w0, w1);
const u32x pw_len2 = pw_len * 2;
append_0x80_4x4_VV (w0, w1, w2, w3, pw_len2);
w3[2] = pw_len2 * 8;
w3[3] = 0;
/**
* md5
*/
u32x a = MD5M_A;
u32x b = MD5M_B;
u32x c = MD5M_C;
u32x d = MD5M_D;
MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
u32x t;
MD5_STEP (MD5_H1, a, b, c, d, w1[1], MD5C20, MD5S20);
MD5_STEP (MD5_H2, d, a, b, c, w2[0], MD5C21, MD5S21);
MD5_STEP (MD5_H1, c, d, a, b, w2[3], MD5C22, MD5S22);
MD5_STEP (MD5_H2, b, c, d, a, w3[2], MD5C23, MD5S23);
MD5_STEP (MD5_H1, a, b, c, d, w0[1], MD5C24, MD5S20);
MD5_STEP (MD5_H2, d, a, b, c, w1[0], MD5C25, MD5S21);
MD5_STEP (MD5_H1, c, d, a, b, w1[3], MD5C26, MD5S22);
MD5_STEP (MD5_H2, b, c, d, a, w2[2], MD5C27, MD5S23);
MD5_STEP (MD5_H1, a, b, c, d, w3[1], MD5C28, MD5S20);
MD5_STEP (MD5_H2, d, a, b, c, w0[0], MD5C29, MD5S21);
MD5_STEP (MD5_H1, c, d, a, b, w0[3], MD5C2a, MD5S22);
MD5_STEP (MD5_H2, b, c, d, a, w1[2], MD5C2b, MD5S23);
MD5_STEP (MD5_H1, a, b, c, d, w2[1], MD5C2c, MD5S20);
MD5_STEP (MD5_H2, d, a, b, c, w3[0], MD5C2d, MD5S21);
MD5_STEP (MD5_H1, c, d, a, b, w3[3], MD5C2e, MD5S22);
MD5_STEP (MD5_H2, b, c, d, a, w0[2], MD5C2f, MD5S23);
MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
COMPARE_M_SIMD (a, d, c, b);
}
}
KERNEL_FQ void m00070_m08 (KERN_ATTR_BASIC ())
{
}
KERNEL_FQ void m00070_m16 (KERN_ATTR_BASIC ())
{
}
KERNEL_FQ void m00070_s04 (KERN_ATTR_BASIC ())
{
/**
* modifier
*/
const u64 lid = get_local_id (0);
/**
* base
*/
const u64 gid = get_global_id (0);
if (gid >= gid_max) return;
u32 pw_buf0[4];
u32 pw_buf1[4];
pw_buf0[0] = pws[gid].i[0];
pw_buf0[1] = pws[gid].i[1];
pw_buf0[2] = pws[gid].i[2];
pw_buf0[3] = pws[gid].i[3];
pw_buf1[0] = pws[gid].i[4];
pw_buf1[1] = pws[gid].i[5];
pw_buf1[2] = pws[gid].i[6];
pw_buf1[3] = pws[gid].i[7];
const u32 pw_l_len = pws[gid].pw_len & 63;
/**
* digest
*/
const u32 search[4] =
{
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**
* loop
*/
for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
{
const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos) & 63;
const u32x pw_len = (pw_l_len + pw_r_len) & 63;
/**
* concat password candidate
*/
u32x wordl0[4] = { 0 };
u32x wordl1[4] = { 0 };
u32x wordl2[4] = { 0 };
u32x wordl3[4] = { 0 };
wordl0[0] = pw_buf0[0];
wordl0[1] = pw_buf0[1];
wordl0[2] = pw_buf0[2];
wordl0[3] = pw_buf0[3];
wordl1[0] = pw_buf1[0];
wordl1[1] = pw_buf1[1];
wordl1[2] = pw_buf1[2];
wordl1[3] = pw_buf1[3];
u32x wordr0[4] = { 0 };
u32x wordr1[4] = { 0 };
u32x wordr2[4] = { 0 };
u32x wordr3[4] = { 0 };
wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
{
switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len);
}
else
{
switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len);
}
u32x w0[4];
u32x w1[4];
u32x w2[4];
u32x w3[4];
w0[0] = wordl0[0] | wordr0[0];
w0[1] = wordl0[1] | wordr0[1];
w0[2] = wordl0[2] | wordr0[2];
w0[3] = wordl0[3] | wordr0[3];
w1[0] = wordl1[0] | wordr1[0];
w1[1] = wordl1[1] | wordr1[1];
w1[2] = wordl1[2] | wordr1[2];
w1[3] = wordl1[3] | wordr1[3];
w2[0] = wordl2[0] | wordr2[0];
w2[1] = wordl2[1] | wordr2[1];
w2[2] = wordl2[2] | wordr2[2];
w2[3] = wordl2[3] | wordr2[3];
w3[0] = wordl3[0] | wordr3[0];
w3[1] = wordl3[1] | wordr3[1];
w3[2] = wordl3[2] | wordr3[2];
w3[3] = wordl3[3] | wordr3[3];
make_utf16le (w1, w2, w3);
make_utf16le (w0, w0, w1);
const u32x pw_len2 = pw_len * 2;
append_0x80_4x4_VV (w0, w1, w2, w3, pw_len2);
w3[2] = pw_len2 * 8;
w3[3] = 0;
/**
* md5
*/
u32x a = MD5M_A;
u32x b = MD5M_B;
u32x c = MD5M_C;
u32x d = MD5M_D;
MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
u32x t;
MD5_STEP (MD5_H1, a, b, c, d, w1[1], MD5C20, MD5S20);
MD5_STEP (MD5_H2, d, a, b, c, w2[0], MD5C21, MD5S21);
MD5_STEP (MD5_H1, c, d, a, b, w2[3], MD5C22, MD5S22);
MD5_STEP (MD5_H2, b, c, d, a, w3[2], MD5C23, MD5S23);
MD5_STEP (MD5_H1, a, b, c, d, w0[1], MD5C24, MD5S20);
MD5_STEP (MD5_H2, d, a, b, c, w1[0], MD5C25, MD5S21);
MD5_STEP (MD5_H1, c, d, a, b, w1[3], MD5C26, MD5S22);
MD5_STEP (MD5_H2, b, c, d, a, w2[2], MD5C27, MD5S23);
MD5_STEP (MD5_H1, a, b, c, d, w3[1], MD5C28, MD5S20);
MD5_STEP (MD5_H2, d, a, b, c, w0[0], MD5C29, MD5S21);
MD5_STEP (MD5_H1, c, d, a, b, w0[3], MD5C2a, MD5S22);
MD5_STEP (MD5_H2, b, c, d, a, w1[2], MD5C2b, MD5S23);
MD5_STEP (MD5_H1, a, b, c, d, w2[1], MD5C2c, MD5S20);
MD5_STEP (MD5_H2, d, a, b, c, w3[0], MD5C2d, MD5S21);
MD5_STEP (MD5_H1, c, d, a, b, w3[3], MD5C2e, MD5S22);
MD5_STEP (MD5_H2, b, c, d, a, w0[2], MD5C2f, MD5S23);
MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
if (MATCHES_NONE_VS (a, search[0])) continue;
MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
COMPARE_S_SIMD (a, d, c, b);
}
}
KERNEL_FQ void m00070_s08 (KERN_ATTR_BASIC ())
{
}
KERNEL_FQ void m00070_s16 (KERN_ATTR_BASIC ())
{
}

111
OpenCL/m00070_a1-pure.cl Normal file
View File

@ -0,0 +1,111 @@
/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
//#define NEW_SIMD_CODE
#ifdef KERNEL_STATIC
#include "inc_vendor.h"
#include "inc_types.h"
#include "inc_platform.cl"
#include "inc_common.cl"
#include "inc_scalar.cl"
#include "inc_hash_md5.cl"
#endif
KERNEL_FQ void m00070_mxx (KERN_ATTR_BASIC ())
{
/**
* modifier
*/
const u64 lid = get_local_id (0);
const u64 gid = get_global_id (0);
if (gid >= gid_max) return;
/**
* base
*/
md5_ctx_t ctx0;
md5_init (&ctx0);
md5_update_global_utf16le (&ctx0, pws[gid].i, pws[gid].pw_len);
/**
* loop
*/
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
{
md5_ctx_t ctx = ctx0;
md5_update_global_utf16le (&ctx, combs_buf[il_pos].i, combs_buf[il_pos].pw_len);
md5_final (&ctx);
const u32 r0 = ctx.h[DGST_R0];
const u32 r1 = ctx.h[DGST_R1];
const u32 r2 = ctx.h[DGST_R2];
const u32 r3 = ctx.h[DGST_R3];
COMPARE_M_SCALAR (r0, r1, r2, r3);
}
}
KERNEL_FQ void m00070_sxx (KERN_ATTR_BASIC ())
{
/**
* modifier
*/
const u64 lid = get_local_id (0);
const u64 gid = get_global_id (0);
if (gid >= gid_max) return;
/**
* digest
*/
const u32 search[4] =
{
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**
* base
*/
md5_ctx_t ctx0;
md5_init (&ctx0);
md5_update_global_utf16le (&ctx0, pws[gid].i, pws[gid].pw_len);
/**
* loop
*/
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
{
md5_ctx_t ctx = ctx0;
md5_update_global_utf16le (&ctx, combs_buf[il_pos].i, combs_buf[il_pos].pw_len);
md5_final (&ctx);
const u32 r0 = ctx.h[DGST_R0];
const u32 r1 = ctx.h[DGST_R1];
const u32 r2 = ctx.h[DGST_R2];
const u32 r3 = ctx.h[DGST_R3];
COMPARE_S_SCALAR (r0, r1, r2, r3);
}
}

View File

@ -0,0 +1,661 @@
/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
#define NEW_SIMD_CODE
#ifdef KERNEL_STATIC
#include "inc_vendor.h"
#include "inc_types.h"
#include "inc_platform.cl"
#include "inc_common.cl"
#include "inc_simd.cl"
#include "inc_hash_md5.cl"
#endif
#define MD5_STEP_REV(f,a,b,c,d,x,t,s) \
{ \
a -= b; \
a = hc_rotr32_S (a, s); \
a -= f (b, c, d); \
a -= x; \
a -= t; \
}
#define MD5_STEP_REV1(f,a,b,c,d,x,t,s) \
{ \
a -= b; \
a = hc_rotr32_S (a, s); \
a -= x; \
a -= t; \
}
DECLSPEC void m00070m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
{
/**
* modifier
*/
const u64 gid = get_global_id (0);
const u64 lid = get_local_id (0);
w[14] = pw_len * 8;
w[15] = 0;
/**
* base
*/
const u32 F_w0c00 = 0u + MD5C00;
const u32 F_w1c01 = w[ 1] + MD5C01;
const u32 F_w2c02 = w[ 2] + MD5C02;
const u32 F_w3c03 = w[ 3] + MD5C03;
const u32 F_w4c04 = w[ 4] + MD5C04;
const u32 F_w5c05 = w[ 5] + MD5C05;
const u32 F_w6c06 = w[ 6] + MD5C06;
const u32 F_w7c07 = w[ 7] + MD5C07;
const u32 F_w8c08 = w[ 8] + MD5C08;
const u32 F_w9c09 = w[ 9] + MD5C09;
const u32 F_wac0a = w[10] + MD5C0a;
const u32 F_wbc0b = w[11] + MD5C0b;
const u32 F_wcc0c = w[12] + MD5C0c;
const u32 F_wdc0d = w[13] + MD5C0d;
const u32 F_wec0e = w[14] + MD5C0e;
const u32 F_wfc0f = w[15] + MD5C0f;
const u32 G_w1c10 = w[ 1] + MD5C10;
const u32 G_w6c11 = w[ 6] + MD5C11;
const u32 G_wbc12 = w[11] + MD5C12;
const u32 G_w0c13 = 0u + MD5C13;
const u32 G_w5c14 = w[ 5] + MD5C14;
const u32 G_wac15 = w[10] + MD5C15;
const u32 G_wfc16 = w[15] + MD5C16;
const u32 G_w4c17 = w[ 4] + MD5C17;
const u32 G_w9c18 = w[ 9] + MD5C18;
const u32 G_wec19 = w[14] + MD5C19;
const u32 G_w3c1a = w[ 3] + MD5C1a;
const u32 G_w8c1b = w[ 8] + MD5C1b;
const u32 G_wdc1c = w[13] + MD5C1c;
const u32 G_w2c1d = w[ 2] + MD5C1d;
const u32 G_w7c1e = w[ 7] + MD5C1e;
const u32 G_wcc1f = w[12] + MD5C1f;
const u32 H_w5c20 = w[ 5] + MD5C20;
const u32 H_w8c21 = w[ 8] + MD5C21;
const u32 H_wbc22 = w[11] + MD5C22;
const u32 H_wec23 = w[14] + MD5C23;
const u32 H_w1c24 = w[ 1] + MD5C24;
const u32 H_w4c25 = w[ 4] + MD5C25;
const u32 H_w7c26 = w[ 7] + MD5C26;
const u32 H_wac27 = w[10] + MD5C27;
const u32 H_wdc28 = w[13] + MD5C28;
const u32 H_w0c29 = 0u + MD5C29;
const u32 H_w3c2a = w[ 3] + MD5C2a;
const u32 H_w6c2b = w[ 6] + MD5C2b;
const u32 H_w9c2c = w[ 9] + MD5C2c;
const u32 H_wcc2d = w[12] + MD5C2d;
const u32 H_wfc2e = w[15] + MD5C2e;
const u32 H_w2c2f = w[ 2] + MD5C2f;
const u32 I_w0c30 = 0u + MD5C30;
const u32 I_w7c31 = w[ 7] + MD5C31;
const u32 I_wec32 = w[14] + MD5C32;
const u32 I_w5c33 = w[ 5] + MD5C33;
const u32 I_wcc34 = w[12] + MD5C34;
const u32 I_w3c35 = w[ 3] + MD5C35;
const u32 I_wac36 = w[10] + MD5C36;
const u32 I_w1c37 = w[ 1] + MD5C37;
const u32 I_w8c38 = w[ 8] + MD5C38;
const u32 I_wfc39 = w[15] + MD5C39;
const u32 I_w6c3a = w[ 6] + MD5C3a;
const u32 I_wdc3b = w[13] + MD5C3b;
const u32 I_w4c3c = w[ 4] + MD5C3c;
const u32 I_wbc3d = w[11] + MD5C3d;
const u32 I_w2c3e = w[ 2] + MD5C3e;
const u32 I_w9c3f = w[ 9] + MD5C3f;
/**
* loop
*/
u32 w0l = w[0];
for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
{
const u32x w0r = words_buf_r[il_pos / VECT_SIZE];
const u32x w0 = w0l | w0r;
u32x a = MD5M_A;
u32x b = MD5M_B;
u32x c = MD5M_C;
u32x d = MD5M_D;
MD5_STEP (MD5_Fo, a, b, c, d, w0, F_w0c00, MD5S00);
MD5_STEP0(MD5_Fo, d, a, b, c, F_w1c01, MD5S01);
MD5_STEP0(MD5_Fo, c, d, a, b, F_w2c02, MD5S02);
MD5_STEP0(MD5_Fo, b, c, d, a, F_w3c03, MD5S03);
MD5_STEP0(MD5_Fo, a, b, c, d, F_w4c04, MD5S00);
MD5_STEP0(MD5_Fo, d, a, b, c, F_w5c05, MD5S01);
MD5_STEP0(MD5_Fo, c, d, a, b, F_w6c06, MD5S02);
MD5_STEP0(MD5_Fo, b, c, d, a, F_w7c07, MD5S03);
MD5_STEP0(MD5_Fo, a, b, c, d, F_w8c08, MD5S00);
MD5_STEP0(MD5_Fo, d, a, b, c, F_w9c09, MD5S01);
MD5_STEP0(MD5_Fo, c, d, a, b, F_wac0a, MD5S02);
MD5_STEP0(MD5_Fo, b, c, d, a, F_wbc0b, MD5S03);
MD5_STEP0(MD5_Fo, a, b, c, d, F_wcc0c, MD5S00);
MD5_STEP0(MD5_Fo, d, a, b, c, F_wdc0d, MD5S01);
MD5_STEP0(MD5_Fo, c, d, a, b, F_wec0e, MD5S02);
MD5_STEP0(MD5_Fo, b, c, d, a, F_wfc0f, MD5S03);
MD5_STEP0(MD5_Go, a, b, c, d, G_w1c10, MD5S10);
MD5_STEP0(MD5_Go, d, a, b, c, G_w6c11, MD5S11);
MD5_STEP0(MD5_Go, c, d, a, b, G_wbc12, MD5S12);
MD5_STEP (MD5_Go, b, c, d, a, w0, G_w0c13, MD5S13);
MD5_STEP0(MD5_Go, a, b, c, d, G_w5c14, MD5S10);
MD5_STEP0(MD5_Go, d, a, b, c, G_wac15, MD5S11);
MD5_STEP0(MD5_Go, c, d, a, b, G_wfc16, MD5S12);
MD5_STEP0(MD5_Go, b, c, d, a, G_w4c17, MD5S13);
MD5_STEP0(MD5_Go, a, b, c, d, G_w9c18, MD5S10);
MD5_STEP0(MD5_Go, d, a, b, c, G_wec19, MD5S11);
MD5_STEP0(MD5_Go, c, d, a, b, G_w3c1a, MD5S12);
MD5_STEP0(MD5_Go, b, c, d, a, G_w8c1b, MD5S13);
MD5_STEP0(MD5_Go, a, b, c, d, G_wdc1c, MD5S10);
MD5_STEP0(MD5_Go, d, a, b, c, G_w2c1d, MD5S11);
MD5_STEP0(MD5_Go, c, d, a, b, G_w7c1e, MD5S12);
MD5_STEP0(MD5_Go, b, c, d, a, G_wcc1f, MD5S13);
u32x t;
MD5_STEP0(MD5_H1, a, b, c, d, H_w5c20, MD5S20);
MD5_STEP0(MD5_H2, d, a, b, c, H_w8c21, MD5S21);
MD5_STEP0(MD5_H1, c, d, a, b, H_wbc22, MD5S22);
MD5_STEP0(MD5_H2, b, c, d, a, H_wec23, MD5S23);
MD5_STEP0(MD5_H1, a, b, c, d, H_w1c24, MD5S20);
MD5_STEP0(MD5_H2, d, a, b, c, H_w4c25, MD5S21);
MD5_STEP0(MD5_H1, c, d, a, b, H_w7c26, MD5S22);
MD5_STEP0(MD5_H2, b, c, d, a, H_wac27, MD5S23);
MD5_STEP0(MD5_H1, a, b, c, d, H_wdc28, MD5S20);
MD5_STEP (MD5_H2, d, a, b, c, w0, H_w0c29, MD5S21);
MD5_STEP0(MD5_H1, c, d, a, b, H_w3c2a, MD5S22);
MD5_STEP0(MD5_H2, b, c, d, a, H_w6c2b, MD5S23);
MD5_STEP0(MD5_H1, a, b, c, d, H_w9c2c, MD5S20);
MD5_STEP0(MD5_H2, d, a, b, c, H_wcc2d, MD5S21);
MD5_STEP0(MD5_H1, c, d, a, b, H_wfc2e, MD5S22);
MD5_STEP0(MD5_H2, b, c, d, a, H_w2c2f, MD5S23);
MD5_STEP (MD5_I , a, b, c, d, w0, I_w0c30, MD5S30);
MD5_STEP0(MD5_I , d, a, b, c, I_w7c31, MD5S31);
MD5_STEP0(MD5_I , c, d, a, b, I_wec32, MD5S32);
MD5_STEP0(MD5_I , b, c, d, a, I_w5c33, MD5S33);
MD5_STEP0(MD5_I , a, b, c, d, I_wcc34, MD5S30);
MD5_STEP0(MD5_I , d, a, b, c, I_w3c35, MD5S31);
MD5_STEP0(MD5_I , c, d, a, b, I_wac36, MD5S32);
MD5_STEP0(MD5_I , b, c, d, a, I_w1c37, MD5S33);
MD5_STEP0(MD5_I , a, b, c, d, I_w8c38, MD5S30);
MD5_STEP0(MD5_I , d, a, b, c, I_wfc39, MD5S31);
MD5_STEP0(MD5_I , c, d, a, b, I_w6c3a, MD5S32);
MD5_STEP0(MD5_I , b, c, d, a, I_wdc3b, MD5S33);
MD5_STEP0(MD5_I , a, b, c, d, I_w4c3c, MD5S30);
MD5_STEP0(MD5_I , d, a, b, c, I_wbc3d, MD5S31);
MD5_STEP0(MD5_I , c, d, a, b, I_w2c3e, MD5S32);
MD5_STEP0(MD5_I , b, c, d, a, I_w9c3f, MD5S33);
COMPARE_M_SIMD (a, d, c, b);
}
}
DECLSPEC void m00070s (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
{
/**
* modifier
*/
const u64 gid = get_global_id (0);
const u64 lid = get_local_id (0);
/**
* base
*/
const u32 F_w0c00 = 0u + MD5C00;
const u32 F_w1c01 = w[ 1] + MD5C01;
const u32 F_w2c02 = w[ 2] + MD5C02;
const u32 F_w3c03 = w[ 3] + MD5C03;
const u32 F_w4c04 = w[ 4] + MD5C04;
const u32 F_w5c05 = w[ 5] + MD5C05;
const u32 F_w6c06 = w[ 6] + MD5C06;
const u32 F_w7c07 = w[ 7] + MD5C07;
const u32 F_w8c08 = w[ 8] + MD5C08;
const u32 F_w9c09 = w[ 9] + MD5C09;
const u32 F_wac0a = w[10] + MD5C0a;
const u32 F_wbc0b = w[11] + MD5C0b;
const u32 F_wcc0c = w[12] + MD5C0c;
const u32 F_wdc0d = w[13] + MD5C0d;
const u32 F_wec0e = w[14] + MD5C0e;
const u32 F_wfc0f = w[15] + MD5C0f;
const u32 G_w1c10 = w[ 1] + MD5C10;
const u32 G_w6c11 = w[ 6] + MD5C11;
const u32 G_wbc12 = w[11] + MD5C12;
const u32 G_w0c13 = 0u + MD5C13;
const u32 G_w5c14 = w[ 5] + MD5C14;
const u32 G_wac15 = w[10] + MD5C15;
const u32 G_wfc16 = w[15] + MD5C16;
const u32 G_w4c17 = w[ 4] + MD5C17;
const u32 G_w9c18 = w[ 9] + MD5C18;
const u32 G_wec19 = w[14] + MD5C19;
const u32 G_w3c1a = w[ 3] + MD5C1a;
const u32 G_w8c1b = w[ 8] + MD5C1b;
const u32 G_wdc1c = w[13] + MD5C1c;
const u32 G_w2c1d = w[ 2] + MD5C1d;
const u32 G_w7c1e = w[ 7] + MD5C1e;
const u32 G_wcc1f = w[12] + MD5C1f;
const u32 H_w5c20 = w[ 5] + MD5C20;
const u32 H_w8c21 = w[ 8] + MD5C21;
const u32 H_wbc22 = w[11] + MD5C22;
const u32 H_wec23 = w[14] + MD5C23;
const u32 H_w1c24 = w[ 1] + MD5C24;
const u32 H_w4c25 = w[ 4] + MD5C25;
const u32 H_w7c26 = w[ 7] + MD5C26;
const u32 H_wac27 = w[10] + MD5C27;
const u32 H_wdc28 = w[13] + MD5C28;
const u32 H_w0c29 = 0u + MD5C29;
const u32 H_w3c2a = w[ 3] + MD5C2a;
const u32 H_w6c2b = w[ 6] + MD5C2b;
const u32 H_w9c2c = w[ 9] + MD5C2c;
const u32 H_wcc2d = w[12] + MD5C2d;
const u32 H_wfc2e = w[15] + MD5C2e;
const u32 H_w2c2f = w[ 2] + MD5C2f;
const u32 I_w0c30 = 0u + MD5C30;
const u32 I_w7c31 = w[ 7] + MD5C31;
const u32 I_wec32 = w[14] + MD5C32;
const u32 I_w5c33 = w[ 5] + MD5C33;
const u32 I_wcc34 = w[12] + MD5C34;
const u32 I_w3c35 = w[ 3] + MD5C35;
const u32 I_wac36 = w[10] + MD5C36;
const u32 I_w1c37 = w[ 1] + MD5C37;
const u32 I_w8c38 = w[ 8] + MD5C38;
const u32 I_wfc39 = w[15] + MD5C39;
const u32 I_w6c3a = w[ 6] + MD5C3a;
const u32 I_wdc3b = w[13] + MD5C3b;
const u32 I_w4c3c = w[ 4] + MD5C3c;
const u32 I_wbc3d = w[11] + MD5C3d;
const u32 I_w2c3e = w[ 2] + MD5C3e;
const u32 I_w9c3f = w[ 9] + MD5C3f;
/**
* digest
*/
const u32 search[4] =
{
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**
* reverse
*/
u32 a_rev = digests_buf[DIGESTS_OFFSET].digest_buf[0];
u32 b_rev = digests_buf[DIGESTS_OFFSET].digest_buf[1];
u32 c_rev = digests_buf[DIGESTS_OFFSET].digest_buf[2];
u32 d_rev = digests_buf[DIGESTS_OFFSET].digest_buf[3];
MD5_STEP_REV (MD5_I_S, b_rev, c_rev, d_rev, a_rev, w[ 9], MD5C3f, MD5S33);
MD5_STEP_REV (MD5_I_S, c_rev, d_rev, a_rev, b_rev, w[ 2], MD5C3e, MD5S32);
MD5_STEP_REV (MD5_I_S, d_rev, a_rev, b_rev, c_rev, w[11], MD5C3d, MD5S31);
MD5_STEP_REV (MD5_I_S, a_rev, b_rev, c_rev, d_rev, w[ 4], MD5C3c, MD5S30);
MD5_STEP_REV (MD5_I_S, b_rev, c_rev, d_rev, a_rev, w[13], MD5C3b, MD5S33);
MD5_STEP_REV (MD5_I_S, c_rev, d_rev, a_rev, b_rev, w[ 6], MD5C3a, MD5S32);
MD5_STEP_REV (MD5_I_S, d_rev, a_rev, b_rev, c_rev, w[15], MD5C39, MD5S31);
MD5_STEP_REV (MD5_I_S, a_rev, b_rev, c_rev, d_rev, w[ 8], MD5C38, MD5S30);
MD5_STEP_REV (MD5_I_S, b_rev, c_rev, d_rev, a_rev, w[ 1], MD5C37, MD5S33);
MD5_STEP_REV (MD5_I_S, c_rev, d_rev, a_rev, b_rev, w[10], MD5C36, MD5S32);
MD5_STEP_REV (MD5_I_S, d_rev, a_rev, b_rev, c_rev, w[ 3], MD5C35, MD5S31);
MD5_STEP_REV (MD5_I_S, a_rev, b_rev, c_rev, d_rev, w[12], MD5C34, MD5S30);
MD5_STEP_REV (MD5_I_S, b_rev, c_rev, d_rev, a_rev, w[ 5], MD5C33, MD5S33);
MD5_STEP_REV (MD5_I_S, c_rev, d_rev, a_rev, b_rev, w[14], MD5C32, MD5S32);
MD5_STEP_REV (MD5_I_S, d_rev, a_rev, b_rev, c_rev, w[ 7], MD5C31, MD5S31);
MD5_STEP_REV (MD5_I_S, a_rev, b_rev, c_rev, d_rev, 0, MD5C30, MD5S30);
const u32 pre_cd = c_rev ^ d_rev;
MD5_STEP_REV1(MD5_H_S, b_rev, c_rev, d_rev, a_rev, w[ 2], MD5C2f, MD5S23);
MD5_STEP_REV1(MD5_H_S, c_rev, d_rev, a_rev, b_rev, w[15], MD5C2e, MD5S22);
/**
* loop
*/
u32 w0l = w[0];
for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
{
const u32x w0r = words_buf_r[il_pos / VECT_SIZE];
const u32x w0 = w0l | w0r;
const u32x pre_d = d_rev;
const u32x pre_a = a_rev - w0;
const u32x pre_b = b_rev - (pre_a ^ pre_cd);
const u32x pre_c = c_rev - (pre_a ^ pre_b ^ pre_d);
u32x a = MD5M_A;
u32x b = MD5M_B;
u32x c = MD5M_C;
u32x d = MD5M_D;
MD5_STEP (MD5_Fo, a, b, c, d, w0, F_w0c00, MD5S00);
MD5_STEP0(MD5_Fo, d, a, b, c, F_w1c01, MD5S01);
MD5_STEP0(MD5_Fo, c, d, a, b, F_w2c02, MD5S02);
MD5_STEP0(MD5_Fo, b, c, d, a, F_w3c03, MD5S03);
MD5_STEP0(MD5_Fo, a, b, c, d, F_w4c04, MD5S00);
MD5_STEP0(MD5_Fo, d, a, b, c, F_w5c05, MD5S01);
MD5_STEP0(MD5_Fo, c, d, a, b, F_w6c06, MD5S02);
MD5_STEP0(MD5_Fo, b, c, d, a, F_w7c07, MD5S03);
MD5_STEP0(MD5_Fo, a, b, c, d, F_w8c08, MD5S00);
MD5_STEP0(MD5_Fo, d, a, b, c, F_w9c09, MD5S01);
MD5_STEP0(MD5_Fo, c, d, a, b, F_wac0a, MD5S02);
MD5_STEP0(MD5_Fo, b, c, d, a, F_wbc0b, MD5S03);
MD5_STEP0(MD5_Fo, a, b, c, d, F_wcc0c, MD5S00);
MD5_STEP0(MD5_Fo, d, a, b, c, F_wdc0d, MD5S01);
MD5_STEP0(MD5_Fo, c, d, a, b, F_wec0e, MD5S02);
MD5_STEP0(MD5_Fo, b, c, d, a, F_wfc0f, MD5S03);
MD5_STEP0(MD5_Go, a, b, c, d, G_w1c10, MD5S10);
MD5_STEP0(MD5_Go, d, a, b, c, G_w6c11, MD5S11);
MD5_STEP0(MD5_Go, c, d, a, b, G_wbc12, MD5S12);
MD5_STEP (MD5_Go, b, c, d, a, w0, G_w0c13, MD5S13);
MD5_STEP0(MD5_Go, a, b, c, d, G_w5c14, MD5S10);
MD5_STEP0(MD5_Go, d, a, b, c, G_wac15, MD5S11);
MD5_STEP0(MD5_Go, c, d, a, b, G_wfc16, MD5S12);
MD5_STEP0(MD5_Go, b, c, d, a, G_w4c17, MD5S13);
MD5_STEP0(MD5_Go, a, b, c, d, G_w9c18, MD5S10);
MD5_STEP0(MD5_Go, d, a, b, c, G_wec19, MD5S11);
MD5_STEP0(MD5_Go, c, d, a, b, G_w3c1a, MD5S12);
MD5_STEP0(MD5_Go, b, c, d, a, G_w8c1b, MD5S13);
MD5_STEP0(MD5_Go, a, b, c, d, G_wdc1c, MD5S10);
MD5_STEP0(MD5_Go, d, a, b, c, G_w2c1d, MD5S11);
MD5_STEP0(MD5_Go, c, d, a, b, G_w7c1e, MD5S12);
MD5_STEP0(MD5_Go, b, c, d, a, G_wcc1f, MD5S13);
u32x t;
MD5_STEP0(MD5_H1, a, b, c, d, H_w5c20, MD5S20);
MD5_STEP0(MD5_H2, d, a, b, c, H_w8c21, MD5S21);
MD5_STEP0(MD5_H1, c, d, a, b, H_wbc22, MD5S22);
MD5_STEP0(MD5_H2, b, c, d, a, H_wec23, MD5S23);
MD5_STEP0(MD5_H1, a, b, c, d, H_w1c24, MD5S20);
MD5_STEP0(MD5_H2, d, a, b, c, H_w4c25, MD5S21);
MD5_STEP0(MD5_H1, c, d, a, b, H_w7c26, MD5S22);
MD5_STEP0(MD5_H2, b, c, d, a, H_wac27, MD5S23);
MD5_STEP0(MD5_H1, a, b, c, d, H_wdc28, MD5S20);
MD5_STEP (MD5_H2, d, a, b, c, w0, H_w0c29, MD5S21);
MD5_STEP0(MD5_H1, c, d, a, b, H_w3c2a, MD5S22);
if (MATCHES_NONE_VV (pre_c, c)) continue;
MD5_STEP0(MD5_H2, b, c, d, a, H_w6c2b, MD5S23);
MD5_STEP0(MD5_H1, a, b, c, d, H_w9c2c, MD5S20);
MD5_STEP0(MD5_H2, d, a, b, c, H_wcc2d, MD5S21);
if (MATCHES_NONE_VV (pre_d, d)) continue;
MD5_STEP0(MD5_H1, c, d, a, b, H_wfc2e, MD5S22);
MD5_STEP0(MD5_H2, b, c, d, a, H_w2c2f, MD5S23);
MD5_STEP (MD5_I , a, b, c, d, w0, I_w0c30, MD5S30);
MD5_STEP0(MD5_I , d, a, b, c, I_w7c31, MD5S31);
MD5_STEP0(MD5_I , c, d, a, b, I_wec32, MD5S32);
MD5_STEP0(MD5_I , b, c, d, a, I_w5c33, MD5S33);
MD5_STEP0(MD5_I , a, b, c, d, I_wcc34, MD5S30);
MD5_STEP0(MD5_I , d, a, b, c, I_w3c35, MD5S31);
MD5_STEP0(MD5_I , c, d, a, b, I_wac36, MD5S32);
MD5_STEP0(MD5_I , b, c, d, a, I_w1c37, MD5S33);
MD5_STEP0(MD5_I , a, b, c, d, I_w8c38, MD5S30);
MD5_STEP0(MD5_I , d, a, b, c, I_wfc39, MD5S31);
MD5_STEP0(MD5_I , c, d, a, b, I_w6c3a, MD5S32);
MD5_STEP0(MD5_I , b, c, d, a, I_wdc3b, MD5S33);
MD5_STEP0(MD5_I , a, b, c, d, I_w4c3c, MD5S30);
MD5_STEP0(MD5_I , d, a, b, c, I_wbc3d, MD5S31);
MD5_STEP0(MD5_I , c, d, a, b, I_w2c3e, MD5S32);
MD5_STEP0(MD5_I , b, c, d, a, I_w9c3f, MD5S33);
COMPARE_S_SIMD (a, d, c, b);
}
}
KERNEL_FQ void m00070_m04 (KERN_ATTR_VECTOR ())
{
/**
* base
*/
const u64 gid = get_global_id (0);
if (gid >= gid_max) return;
u32 w[16];
w[ 0] = pws[gid].i[ 0];
w[ 1] = pws[gid].i[ 1];
w[ 2] = pws[gid].i[ 2];
w[ 3] = pws[gid].i[ 3];
w[ 4] = 0;
w[ 5] = 0;
w[ 6] = 0;
w[ 7] = 0;
w[ 8] = 0;
w[ 9] = 0;
w[10] = 0;
w[11] = 0;
w[12] = 0;
w[13] = 0;
w[14] = pws[gid].i[14];
w[15] = 0;
const u32 pw_len = pws[gid].pw_len & 63;
/**
* main
*/
m00070m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}
KERNEL_FQ void m00070_m08 (KERN_ATTR_VECTOR ())
{
/**
* base
*/
const u64 gid = get_global_id (0);
if (gid >= gid_max) return;
u32 w[16];
w[ 0] = pws[gid].i[ 0];
w[ 1] = pws[gid].i[ 1];
w[ 2] = pws[gid].i[ 2];
w[ 3] = pws[gid].i[ 3];
w[ 4] = pws[gid].i[ 4];
w[ 5] = pws[gid].i[ 5];
w[ 6] = pws[gid].i[ 6];
w[ 7] = pws[gid].i[ 7];
w[ 8] = 0;
w[ 9] = 0;
w[10] = 0;
w[11] = 0;
w[12] = 0;
w[13] = 0;
w[14] = pws[gid].i[14];
w[15] = 0;
const u32 pw_len = pws[gid].pw_len & 63;
/**
* main
*/
m00070m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}
KERNEL_FQ void m00070_m16 (KERN_ATTR_VECTOR ())
{
/**
* base
*/
const u64 gid = get_global_id (0);
if (gid >= gid_max) return;
u32 w[16];
w[ 0] = pws[gid].i[ 0];
w[ 1] = pws[gid].i[ 1];
w[ 2] = pws[gid].i[ 2];
w[ 3] = pws[gid].i[ 3];
w[ 4] = pws[gid].i[ 4];
w[ 5] = pws[gid].i[ 5];
w[ 6] = pws[gid].i[ 6];
w[ 7] = pws[gid].i[ 7];
w[ 8] = pws[gid].i[ 8];
w[ 9] = pws[gid].i[ 9];
w[10] = pws[gid].i[10];
w[11] = pws[gid].i[11];
w[12] = pws[gid].i[12];
w[13] = pws[gid].i[13];
w[14] = pws[gid].i[14];
w[15] = pws[gid].i[15];
const u32 pw_len = pws[gid].pw_len & 63;
/**
* main
*/
m00070m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}
KERNEL_FQ void m00070_s04 (KERN_ATTR_VECTOR ())
{
/**
* base
*/
const u64 gid = get_global_id (0);
if (gid >= gid_max) return;
u32 w[16];
w[ 0] = pws[gid].i[ 0];
w[ 1] = pws[gid].i[ 1];
w[ 2] = pws[gid].i[ 2];
w[ 3] = pws[gid].i[ 3];
w[ 4] = 0;
w[ 5] = 0;
w[ 6] = 0;
w[ 7] = 0;
w[ 8] = 0;
w[ 9] = 0;
w[10] = 0;
w[11] = 0;
w[12] = 0;
w[13] = 0;
w[14] = pws[gid].i[14];
w[15] = 0;
const u32 pw_len = pws[gid].pw_len & 63;
/**
* main
*/
m00070s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}
KERNEL_FQ void m00070_s08 (KERN_ATTR_VECTOR ())
{
/**
* base
*/
const u64 gid = get_global_id (0);
if (gid >= gid_max) return;
u32 w[16];
w[ 0] = pws[gid].i[ 0];
w[ 1] = pws[gid].i[ 1];
w[ 2] = pws[gid].i[ 2];
w[ 3] = pws[gid].i[ 3];
w[ 4] = pws[gid].i[ 4];
w[ 5] = pws[gid].i[ 5];
w[ 6] = pws[gid].i[ 6];
w[ 7] = pws[gid].i[ 7];
w[ 8] = 0;
w[ 9] = 0;
w[10] = 0;
w[11] = 0;
w[12] = 0;
w[13] = 0;
w[14] = pws[gid].i[14];
w[15] = 0;
const u32 pw_len = pws[gid].pw_len & 63;
/**
* main
*/
m00070s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}
KERNEL_FQ void m00070_s16 (KERN_ATTR_VECTOR ())
{
/**
* base
*/
const u64 gid = get_global_id (0);
if (gid >= gid_max) return;
u32 w[16];
w[ 0] = pws[gid].i[ 0];
w[ 1] = pws[gid].i[ 1];
w[ 2] = pws[gid].i[ 2];
w[ 3] = pws[gid].i[ 3];
w[ 4] = pws[gid].i[ 4];
w[ 5] = pws[gid].i[ 5];
w[ 6] = pws[gid].i[ 6];
w[ 7] = pws[gid].i[ 7];
w[ 8] = pws[gid].i[ 8];
w[ 9] = pws[gid].i[ 9];
w[10] = pws[gid].i[10];
w[11] = pws[gid].i[11];
w[12] = pws[gid].i[12];
w[13] = pws[gid].i[13];
w[14] = pws[gid].i[14];
w[15] = pws[gid].i[15];
const u32 pw_len = pws[gid].pw_len & 63;
/**
* main
*/
m00070s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
}

137
OpenCL/m00070_a3-pure.cl Normal file
View File

@ -0,0 +1,137 @@
/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
#define NEW_SIMD_CODE
#ifdef KERNEL_STATIC
#include "inc_vendor.h"
#include "inc_types.h"
#include "inc_platform.cl"
#include "inc_common.cl"
#include "inc_simd.cl"
#include "inc_hash_md5.cl"
#endif
KERNEL_FQ void m00070_mxx (KERN_ATTR_VECTOR ())
{
/**
* modifier
*/
const u64 lid = get_local_id (0);
const u64 gid = get_global_id (0);
if (gid >= gid_max) return;
/**
* base
*/
const u32 pw_len = pws[gid].pw_len;
u32x w[64] = { 0 };
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
/**
* loop
*/
u32x w0l = w[0];
for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
{
const u32x w0r = words_buf_r[il_pos / VECT_SIZE];
const u32x w0 = w0l | w0r;
w[0] = w0;
md5_ctx_vector_t ctx;
md5_init_vector (&ctx);
md5_update_vector_utf16le (&ctx, w, pw_len);
md5_final_vector (&ctx);
const u32x r0 = ctx.h[DGST_R0];
const u32x r1 = ctx.h[DGST_R1];
const u32x r2 = ctx.h[DGST_R2];
const u32x r3 = ctx.h[DGST_R3];
COMPARE_M_SIMD (r0, r1, r2, r3);
}
}
KERNEL_FQ void m00070_sxx (KERN_ATTR_VECTOR ())
{
/**
* modifier
*/
const u64 lid = get_local_id (0);
const u64 gid = get_global_id (0);
if (gid >= gid_max) return;
/**
* digest
*/
const u32 search[4] =
{
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**
* base
*/
const u32 pw_len = pws[gid].pw_len;
u32x w[64] = { 0 };
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
/**
* loop
*/
u32x w0l = w[0];
for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
{
const u32x w0r = words_buf_r[il_pos / VECT_SIZE];
const u32x w0 = w0l | w0r;
w[0] = w0;
md5_ctx_vector_t ctx;
md5_init_vector (&ctx);
md5_update_vector_utf16le (&ctx, w, pw_len);
md5_final_vector (&ctx);
const u32x r0 = ctx.h[DGST_R0];
const u32x r1 = ctx.h[DGST_R1];
const u32x r2 = ctx.h[DGST_R2];
const u32x r3 = ctx.h[DGST_R3];
COMPARE_S_SIMD (r0, r1, r2, r3);
}
}

View File

@ -232,10 +232,10 @@ KERNEL_FQ void m00100_s04 (KERN_ATTR_RULES ())
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**

View File

@ -77,10 +77,10 @@ KERNEL_FQ void m00100_sxx (KERN_ATTR_RULES ())
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**

View File

@ -288,10 +288,10 @@ KERNEL_FQ void m00100_s04 (KERN_ATTR_BASIC ())
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
digests_buf[digests_offset].digest_buf[DGST_R2],
digests_buf[digests_offset].digest_buf[DGST_R3]
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**

Some files were not shown because too many files have changed in this diff Show More