feat: add custom b-type instruction (jump)

This commit is contained in:
2026-05-13 16:46:05 +02:00
parent afa59627a7
commit 6d8a808bd1
2 changed files with 17 additions and 4 deletions

View File

@@ -40,10 +40,11 @@ def mangle(value):
return (result, c_manglers)
def get_check_code(flag_part, user_part, c_mangler):
return f"""if(({flag_part}) != ({c_mangler(user_part)})){{
return false;
}}
"""
variations = [
f"custom_jmp_neq({flag_part} ^ 0x7C, {c_mangler(user_part)}, label_false);",
f"custom_jmp_neq({flag_part}, {c_mangler(user_part)} ^ 0x7C, label_false);"
]
return random.choice(variations)
def main():
if len(sys.argv) != 3:
@@ -105,6 +106,9 @@ bool check(char* userflag, uint8_t len) {{
{check}
return true;
label_false:
return false;
}}
""")