-
Notifications
You must be signed in to change notification settings - Fork 539
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add python bindings & binary emulation test for riscv 64/32
- Loading branch information
Showing
16 changed files
with
2,120 additions
and
24 deletions.
There are no files selected for viewing
Binary file added
BIN
+9.19 KB
src/examples/python/ctf-writeups/custom-crackmes/riscv32-hash/crackme_hash
Binary file not shown.
33 changes: 33 additions & 0 deletions
33
src/examples/python/ctf-writeups/custom-crackmes/riscv32-hash/crackme_hash.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
char *serial = "\x31\x3e\x3d\x26\x31"; | ||
|
||
int check(char *ptr) | ||
{ | ||
int i; | ||
int hash = 0xABCD; | ||
|
||
for (i = 0; ptr[i]; i++) | ||
hash += ptr[i] ^ serial[i % 5]; | ||
|
||
return hash; | ||
} | ||
|
||
int main(int ac, char **av) | ||
{ | ||
int ret; | ||
|
||
if (ac != 2) | ||
return -1; | ||
|
||
ret = check(av[1]); | ||
if (ret == 0xad6d) | ||
printf("Win\n"); | ||
else | ||
printf("fail\n"); | ||
|
||
return 0; | ||
} | ||
|
Oops, something went wrong.