1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-28 19:08:19 +00:00

Add RULE_OP_MANGLE_TITLE_SEP_CLASS

This commit is contained in:
Gabriele Gristina 2024-11-03 01:53:00 +01:00
parent 53f57fb7ae
commit 25af3a1c73
8 changed files with 991 additions and 287 deletions

View File

@ -249,7 +249,7 @@ DECLSPEC int mangle_lrest (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, P
buf[idx] = t | generate_cmask (t);
}
return (len);
return len;
}
DECLSPEC int mangle_lrest_ufirst (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u32 *buf, const int len)
@ -265,7 +265,7 @@ DECLSPEC int mangle_lrest_ufirst (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u
buf[0] = t & ~(0x00000020 & generate_cmask (t));
return (len);
return len;
}
DECLSPEC int mangle_urest (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u32 *buf, const int len)
@ -277,7 +277,7 @@ DECLSPEC int mangle_urest (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, P
buf[idx] = t & ~(generate_cmask (t));
}
return (len);
return len;
}
DECLSPEC int mangle_urest_lfirst (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u32 *buf, const int len)
@ -293,7 +293,7 @@ DECLSPEC int mangle_urest_lfirst (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u
buf[0] = t | (0x00000020 & generate_cmask (t));
return (len);
return len;
}
DECLSPEC int mangle_trest (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u32 *buf, const int len)
@ -305,12 +305,12 @@ DECLSPEC int mangle_trest (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, P
buf[idx] = t ^ generate_cmask (t);
}
return (len);
return len;
}
DECLSPEC int mangle_toggle_at (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u32 *buf, const int len)
{
if (p0 >= len) return (len);
if (p0 >= len) return len;
const u8 p0d = p0 / 4;
const u8 p0m = p0 & 3;
@ -321,12 +321,12 @@ DECLSPEC int mangle_toggle_at (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p
buf[p0d] = t ^ (generate_cmask (t) & tmp);
return (len);
return len;
}
DECLSPEC int mangle_toggle_at_sep (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u32 *buf, const int len)
{
if (len >= RP_PASSWORD_SIZE) return (len);
if (len >= RP_PASSWORD_SIZE) return len;
u8 occurence = 0;
@ -350,7 +350,7 @@ DECLSPEC int mangle_toggle_at_sep (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const
buf[idx] = t ^ (generate_cmask (t) & out);
}
return (len);
return len;
}
DECLSPEC int mangle_reverse (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u32 *buf, const int len)
@ -362,25 +362,25 @@ DECLSPEC int mangle_reverse (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1,
exchange_byte (buf, l, r);
}
return (len);
return len;
}
DECLSPEC int mangle_dupeword (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u32 *buf, const int len)
{
const int out_len = len * 2;
if (out_len >= RP_PASSWORD_SIZE) return (len);
if (out_len >= RP_PASSWORD_SIZE) return len;
append_block (buf, 0, buf, len, len);
return (out_len);
return out_len;
}
DECLSPEC int mangle_dupeword_times (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u8 *buf, const int len)
{
const int out_len = (len * p0) + len;
if (out_len >= RP_PASSWORD_SIZE) return (len);
if (out_len >= RP_PASSWORD_SIZE) return len;
int out_pos = len;
@ -394,14 +394,14 @@ DECLSPEC int mangle_dupeword_times (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const
}
}
return (out_len);
return out_len;
}
DECLSPEC int mangle_reflect (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u32 *buf, const int len)
{
const int out_len = len * 2;
if (out_len >= RP_PASSWORD_SIZE) return (len);
if (out_len >= RP_PASSWORD_SIZE) return len;
append_block (buf, 0, buf, len, len);
@ -419,18 +419,18 @@ DECLSPEC int mangle_append (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1,
{
const int out_len = len + 1;
if (out_len >= RP_PASSWORD_SIZE) return (len);
if (out_len >= RP_PASSWORD_SIZE) return len;
buf[len] = p0;
return (out_len);
return out_len;
}
DECLSPEC int mangle_prepend (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u8 *buf, const int len)
{
const int out_len = len + 1;
if (out_len >= RP_PASSWORD_SIZE) return (len);
if (out_len >= RP_PASSWORD_SIZE) return len;
for (int pos = len - 1; pos >= 0; pos--)
{
@ -439,7 +439,7 @@ DECLSPEC int mangle_prepend (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1,
buf[0] = p0;
return (out_len);
return out_len;
}
DECLSPEC int mangle_rotate_left (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u32 *buf, const int len)
@ -449,7 +449,7 @@ DECLSPEC int mangle_rotate_left (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8
exchange_byte (buf, l, r);
}
return (len);
return len;
}
DECLSPEC int mangle_rotate_right (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u32 *buf, const int len)
@ -459,12 +459,12 @@ DECLSPEC int mangle_rotate_right (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u
exchange_byte (buf, l, r);
}
return (len);
return len;
}
DECLSPEC int mangle_delete_at (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u8 *buf, const int len)
{
if (p0 >= len) return (len);
if (p0 >= len) return len;
for (int pos = p0; pos < len - 1; pos++)
{
@ -490,9 +490,9 @@ DECLSPEC int mangle_delete_last (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8
DECLSPEC int mangle_extract (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u8 *buf, const int len)
{
if (p0 >= len) return (len);
if (p0 >= len) return len;
if ((p0 + p1) > len) return (len);
if ((p0 + p1) > len) return len;
for (int pos = 0; pos < p1; pos++)
{
@ -504,14 +504,14 @@ DECLSPEC int mangle_extract (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1,
buf[pos] = 0;
}
return (p1);
return p1;
}
DECLSPEC int mangle_omit (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u8 *buf, const int len)
{
if (p0 >= len) return (len);
if (p0 >= len) return len;
if ((p0 + p1) > len) return (len);
if ((p0 + p1) > len) return len;
for (int pos = p0; pos < len - p1; pos++)
{
@ -528,11 +528,11 @@ DECLSPEC int mangle_omit (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PR
DECLSPEC int mangle_insert (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u8 *buf, const int len)
{
if (p0 >= len + 1) return (len);
if (p0 >= len + 1) return len;
const int out_len = len + 1;
if (out_len >= RP_PASSWORD_SIZE) return (len);
if (out_len >= RP_PASSWORD_SIZE) return len;
for (int pos = len - 1; pos > p0 - 1; pos--)
{
@ -541,28 +541,28 @@ DECLSPEC int mangle_insert (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1,
buf[p0] = p1;
return (out_len);
return out_len;
}
DECLSPEC int mangle_overstrike (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u8 *buf, const int len)
{
if (p0 >= len) return (len);
if (p0 >= len) return len;
buf[p0] = p1;
return (len);
return len;
}
DECLSPEC int mangle_truncate_at (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u8 *buf, const int len)
{
if (p0 >= len) return (len);
if (p0 >= len) return len;
for (int pos = p0; pos < len; pos++)
{
buf[pos] = 0;
}
return (p0);
return p0;
}
DECLSPEC int mangle_replace (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u8 *buf, const int len)
@ -574,7 +574,7 @@ DECLSPEC int mangle_replace (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1,
buf[pos] = p1;
}
return (len);
return len;
}
DECLSPEC int mangle_replace_class_l (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u8 *buf, const int len)
@ -586,7 +586,7 @@ DECLSPEC int mangle_replace_class_l (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED cons
buf[pos] = p1;
}
return (len);
return len;
}
DECLSPEC int mangle_replace_class_u (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u8 *buf, const int len)
@ -598,7 +598,7 @@ DECLSPEC int mangle_replace_class_u (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED cons
buf[pos] = p1;
}
return (len);
return len;
}
DECLSPEC int mangle_replace_class_d (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u8 *buf, const int len)
@ -610,7 +610,7 @@ DECLSPEC int mangle_replace_class_d (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED cons
buf[pos] = p1;
}
return (len);
return len;
}
DECLSPEC int mangle_replace_class_lh (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u8 *buf, const int len)
@ -622,7 +622,7 @@ DECLSPEC int mangle_replace_class_lh (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED con
buf[pos] = p1;
}
return (len);
return len;
}
DECLSPEC int mangle_replace_class_uh (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u8 *buf, const int len)
@ -634,7 +634,7 @@ DECLSPEC int mangle_replace_class_uh (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED con
buf[pos] = p1;
}
return (len);
return len;
}
DECLSPEC int mangle_replace_class_s (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u8 *buf, const int len)
@ -646,7 +646,7 @@ DECLSPEC int mangle_replace_class_s (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED cons
buf[pos] = p1;
}
return (len);
return len;
}
DECLSPEC int mangle_replace_class (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u8 *buf, const int len)
@ -679,7 +679,7 @@ DECLSPEC int mangle_purgechar (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p
buf[pos] = 0;
}
return (out_len);
return out_len;
}
DECLSPEC int mangle_purgechar_class_l (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u8 *buf, const int len)
@ -700,7 +700,7 @@ DECLSPEC int mangle_purgechar_class_l (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED co
buf[pos] = 0;
}
return (out_len);
return out_len;
}
DECLSPEC int mangle_purgechar_class_u (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u8 *buf, const int len)
@ -721,7 +721,7 @@ DECLSPEC int mangle_purgechar_class_u (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED co
buf[pos] = 0;
}
return (out_len);
return out_len;
}
DECLSPEC int mangle_purgechar_class_d (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u8 *buf, const int len)
@ -742,7 +742,7 @@ DECLSPEC int mangle_purgechar_class_d (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED co
buf[pos] = 0;
}
return (out_len);
return out_len;
}
DECLSPEC int mangle_purgechar_class_lh (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u8 *buf, const int len)
@ -763,7 +763,7 @@ DECLSPEC int mangle_purgechar_class_lh (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED c
buf[pos] = 0;
}
return (out_len);
return out_len;
}
DECLSPEC int mangle_purgechar_class_uh (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u8 *buf, const int len)
@ -784,7 +784,7 @@ DECLSPEC int mangle_purgechar_class_uh (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED c
buf[pos] = 0;
}
return (out_len);
return out_len;
}
DECLSPEC int mangle_purgechar_class_s (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u8 *buf, const int len)
@ -805,7 +805,7 @@ DECLSPEC int mangle_purgechar_class_s (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED co
buf[pos] = 0;
}
return (out_len);
return out_len;
}
DECLSPEC int mangle_purgechar_class (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u8 *buf, const int len)
@ -824,8 +824,8 @@ DECLSPEC int mangle_dupechar_first (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const
{
const int out_len = len + p0;
if (len == 0) return (len);
if (out_len >= RP_PASSWORD_SIZE) return (len);
if (len == 0) return len;
if (out_len >= RP_PASSWORD_SIZE) return len;
const u8 c = buf[0];
@ -834,15 +834,15 @@ DECLSPEC int mangle_dupechar_first (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const
mangle_prepend (c, 0, buf, len + i);
}
return (out_len);
return out_len;
}
DECLSPEC int mangle_dupechar_last (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u8 *buf, const int len)
{
const int out_len = len + p0;
if (len == 0) return (len);
if (out_len >= RP_PASSWORD_SIZE) return (len);
if (len == 0) return len;
if (out_len >= RP_PASSWORD_SIZE) return len;
const u8 c = buf[len - 1];
@ -851,14 +851,14 @@ DECLSPEC int mangle_dupechar_last (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const
mangle_append (c, 0, buf, len + i);
}
return (out_len);
return out_len;
}
DECLSPEC int mangle_dupechar_all (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u8 *buf, const int len)
{
const int out_len = len + len;
if (out_len >= RP_PASSWORD_SIZE) return (len);
if (out_len >= RP_PASSWORD_SIZE) return len;
for (int pos = len - 1; pos >= 0; pos--)
{
@ -869,100 +869,100 @@ DECLSPEC int mangle_dupechar_all (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u
buf[new_pos + 1] = buf[pos];
}
return (out_len);
return out_len;
}
DECLSPEC int mangle_switch_first (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u32 *buf, const int len)
{
if (len < 2) return (len);
if (len < 2) return len;
exchange_byte (buf, 0, 1);
return (len);
return len;
}
DECLSPEC int mangle_switch_last (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u32 *buf, const int len)
{
if (len < 2) return (len);
if (len < 2) return len;
exchange_byte (buf, len - 2, len - 1);
return (len);
return len;
}
DECLSPEC int mangle_switch_at (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u32 *buf, const int len)
{
if (p0 >= len) return (len);
if (p1 >= len) return (len);
if (p0 >= len) return len;
if (p1 >= len) return len;
exchange_byte (buf, p0, p1);
return (len);
return len;
}
DECLSPEC int mangle_chr_shiftl (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u8 *buf, const int len)
{
if (p0 >= len) return (len);
if (p0 >= len) return len;
buf[p0] <<= 1;
return (len);
return len;
}
DECLSPEC int mangle_chr_shiftr (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u8 *buf, const int len)
{
if (p0 >= len) return (len);
if (p0 >= len) return len;
buf[p0] >>= 1;
return (len);
return len;
}
DECLSPEC int mangle_chr_incr (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u8 *buf, const int len)
{
if (p0 >= len) return (len);
if (p0 >= len) return len;
buf[p0]++;
return (len);
return len;
}
DECLSPEC int mangle_chr_decr (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u8 *buf, const int len)
{
if (p0 >= len) return (len);
if (p0 >= len) return len;
buf[p0]--;
return (len);
return len;
}
DECLSPEC int mangle_replace_np1 (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u8 *buf, const int len)
{
if ((p0 + 1) >= len) return (len);
if ((p0 + 1) >= len) return len;
buf[p0] = buf[p0 + 1];
return (len);
return len;
}
DECLSPEC int mangle_replace_nm1 (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u8 *buf, const int len)
{
if (p0 == 0) return (len);
if (p0 == 0) return len;
if (p0 >= len) return (len);
if (p0 >= len) return len;
buf[p0] = buf[p0 - 1];
return (len);
return len;
}
DECLSPEC int mangle_dupeblock_first (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u8 *buf, const int len)
{
if (p0 > len) return (len);
if (p0 > len) return len;
const int out_len = len + p0;
if (out_len >= RP_PASSWORD_SIZE) return (len);
if (out_len >= RP_PASSWORD_SIZE) return len;
for (int i = 0; i < p0; i++)
{
@ -971,16 +971,16 @@ DECLSPEC int mangle_dupeblock_first (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED cons
mangle_insert (i, c, buf, len + i);
}
return (out_len);
return out_len;
}
DECLSPEC int mangle_dupeblock_last (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u8 *buf, const int len)
{
if (p0 > len) return (len);
if (p0 > len) return len;
const int out_len = len + p0;
if (out_len >= RP_PASSWORD_SIZE) return (len);
if (out_len >= RP_PASSWORD_SIZE) return len;
for (int i = 0; i < p0; i++)
{
@ -989,12 +989,12 @@ DECLSPEC int mangle_dupeblock_last (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const
mangle_append (c, 0, buf, len + i);
}
return (out_len);
return out_len;
}
DECLSPEC int mangle_title_sep (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u32 *buf, const int len)
{
if (len >= RP_PASSWORD_SIZE) return (len);
if (len >= RP_PASSWORD_SIZE) return len;
u32 rem = 0xff;
@ -1016,7 +1016,181 @@ DECLSPEC int mangle_title_sep (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p
buf[idx] &= ~(generate_cmask (buf[idx]) & out);
}
return (len);
return len;
}
DECLSPEC int mangle_title_sep_class_l (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u32 *buf, const int len)
{
if (len >= RP_PASSWORD_SIZE) return len;
u32 rem = 0xff;
for (int i = 0, idx = 0; i < len; i += 4, idx += 1)
{
const u32 t = buf[idx];
buf[idx] = t | generate_cmask (t);
u32 out = rem;
rem = 0;
if (is_l ((t >> 0) & 0xff)) out |= 0x0000ff00;
if (is_l ((t >> 8) & 0xff)) out |= 0x00ff0000;
if (is_l ((t >> 16) & 0xff)) out |= 0xff000000;
if (is_l ((t >> 24) & 0xff)) rem |= 0x000000ff;
buf[idx] &= ~(generate_cmask (buf[idx]) & out);
}
return len;
}
DECLSPEC int mangle_title_sep_class_u (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u32 *buf, const int len)
{
if (len >= RP_PASSWORD_SIZE) return len;
u32 rem = 0xff;
for (int i = 0, idx = 0; i < len; i += 4, idx += 1)
{
const u32 t = buf[idx];
buf[idx] = t | generate_cmask (t);
u32 out = rem;
rem = 0;
if (is_u ((t >> 0) & 0xff)) out |= 0x0000ff00;
if (is_u ((t >> 8) & 0xff)) out |= 0x00ff0000;
if (is_u ((t >> 16) & 0xff)) out |= 0xff000000;
if (is_u ((t >> 24) & 0xff)) rem |= 0x000000ff;
buf[idx] &= ~(generate_cmask (buf[idx]) & out);
}
return len;
}
DECLSPEC int mangle_title_sep_class_d (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u32 *buf, const int len)
{
if (len >= RP_PASSWORD_SIZE) return len;
u32 rem = 0xff;
for (int i = 0, idx = 0; i < len; i += 4, idx += 1)
{
const u32 t = buf[idx];
buf[idx] = t | generate_cmask (t);
u32 out = rem;
rem = 0;
if (is_d ((t >> 0) & 0xff)) out |= 0x0000ff00;
if (is_d ((t >> 8) & 0xff)) out |= 0x00ff0000;
if (is_d ((t >> 16) & 0xff)) out |= 0xff000000;
if (is_d ((t >> 24) & 0xff)) rem |= 0x000000ff;
buf[idx] &= ~(generate_cmask (buf[idx]) & out);
}
return len;
}
DECLSPEC int mangle_title_sep_class_lh (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u32 *buf, const int len)
{
if (len >= RP_PASSWORD_SIZE) return len;
u32 rem = 0xff;
for (int i = 0, idx = 0; i < len; i += 4, idx += 1)
{
const u32 t = buf[idx];
buf[idx] = t | generate_cmask (t);
u32 out = rem;
rem = 0;
if (is_lh ((t >> 0) & 0xff)) out |= 0x0000ff00;
if (is_lh ((t >> 8) & 0xff)) out |= 0x00ff0000;
if (is_lh ((t >> 16) & 0xff)) out |= 0xff000000;
if (is_lh ((t >> 24) & 0xff)) rem |= 0x000000ff;
buf[idx] &= ~(generate_cmask (buf[idx]) & out);
}
return len;
}
DECLSPEC int mangle_title_sep_class_uh (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u32 *buf, const int len)
{
if (len >= RP_PASSWORD_SIZE) return len;
u32 rem = 0xff;
for (int i = 0, idx = 0; i < len; i += 4, idx += 1)
{
const u32 t = buf[idx];
buf[idx] = t | generate_cmask (t);
u32 out = rem;
rem = 0;
if (is_uh ((t >> 0) & 0xff)) out |= 0x0000ff00;
if (is_uh ((t >> 8) & 0xff)) out |= 0x00ff0000;
if (is_uh ((t >> 16) & 0xff)) out |= 0xff000000;
if (is_uh ((t >> 24) & 0xff)) rem |= 0x000000ff;
buf[idx] &= ~(generate_cmask (buf[idx]) & out);
}
return len;
}
DECLSPEC int mangle_title_sep_class_s (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u32 *buf, const int len)
{
if (len >= RP_PASSWORD_SIZE) return len;
u32 rem = 0xff;
for (int i = 0, idx = 0; i < len; i += 4, idx += 1)
{
const u32 t = buf[idx];
buf[idx] = t | generate_cmask (t);
u32 out = rem;
rem = 0;
if (is_s ((t >> 0) & 0xff)) out |= 0x0000ff00;
if (is_s ((t >> 8) & 0xff)) out |= 0x00ff0000;
if (is_s ((t >> 16) & 0xff)) out |= 0xff000000;
if (is_s ((t >> 24) & 0xff)) rem |= 0x000000ff;
buf[idx] &= ~(generate_cmask (buf[idx]) & out);
}
return len;
}
DECLSPEC int mangle_title_sep_class (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u32 *buf, const int len)
{
if (p0 == 'l') return mangle_title_sep_class_l (p0, p1, buf, len);
else if (p0 == 'u') return mangle_title_sep_class_u (p0, p1, buf, len);
else if (p0 == 'd') return mangle_title_sep_class_d (p0, p1, buf, len);
else if (p0 == 'h') return mangle_title_sep_class_lh (p0, p1, buf, len);
else if (p0 == 'H') return mangle_title_sep_class_uh (p0, p1, buf, len);
else if (p0 == 's') return mangle_title_sep_class_s (p0, p1, buf, len);
return len;
}
DECLSPEC int apply_rule (const u32 name, MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u32 *buf, const int in_len)
@ -1067,6 +1241,7 @@ DECLSPEC int apply_rule (const u32 name, MAYBE_UNUSED const u8 p0, MAYBE_UNUSED
case RULE_OP_MANGLE_DUPEBLOCK_FIRST: out_len = mangle_dupeblock_first (p0, p1, (PRIVATE_AS u8 *) buf, out_len); break;
case RULE_OP_MANGLE_DUPEBLOCK_LAST: out_len = mangle_dupeblock_last (p0, p1, (PRIVATE_AS u8 *) buf, out_len); break;
case RULE_OP_MANGLE_TITLE_SEP: out_len = mangle_title_sep (p0, p1, buf, out_len); break;
case RULE_OP_MANGLE_TITLE_SEP_CLASS: out_len = mangle_title_sep_class (p0, p1, buf, out_len); break;
case RULE_OP_MANGLE_TITLE: out_len = mangle_title_sep (' ', p1, buf, out_len); break;
}

View File

@ -72,12 +72,13 @@
/* using character classes */
#define RULE_OP_MANGLE_REPLACE_CLASS 0x01
#define RULE_OP_MANGLE_PURGECHAR_CLASS 0x02
#define RULE_OP_REJECT_CONTAIN_CLASS 0x03
#define RULE_OP_REJECT_NOT_CONTAIN_CLASS 0x04
#define RULE_OP_REJECT_EQUAL_FIRST_CLASS 0x05
#define RULE_OP_REJECT_EQUAL_LAST_CLASS 0x06
#define RULE_OP_REJECT_EQUAL_AT_CLASS 0x07
#define RULE_OP_REJECT_CONTAINS_CLASS 0x08
#define RULE_OP_MANGLE_TITLE_SEP_CLASS 0x03
#define RULE_OP_REJECT_CONTAIN_CLASS 0x04
#define RULE_OP_REJECT_NOT_CONTAIN_CLASS 0x05
#define RULE_OP_REJECT_EQUAL_FIRST_CLASS 0x06
#define RULE_OP_REJECT_EQUAL_LAST_CLASS 0x07
#define RULE_OP_REJECT_EQUAL_AT_CLASS 0x08
#define RULE_OP_REJECT_CONTAINS_CLASS 0x09
#define RP_PASSWORD_SIZE 256
@ -131,6 +132,7 @@ DECLSPEC int mangle_replace_nm1 (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8
DECLSPEC int mangle_dupeblock_first (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u8 *buf, const int len);
DECLSPEC int mangle_dupeblock_last (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u8 *buf, const int len);
DECLSPEC int mangle_title_sep (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u32 *buf, const int len);
DECLSPEC int mangle_title_sep_class (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u32 *buf, const int len);
DECLSPEC int apply_rule (const u32 name, MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, PRIVATE_AS u32 *buf, const int in_len);
DECLSPEC int apply_rules (CONSTANT_AS const u32 *cmds, PRIVATE_AS u32 *buf, const int in_len);

View File

@ -1215,7 +1215,7 @@ DECLSPEC HC_INLINE_RP u32 rule_op_mangle_toggle_at (MAYBE_UNUSED const u32 p0, M
buf1[2] = t[6];
buf1[3] = t[7];
return (in_len);
return in_len;
}
DECLSPEC HC_INLINE_RP u32 rule_op_mangle_toggle_at_sep (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED PRIVATE_AS u32 *buf0, MAYBE_UNUSED PRIVATE_AS u32 *buf1, const u32 in_len)
@ -2914,6 +2914,324 @@ DECLSPEC HC_INLINE_RP u32 rule_op_mangle_title_sep (MAYBE_UNUSED const u32 p0, M
return in_len;
}
DECLSPEC HC_INLINE_RP u32 rule_op_mangle_title_sep_class_l (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED PRIVATE_AS u32 *buf0, MAYBE_UNUSED PRIVATE_AS u32 *buf1, const u32 in_len)
{
if (in_len == 0) return in_len;
u32 buf_in[8];
buf_in[0] = buf0[0];
buf_in[1] = buf0[1];
buf_in[2] = buf0[2];
buf_in[3] = buf0[3];
buf_in[4] = buf1[0];
buf_in[5] = buf1[1];
buf_in[6] = buf1[2];
buf_in[7] = buf1[3];
u32 rem = 0xff;
u32 rn = 0;
for (u32 i = 0, idx = 0; i < in_len; i += 4, idx += 1)
{
const u32 t = buf_in[idx];
buf_in[idx] = t | generate_cmask_optimized (t);
u32 out = rem;
rem = 0;
if (is_l ((t >> 0) & 0xff)) { rn++; out |= 0x0000ff00; }
if (is_l ((t >> 8) & 0xff)) { rn++; out |= 0x00ff0000; }
if (is_l ((t >> 16) & 0xff)) { rn++; out |= 0xff000000; }
if (is_l ((t >> 24) & 0xff)) { rn++; rem |= 0x000000ff; }
buf_in[idx] &= ~(generate_cmask_optimized (buf_in[idx]) & out);
}
if (rn == 0) return in_len;
buf0[0] = buf_in[0];
buf0[1] = buf_in[1];
buf0[2] = buf_in[2];
buf0[3] = buf_in[3];
buf1[0] = buf_in[4];
buf1[1] = buf_in[5];
buf1[2] = buf_in[6];
buf1[3] = buf_in[7];
return in_len;
}
DECLSPEC HC_INLINE_RP u32 rule_op_mangle_title_sep_class_u (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED PRIVATE_AS u32 *buf0, MAYBE_UNUSED PRIVATE_AS u32 *buf1, const u32 in_len)
{
if (in_len == 0) return in_len;
u32 buf_in[8];
buf_in[0] = buf0[0];
buf_in[1] = buf0[1];
buf_in[2] = buf0[2];
buf_in[3] = buf0[3];
buf_in[4] = buf1[0];
buf_in[5] = buf1[1];
buf_in[6] = buf1[2];
buf_in[7] = buf1[3];
u32 rem = 0xff;
u32 rn = 0;
for (u32 i = 0, idx = 0; i < in_len; i += 4, idx += 1)
{
const u32 t = buf_in[idx];
buf_in[idx] = t | generate_cmask_optimized (t);
u32 out = rem;
rem = 0;
if (is_u ((t >> 0) & 0xff)) { rn++; out |= 0x0000ff00; }
if (is_u ((t >> 8) & 0xff)) { rn++; out |= 0x00ff0000; }
if (is_u ((t >> 16) & 0xff)) { rn++; out |= 0xff000000; }
if (is_u ((t >> 24) & 0xff)) { rn++; rem |= 0x000000ff; }
buf_in[idx] &= ~(generate_cmask_optimized (buf_in[idx]) & out);
}
if (rn == 0) return in_len;
buf0[0] = buf_in[0];
buf0[1] = buf_in[1];
buf0[2] = buf_in[2];
buf0[3] = buf_in[3];
buf1[0] = buf_in[4];
buf1[1] = buf_in[5];
buf1[2] = buf_in[6];
buf1[3] = buf_in[7];
return in_len;
}
DECLSPEC HC_INLINE_RP u32 rule_op_mangle_title_sep_class_d (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED PRIVATE_AS u32 *buf0, MAYBE_UNUSED PRIVATE_AS u32 *buf1, const u32 in_len)
{
if (in_len == 0) return in_len;
u32 buf_in[8];
buf_in[0] = buf0[0];
buf_in[1] = buf0[1];
buf_in[2] = buf0[2];
buf_in[3] = buf0[3];
buf_in[4] = buf1[0];
buf_in[5] = buf1[1];
buf_in[6] = buf1[2];
buf_in[7] = buf1[3];
u32 rem = 0xff;
u32 rn = 0;
for (u32 i = 0, idx = 0; i < in_len; i += 4, idx += 1)
{
const u32 t = buf_in[idx];
buf_in[idx] = t | generate_cmask_optimized (t);
u32 out = rem;
rem = 0;
if (is_d ((t >> 0) & 0xff)) { rn++; out |= 0x0000ff00; }
if (is_d ((t >> 8) & 0xff)) { rn++; out |= 0x00ff0000; }
if (is_d ((t >> 16) & 0xff)) { rn++; out |= 0xff000000; }
if (is_d ((t >> 24) & 0xff)) { rn++; rem |= 0x000000ff; }
buf_in[idx] &= ~(generate_cmask_optimized (buf_in[idx]) & out);
}
if (rn == 0) return in_len;
buf0[0] = buf_in[0];
buf0[1] = buf_in[1];
buf0[2] = buf_in[2];
buf0[3] = buf_in[3];
buf1[0] = buf_in[4];
buf1[1] = buf_in[5];
buf1[2] = buf_in[6];
buf1[3] = buf_in[7];
return in_len;
}
DECLSPEC HC_INLINE_RP u32 rule_op_mangle_title_sep_class_lh (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED PRIVATE_AS u32 *buf0, MAYBE_UNUSED PRIVATE_AS u32 *buf1, const u32 in_len)
{
if (in_len == 0) return in_len;
u32 buf_in[8];
buf_in[0] = buf0[0];
buf_in[1] = buf0[1];
buf_in[2] = buf0[2];
buf_in[3] = buf0[3];
buf_in[4] = buf1[0];
buf_in[5] = buf1[1];
buf_in[6] = buf1[2];
buf_in[7] = buf1[3];
u32 rem = 0xff;
u32 rn = 0;
for (u32 i = 0, idx = 0; i < in_len; i += 4, idx += 1)
{
const u32 t = buf_in[idx];
buf_in[idx] = t | generate_cmask_optimized (t);
u32 out = rem;
rem = 0;
if (is_lh ((t >> 0) & 0xff)) { rn++; out |= 0x0000ff00; }
if (is_lh ((t >> 8) & 0xff)) { rn++; out |= 0x00ff0000; }
if (is_lh ((t >> 16) & 0xff)) { rn++; out |= 0xff000000; }
if (is_lh ((t >> 24) & 0xff)) { rn++; rem |= 0x000000ff; }
buf_in[idx] &= ~(generate_cmask_optimized (buf_in[idx]) & out);
}
if (rn == 0) return in_len;
buf0[0] = buf_in[0];
buf0[1] = buf_in[1];
buf0[2] = buf_in[2];
buf0[3] = buf_in[3];
buf1[0] = buf_in[4];
buf1[1] = buf_in[5];
buf1[2] = buf_in[6];
buf1[3] = buf_in[7];
return in_len;
}
DECLSPEC HC_INLINE_RP u32 rule_op_mangle_title_sep_class_uh (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED PRIVATE_AS u32 *buf0, MAYBE_UNUSED PRIVATE_AS u32 *buf1, const u32 in_len)
{
if (in_len == 0) return in_len;
u32 buf_in[8];
buf_in[0] = buf0[0];
buf_in[1] = buf0[1];
buf_in[2] = buf0[2];
buf_in[3] = buf0[3];
buf_in[4] = buf1[0];
buf_in[5] = buf1[1];
buf_in[6] = buf1[2];
buf_in[7] = buf1[3];
u32 rem = 0xff;
u32 rn = 0;
for (u32 i = 0, idx = 0; i < in_len; i += 4, idx += 1)
{
const u32 t = buf_in[idx];
buf_in[idx] = t | generate_cmask_optimized (t);
u32 out = rem;
rem = 0;
if (is_uh ((t >> 0) & 0xff)) { rn++; out |= 0x0000ff00; }
if (is_uh ((t >> 8) & 0xff)) { rn++; out |= 0x00ff0000; }
if (is_uh ((t >> 16) & 0xff)) { rn++; out |= 0xff000000; }
if (is_uh ((t >> 24) & 0xff)) { rn++; rem |= 0x000000ff; }
buf_in[idx] &= ~(generate_cmask_optimized (buf_in[idx]) & out);
}
if (rn == 0) return in_len;
buf0[0] = buf_in[0];
buf0[1] = buf_in[1];
buf0[2] = buf_in[2];
buf0[3] = buf_in[3];
buf1[0] = buf_in[4];
buf1[1] = buf_in[5];
buf1[2] = buf_in[6];
buf1[3] = buf_in[7];
return in_len;
}
DECLSPEC HC_INLINE_RP u32 rule_op_mangle_title_sep_class_s (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED PRIVATE_AS u32 *buf0, MAYBE_UNUSED PRIVATE_AS u32 *buf1, const u32 in_len)
{
if (in_len == 0) return in_len;
u32 buf_in[8];
buf_in[0] = buf0[0];
buf_in[1] = buf0[1];
buf_in[2] = buf0[2];
buf_in[3] = buf0[3];
buf_in[4] = buf1[0];
buf_in[5] = buf1[1];
buf_in[6] = buf1[2];
buf_in[7] = buf1[3];
u32 rem = 0xff;
u32 rn = 0;
for (u32 i = 0, idx = 0; i < in_len; i += 4, idx += 1)
{
const u32 t = buf_in[idx];
buf_in[idx] = t | generate_cmask_optimized (t);
u32 out = rem;
rem = 0;
if (is_s ((t >> 0) & 0xff)) { rn++; out |= 0x0000ff00; }
if (is_s ((t >> 8) & 0xff)) { rn++; out |= 0x00ff0000; }
if (is_s ((t >> 16) & 0xff)) { rn++; out |= 0xff000000; }
if (is_s ((t >> 24) & 0xff)) { rn++; rem |= 0x000000ff; }
buf_in[idx] &= ~(generate_cmask_optimized (buf_in[idx]) & out);
}
if (rn == 0) return in_len;
buf0[0] = buf_in[0];
buf0[1] = buf_in[1];
buf0[2] = buf_in[2];
buf0[3] = buf_in[3];
buf1[0] = buf_in[4];
buf1[1] = buf_in[5];
buf1[2] = buf_in[6];
buf1[3] = buf_in[7];
return in_len;
}
DECLSPEC HC_INLINE_RP u32 rule_op_mangle_title_sep_class (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED PRIVATE_AS u32 *buf0, MAYBE_UNUSED PRIVATE_AS u32 *buf1, const u32 in_len)
{
if ((u8)p0 == 'l') return rule_op_mangle_title_sep_class_l (p0, p1, buf0, buf1, in_len);
else if ((u8)p0 == 'u') return rule_op_mangle_title_sep_class_u (p0, p1, buf0, buf1, in_len);
else if ((u8)p0 == 'd') return rule_op_mangle_title_sep_class_d (p0, p1, buf0, buf1, in_len);
else if ((u8)p0 == 'h') return rule_op_mangle_title_sep_class_lh (p0, p1, buf0, buf1, in_len);
else if ((u8)p0 == 'H') return rule_op_mangle_title_sep_class_uh (p0, p1, buf0, buf1, in_len);
else if ((u8)p0 == 's') return rule_op_mangle_title_sep_class_s (p0, p1, buf0, buf1, in_len);
return in_len;
}
DECLSPEC u32 apply_rule_optimized (const u32 name, const u32 p0, const u32 p1, PRIVATE_AS u32 *buf0, PRIVATE_AS u32 *buf1, const u32 in_len)
{
u32 out_len = in_len;
@ -2963,6 +3281,7 @@ DECLSPEC u32 apply_rule_optimized (const u32 name, const u32 p0, const u32 p1, P
case RULE_OP_MANGLE_DUPEBLOCK_FIRST: out_len = rule_op_mangle_dupeblock_first (p0, p1, buf0, buf1, out_len); break;
case RULE_OP_MANGLE_DUPEBLOCK_LAST: out_len = rule_op_mangle_dupeblock_last (p0, p1, buf0, buf1, out_len); break;
case RULE_OP_MANGLE_TITLE_SEP: out_len = rule_op_mangle_title_sep (p0, p1, buf0, buf1, out_len); break;
case RULE_OP_MANGLE_TITLE_SEP_CLASS: out_len = rule_op_mangle_title_sep_class (p0, p1, buf0, buf1, out_len); break;
case RULE_OP_MANGLE_TITLE: out_len = rule_op_mangle_title_sep (' ', p1, buf0, buf1, out_len); break;
}

View File

@ -78,12 +78,13 @@
/* using character classes */
#define RULE_OP_MANGLE_REPLACE_CLASS 0x01
#define RULE_OP_MANGLE_PURGECHAR_CLASS 0x02
#define RULE_OP_REJECT_CONTAIN_CLASS 0x03
#define RULE_OP_REJECT_NOT_CONTAIN_CLASS 0x04
#define RULE_OP_REJECT_EQUAL_FIRST_CLASS 0x05
#define RULE_OP_REJECT_EQUAL_LAST_CLASS 0x06
#define RULE_OP_REJECT_EQUAL_AT_CLASS 0x07
#define RULE_OP_REJECT_CONTAINS_CLASS 0x08
#define RULE_OP_MANGLE_TITLE_SEP_CLASS 0x03
#define RULE_OP_REJECT_CONTAIN_CLASS 0x04
#define RULE_OP_REJECT_NOT_CONTAIN_CLASS 0x05
#define RULE_OP_REJECT_EQUAL_FIRST_CLASS 0x06
#define RULE_OP_REJECT_EQUAL_LAST_CLASS 0x07
#define RULE_OP_REJECT_EQUAL_AT_CLASS 0x08
#define RULE_OP_REJECT_CONTAINS_CLASS 0x09
DECLSPEC u32 generate_cmask_optimized (const u32 value);
DECLSPEC void truncate_right_optimized (PRIVATE_AS u32 *buf0, PRIVATE_AS u32 *buf1, const u32 offset);
@ -141,6 +142,7 @@ DECLSPEC HC_INLINE_RP u32 rule_op_mangle_dupeblock_first (MAYBE_UNUSED const u32
DECLSPEC HC_INLINE_RP u32 rule_op_mangle_dupeblock_last (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED PRIVATE_AS u32 *buf0, MAYBE_UNUSED PRIVATE_AS u32 *buf1, const u32 in_len);
DECLSPEC u32 toggle_on_register (const u32 in, const u32 r);
DECLSPEC HC_INLINE_RP u32 rule_op_mangle_title_sep (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED PRIVATE_AS u32 *buf0, MAYBE_UNUSED PRIVATE_AS u32 *buf1, const u32 in_len);
DECLSPEC HC_INLINE_RP u32 rule_op_mangle_title_sep_class (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED PRIVATE_AS u32 *buf0, MAYBE_UNUSED PRIVATE_AS u32 *buf1, const u32 in_len);
DECLSPEC u32 apply_rule_optimized (const u32 name, const u32 p0, const u32 p1, PRIVATE_AS u32 *buf0, PRIVATE_AS u32 *buf1, const u32 in_len);
DECLSPEC u32 apply_rules_optimized (CONSTANT_AS const u32 *cmds, PRIVATE_AS u32 *buf0, PRIVATE_AS u32 *buf1, const u32 len);
DECLSPEC u32x apply_rules_vect_optimized (PRIVATE_AS const u32 *pw_buf0, PRIVATE_AS const u32 *pw_buf1, const u32 pw_len, CONSTANT_AS const kernel_rule_t *kernel_rules, const u32 il_pos, PRIVATE_AS u32x *buf0, PRIVATE_AS u32x *buf1);

View File

@ -65,12 +65,13 @@
#define RULE_OP_CLASS_BASED '~'
#define RULE_OP_MANGLE_REPLACE_CLASS 0x01 // replace all instances of chars in class C with char Y, ~s?CY
#define RULE_OP_MANGLE_PURGECHAR_CLASS 0x02 // purge all instances of chars in class C, ~@?C
#define RULE_OP_MANGLE_TITLE_SEP_CLASS 0x03 // lowercase everything then upper case the first letter and every letter after chars in class C, ~e?C
/* using character classes, with -j or -k only */
#define RULE_OP_REJECT_CONTAIN_CLASS 0x03 // reject plains that contain chars in class C, ~!?C
#define RULE_OP_REJECT_NOT_CONTAIN_CLASS 0x04 // reject plains that do not contain chars in class C, ~/?C
#define RULE_OP_REJECT_EQUAL_FIRST_CLASS 0x05 // reject plains that do not contain char in class C at first pos, ~(?C
#define RULE_OP_REJECT_EQUAL_LAST_CLASS 0x06 // reject plains that do not contain char in class C at last pos, ~)?C
#define RULE_OP_REJECT_EQUAL_AT_CLASS 0x07 // reject plains that do not contain char in class C at pos N, ~=N?C
#define RULE_OP_REJECT_CONTAINS_CLASS 0x08 // reject plains that contain char in class C less than N times, ~%N?C
#define RULE_OP_REJECT_CONTAIN_CLASS 0x04 // reject plains that contain chars in class C, ~!?C
#define RULE_OP_REJECT_NOT_CONTAIN_CLASS 0x05 // reject plains that do not contain chars in class C, ~/?C
#define RULE_OP_REJECT_EQUAL_FIRST_CLASS 0x06 // reject plains that do not contain chars in class C at first pos, ~(?C
#define RULE_OP_REJECT_EQUAL_LAST_CLASS 0x07 // reject plains that do not contain chars in class C at last pos, ~)?C
#define RULE_OP_REJECT_EQUAL_AT_CLASS 0x08 // reject plains that do not contain chars in class C at pos N, ~=N?C
#define RULE_OP_REJECT_CONTAINS_CLASS 0x09 // reject plains that contain chars in class C less than N times, ~%N?C

View File

@ -371,12 +371,13 @@ typedef enum rule_functions
RULE_OP_CLASS_BASED = '~',
RULE_OP_MANGLE_REPLACE_CLASS = 0x01,
RULE_OP_MANGLE_PURGECHAR_CLASS = 0x02,
RULE_OP_REJECT_CONTAIN_CLASS = 0x03,
RULE_OP_REJECT_NOT_CONTAIN_CLASS = 0x04,
RULE_OP_REJECT_EQUAL_FIRST_CLASS = 0x05,
RULE_OP_REJECT_EQUAL_LAST_CLASS = 0x06,
RULE_OP_REJECT_EQUAL_AT_CLASS = 0x07,
RULE_OP_REJECT_CONTAINS_CLASS = 0x08,
RULE_OP_MANGLE_TITLE_SEP_CLASS = 0x03,
RULE_OP_REJECT_CONTAIN_CLASS = 0x04,
RULE_OP_REJECT_NOT_CONTAIN_CLASS = 0x05,
RULE_OP_REJECT_EQUAL_FIRST_CLASS = 0x06,
RULE_OP_REJECT_EQUAL_LAST_CLASS = 0x07,
RULE_OP_REJECT_EQUAL_AT_CLASS = 0x08,
RULE_OP_REJECT_CONTAINS_CLASS = 0x09,
} rule_functions_t;

View File

@ -232,7 +232,7 @@ int generate_random_rule (char rule_buf[RP_RULE_SIZE], const u32 rp_gen_func_min
}
}
return (rule_pos);
return rule_pos;
}
#define INCR_POS if (++rule_pos == rule_len) return (-1)
@ -488,12 +488,21 @@ int cpu_rule_to_kernel_rule (char *rule_buf, u32 rule_len, kernel_rule_t *rule)
SET_P0 (rule, rule_buf[rule_pos]);
SET_P1 (rule, rule_buf[rule_pos]);
break;
case RULE_OP_MANGLE_PURGECHAR: // ~@?C
SET_NAME (rule, RULE_OP_MANGLE_PURGECHAR_CLASS);
INCR_POS;
INCR_POS;
SET_P0 (rule, rule_buf[rule_pos]);
break;
case RULE_OP_MANGLE_TITLE_SEP: // ~e?C
SET_NAME (rule, RULE_OP_MANGLE_TITLE_SEP_CLASS);
INCR_POS;
INCR_POS;
SET_P0 (rule, rule_buf[rule_pos]);
break;
/*
case '!': // ~!?C
SET_NAME (rule, RULE_OP_REJECT_CONTAIN_CLASS);
@ -784,6 +793,13 @@ int kernel_rule_to_cpu_rule (char *rule_buf, kernel_rule_t *rule)
GET_P0 (rule);
break;
case RULE_OP_MANGLE_TITLE_SEP_CLASS:
rule_buf[rule_pos++] = RULE_OP_CLASS_BASED;
rule_buf[rule_pos++] = RULE_OP_MANGLE_TITLE_SEP;
rule_buf[rule_pos] = '?';
GET_P0 (rule);
break;
case 0:
if (rule_pos == 0) return -1;
return rule_pos - 1;

File diff suppressed because it is too large Load Diff