mirror of https://github.com/hashcat/hashcat.git
commit
7378159487
@ -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).
|
@ -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 know 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 by 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.
|
@ -0,0 +1,306 @@
|
|||||||
|
/**
|
||||||
|
* 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_gf_mult (iv, subkey, J0);
|
||||||
|
|
||||||
|
u32 len_buf[4] = { 0 };
|
||||||
|
|
||||||
|
len_buf[3] = iv_len * 8;
|
||||||
|
|
||||||
|
AES_GCM_xor_block (len_buf, J0);
|
||||||
|
|
||||||
|
AES_GCM_gf_mult (len_buf, subkey, 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 int 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);
|
||||||
|
}
|
@ -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
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue