mirror of
https://github.com/hashcat/hashcat.git
synced 2024-11-22 16:18:09 +00:00
Rewrite parse_and_store_salt from scratch and rename original to parse_and_store_salt_legacy() for migration phase
Rewrite several *_parse_hash() functions to use parse_and_store_generic_salt()
This commit is contained in:
parent
5f83dd8620
commit
50824a24c6
@ -18,6 +18,8 @@ bool is_valid_base64_string (const u8 *s, const size_t len);
|
||||
bool is_valid_base64_char (const u8 c);
|
||||
bool is_valid_hex_string (const u8 *s, const size_t len);
|
||||
bool is_valid_hex_char (const u8 c);
|
||||
bool is_valid_digit_string (const u8 *s, const size_t len);
|
||||
bool is_valid_digit_char (const u8 c);
|
||||
|
||||
u8 hex_convert (const u8 c);
|
||||
|
||||
|
@ -1349,8 +1349,6 @@ typedef enum display_len
|
||||
DISPLAY_LEN_MAX_11 = 32 + 1 + SALT_MAX,
|
||||
DISPLAY_LEN_MIN_12 = 32 + 1 + 0,
|
||||
DISPLAY_LEN_MAX_12 = 32 + 1 + 32,
|
||||
DISPLAY_LEN_MIN_21 = 32 + 1 + 2,
|
||||
DISPLAY_LEN_MAX_21 = 32 + 1 + 2,
|
||||
DISPLAY_LEN_MIN_22 = 30 + 1 + 1,
|
||||
DISPLAY_LEN_MAX_22 = 30 + 1 + 32,
|
||||
DISPLAY_LEN_MIN_23 = 32 + 1 + 0,
|
||||
@ -1367,8 +1365,6 @@ typedef enum display_len
|
||||
DISPLAY_LEN_MAX_122 = 8 + 40,
|
||||
DISPLAY_LEN_MIN_124 = 4 + 1 + 0 + 1 + 40,
|
||||
DISPLAY_LEN_MAX_124 = 4 + 1 + 32 + 1 + 40,
|
||||
DISPLAY_LEN_MIN_125 = 10 + 40,
|
||||
DISPLAY_LEN_MAX_125 = 10 + 40,
|
||||
DISPLAY_LEN_MIN_131 = 6 + 8 + 80,
|
||||
DISPLAY_LEN_MAX_131 = 6 + 8 + 80,
|
||||
DISPLAY_LEN_MIN_132 = 6 + 8 + 40,
|
||||
@ -1383,8 +1379,6 @@ typedef enum display_len
|
||||
DISPLAY_LEN_MAX_1441 = 14 + 24 + 1 + 43,
|
||||
DISPLAY_LEN_MIN_1711 = 9 + 86 + 0,
|
||||
DISPLAY_LEN_MAX_1711 = 9 + 86 + 68,
|
||||
DISPLAY_LEN_MIN_1722 = 8 + 128,
|
||||
DISPLAY_LEN_MAX_1722 = 8 + 128,
|
||||
DISPLAY_LEN_MIN_1731 = 128 + 6 + 0,
|
||||
DISPLAY_LEN_MAX_1731 = 128 + 6 + 16,
|
||||
DISPLAY_LEN_MIN_2611 = 32 + 1 + 0,
|
||||
|
193
include/types.h
193
include/types.h
@ -589,107 +589,108 @@ typedef enum user_options_defaults
|
||||
|
||||
typedef enum user_options_map
|
||||
{
|
||||
IDX_ADVICE_DISABLE = 0xff00,
|
||||
IDX_ATTACK_MODE = 'a',
|
||||
IDX_BENCHMARK = 'b',
|
||||
IDX_BENCHMARK_ALL = 0xff01,
|
||||
IDX_BITMAP_MAX = 0xff02,
|
||||
IDX_BITMAP_MIN = 0xff03,
|
||||
IDX_CPU_AFFINITY = 0xff04,
|
||||
IDX_CUSTOM_CHARSET_1 = '1',
|
||||
IDX_CUSTOM_CHARSET_2 = '2',
|
||||
IDX_CUSTOM_CHARSET_3 = '3',
|
||||
IDX_CUSTOM_CHARSET_4 = '4',
|
||||
IDX_DEBUG_FILE = 0xff05,
|
||||
IDX_DEBUG_MODE = 0xff06,
|
||||
IDX_ENCODING_FROM = 0xff07,
|
||||
IDX_ENCODING_TO = 0xff08,
|
||||
IDX_EXAMPLE_HASHES = 0xff09,
|
||||
IDX_FORCE = 0xff0a,
|
||||
IDX_GPU_TEMP_ABORT = 0xff0b,
|
||||
IDX_GPU_TEMP_DISABLE = 0xff0c,
|
||||
IDX_HASH_MODE = 'm',
|
||||
IDX_HCCAPX_MESSAGE_PAIR = 0xff0d,
|
||||
IDX_HELP = 'h',
|
||||
IDX_HEX_CHARSET = 0xff0e,
|
||||
IDX_HEX_SALT = 0xff0f,
|
||||
IDX_HEX_WORDLIST = 0xff10,
|
||||
IDX_INCREMENT = 'i',
|
||||
IDX_INCREMENT_MAX = 0xff11,
|
||||
IDX_INCREMENT_MIN = 0xff12,
|
||||
IDX_INDUCTION_DIR = 0xff13,
|
||||
IDX_KEEP_GUESSING = 0xff14,
|
||||
IDX_KERNEL_ACCEL = 'n',
|
||||
IDX_KERNEL_LOOPS = 'u',
|
||||
IDX_KEYSPACE = 0xff15,
|
||||
IDX_LEFT = 0xff16,
|
||||
IDX_LIMIT = 'l',
|
||||
IDX_LOGFILE_DISABLE = 0xff17,
|
||||
IDX_LOOPBACK = 0xff18,
|
||||
IDX_MACHINE_READABLE = 0xff19,
|
||||
IDX_MARKOV_CLASSIC = 0xff1a,
|
||||
IDX_MARKOV_DISABLE = 0xff1b,
|
||||
IDX_MARKOV_HCSTAT = 0xff1c,
|
||||
IDX_MARKOV_THRESHOLD = 't',
|
||||
IDX_NONCE_ERROR_CORRECTIONS = 0xff1d,
|
||||
IDX_NVIDIA_SPIN_DAMP = 0xff1e,
|
||||
IDX_OPENCL_DEVICES = 'd',
|
||||
IDX_OPENCL_DEVICE_TYPES = 'D',
|
||||
IDX_OPENCL_INFO = 'I',
|
||||
IDX_OPENCL_PLATFORMS = 0xff1f,
|
||||
IDX_OPENCL_VECTOR_WIDTH = 0xff20,
|
||||
IDX_OPTIMIZED_KERNEL_ENABLE = 'O',
|
||||
IDX_OUTFILE_AUTOHEX_DISABLE = 0xff21,
|
||||
IDX_OUTFILE_CHECK_DIR = 0xff22,
|
||||
IDX_OUTFILE_CHECK_TIMER = 0xff23,
|
||||
IDX_OUTFILE_FORMAT = 0xff24,
|
||||
IDX_OUTFILE = 'o',
|
||||
IDX_WORDLIST_AUTOHEX_DISABLE = 0xff25,
|
||||
IDX_POTFILE_DISABLE = 0xff26,
|
||||
IDX_POTFILE_PATH = 0xff27,
|
||||
IDX_QUIET = 0xff28,
|
||||
IDX_REMOVE = 0xff29,
|
||||
IDX_REMOVE_TIMER = 0xff2a,
|
||||
IDX_RESTORE = 0xff2b,
|
||||
IDX_RESTORE_DISABLE = 0xff2c,
|
||||
IDX_RESTORE_FILE_PATH = 0xff2d,
|
||||
IDX_RP_FILE = 'r',
|
||||
IDX_RP_GEN_FUNC_MAX = 0xff2e,
|
||||
IDX_RP_GEN_FUNC_MIN = 0xff2f,
|
||||
IDX_RP_GEN = 'g',
|
||||
IDX_RP_GEN_SEED = 0xff30,
|
||||
IDX_RULE_BUF_L = 'j',
|
||||
IDX_RULE_BUF_R = 'k',
|
||||
IDX_RUNTIME = 0xff31,
|
||||
IDX_SCRYPT_TMTO = 0xff32,
|
||||
IDX_SELF_TEST_DISABLE = 0xff33,
|
||||
IDX_SEGMENT_SIZE = 'c',
|
||||
IDX_SEPARATOR = 'p',
|
||||
IDX_SESSION = 0xff34,
|
||||
IDX_SHOW = 0xff35,
|
||||
IDX_SKIP = 's',
|
||||
IDX_STATUS = 0xff36,
|
||||
IDX_STATUS_TIMER = 0xff37,
|
||||
IDX_STDOUT_FLAG = 0xff38,
|
||||
IDX_SPEED_ONLY = 0xff39,
|
||||
IDX_PROGRESS_ONLY = 0xff3a,
|
||||
IDX_TRUECRYPT_KEYFILES = 0xff3b,
|
||||
IDX_USERNAME = 0xff3c,
|
||||
IDX_VERACRYPT_KEYFILES = 0xff3d,
|
||||
IDX_VERACRYPT_PIM = 0xff3e,
|
||||
IDX_VERSION_LOWER = 'v',
|
||||
IDX_VERSION = 'V',
|
||||
IDX_WORKLOAD_PROFILE = 'w'
|
||||
IDX_ADVICE_DISABLE = 0xff00,
|
||||
IDX_ATTACK_MODE = 'a',
|
||||
IDX_BENCHMARK = 'b',
|
||||
IDX_BENCHMARK_ALL = 0xff01,
|
||||
IDX_BITMAP_MAX = 0xff02,
|
||||
IDX_BITMAP_MIN = 0xff03,
|
||||
IDX_CPU_AFFINITY = 0xff04,
|
||||
IDX_CUSTOM_CHARSET_1 = '1',
|
||||
IDX_CUSTOM_CHARSET_2 = '2',
|
||||
IDX_CUSTOM_CHARSET_3 = '3',
|
||||
IDX_CUSTOM_CHARSET_4 = '4',
|
||||
IDX_DEBUG_FILE = 0xff05,
|
||||
IDX_DEBUG_MODE = 0xff06,
|
||||
IDX_ENCODING_FROM = 0xff07,
|
||||
IDX_ENCODING_TO = 0xff08,
|
||||
IDX_EXAMPLE_HASHES = 0xff09,
|
||||
IDX_FORCE = 0xff0a,
|
||||
IDX_GPU_TEMP_ABORT = 0xff0b,
|
||||
IDX_GPU_TEMP_DISABLE = 0xff0c,
|
||||
IDX_HASH_MODE = 'm',
|
||||
IDX_HCCAPX_MESSAGE_PAIR = 0xff0d,
|
||||
IDX_HELP = 'h',
|
||||
IDX_HEX_CHARSET = 0xff0e,
|
||||
IDX_HEX_SALT = 0xff0f,
|
||||
IDX_HEX_WORDLIST = 0xff10,
|
||||
IDX_INCREMENT = 'i',
|
||||
IDX_INCREMENT_MAX = 0xff11,
|
||||
IDX_INCREMENT_MIN = 0xff12,
|
||||
IDX_INDUCTION_DIR = 0xff13,
|
||||
IDX_KEEP_GUESSING = 0xff14,
|
||||
IDX_KERNEL_ACCEL = 'n',
|
||||
IDX_KERNEL_LOOPS = 'u',
|
||||
IDX_KEYSPACE = 0xff15,
|
||||
IDX_LEFT = 0xff16,
|
||||
IDX_LIMIT = 'l',
|
||||
IDX_LOGFILE_DISABLE = 0xff17,
|
||||
IDX_LOOPBACK = 0xff18,
|
||||
IDX_MACHINE_READABLE = 0xff19,
|
||||
IDX_MARKOV_CLASSIC = 0xff1a,
|
||||
IDX_MARKOV_DISABLE = 0xff1b,
|
||||
IDX_MARKOV_HCSTAT = 0xff1c,
|
||||
IDX_MARKOV_THRESHOLD = 't',
|
||||
IDX_NONCE_ERROR_CORRECTIONS = 0xff1d,
|
||||
IDX_NVIDIA_SPIN_DAMP = 0xff1e,
|
||||
IDX_OPENCL_DEVICES = 'd',
|
||||
IDX_OPENCL_DEVICE_TYPES = 'D',
|
||||
IDX_OPENCL_INFO = 'I',
|
||||
IDX_OPENCL_PLATFORMS = 0xff1f,
|
||||
IDX_OPENCL_VECTOR_WIDTH = 0xff20,
|
||||
IDX_OPTIMIZED_KERNEL_ENABLE = 'O',
|
||||
IDX_OUTFILE_AUTOHEX_DISABLE = 0xff21,
|
||||
IDX_OUTFILE_CHECK_DIR = 0xff22,
|
||||
IDX_OUTFILE_CHECK_TIMER = 0xff23,
|
||||
IDX_OUTFILE_FORMAT = 0xff24,
|
||||
IDX_OUTFILE = 'o',
|
||||
IDX_WORDLIST_AUTOHEX_DISABLE = 0xff25,
|
||||
IDX_POTFILE_DISABLE = 0xff26,
|
||||
IDX_POTFILE_PATH = 0xff27,
|
||||
IDX_QUIET = 0xff28,
|
||||
IDX_REMOVE = 0xff29,
|
||||
IDX_REMOVE_TIMER = 0xff2a,
|
||||
IDX_RESTORE = 0xff2b,
|
||||
IDX_RESTORE_DISABLE = 0xff2c,
|
||||
IDX_RESTORE_FILE_PATH = 0xff2d,
|
||||
IDX_RP_FILE = 'r',
|
||||
IDX_RP_GEN_FUNC_MAX = 0xff2e,
|
||||
IDX_RP_GEN_FUNC_MIN = 0xff2f,
|
||||
IDX_RP_GEN = 'g',
|
||||
IDX_RP_GEN_SEED = 0xff30,
|
||||
IDX_RULE_BUF_L = 'j',
|
||||
IDX_RULE_BUF_R = 'k',
|
||||
IDX_RUNTIME = 0xff31,
|
||||
IDX_SCRYPT_TMTO = 0xff32,
|
||||
IDX_SELF_TEST_DISABLE = 0xff33,
|
||||
IDX_SEGMENT_SIZE = 'c',
|
||||
IDX_SEPARATOR = 'p',
|
||||
IDX_SESSION = 0xff34,
|
||||
IDX_SHOW = 0xff35,
|
||||
IDX_SKIP = 's',
|
||||
IDX_STATUS = 0xff36,
|
||||
IDX_STATUS_TIMER = 0xff37,
|
||||
IDX_STDOUT_FLAG = 0xff38,
|
||||
IDX_SPEED_ONLY = 0xff39,
|
||||
IDX_PROGRESS_ONLY = 0xff3a,
|
||||
IDX_TRUECRYPT_KEYFILES = 0xff3b,
|
||||
IDX_USERNAME = 0xff3c,
|
||||
IDX_VERACRYPT_KEYFILES = 0xff3d,
|
||||
IDX_VERACRYPT_PIM = 0xff3e,
|
||||
IDX_VERSION_LOWER = 'v',
|
||||
IDX_VERSION = 'V',
|
||||
IDX_WORKLOAD_PROFILE = 'w'
|
||||
|
||||
} user_options_map_t;
|
||||
|
||||
typedef enum token_attr
|
||||
{
|
||||
TOKEN_ATTR_SIGNATURE = 1 << 0,
|
||||
TOKEN_ATTR_FIXED_LENGTH = 1 << 1,
|
||||
TOKEN_ATTR_ENCODED_HEX = 1 << 2,
|
||||
TOKEN_ATTR_ENCODED_BASE64 = 1 << 3,
|
||||
TOKEN_ATTR_VERIFY_LENGTH = 1 << 4,
|
||||
TOKEN_ATTR_FIXED_LENGTH = 1 << 0,
|
||||
TOKEN_ATTR_VERIFY_SIGNATURE = 1 << 1,
|
||||
TOKEN_ATTR_VERIFY_LENGTH = 1 << 2,
|
||||
TOKEN_ATTR_VERIFY_DIGIT = 1 << 3,
|
||||
TOKEN_ATTR_VERIFY_HEX = 1 << 4,
|
||||
TOKEN_ATTR_VERIFY_BASE64 = 1 << 5,
|
||||
|
||||
} token_attr_t;
|
||||
|
||||
|
@ -260,6 +260,25 @@ bool is_valid_hex_char (const u8 c)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool is_valid_digit_string (const u8 *s, const size_t len)
|
||||
{
|
||||
for (size_t i = 0; i < len; i++)
|
||||
{
|
||||
const u8 c = s[i];
|
||||
|
||||
if (is_valid_digit_char (c) == false) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool is_valid_digit_char (const u8 c)
|
||||
{
|
||||
if ((c >= '0') && (c <= '9')) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
u8 hex_convert (const u8 c)
|
||||
{
|
||||
return (c & 15) + (c >> 6) * 9;
|
||||
|
487
src/interface.c
487
src/interface.c
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user