-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Shamore #25177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shamore #25177
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| /* radare - LGPL - Copyright 2024-2026 - pancake */ | ||
|
|
||
| #include <r_muta.h> | ||
|
|
||
| static bool update(RMutaSession *cj, const ut8 *buf, int len) { | ||
| RHash *ctx = r_hash_new (true, R_HASH_SHA384); | ||
| if (R_LIKELY (ctx)) { | ||
| r_hash_do_begin (ctx, R_HASH_SHA384); | ||
| r_hash_do_sha384 (ctx, buf, len); | ||
| r_hash_do_end (ctx, R_HASH_SHA384); | ||
| r_muta_session_append (cj, ctx->digest, R_HASH_SIZE_SHA384); | ||
| r_hash_free (ctx); | ||
| return true; | ||
| } | ||
| return false; | ||
|
trufae marked this conversation as resolved.
|
||
| } | ||
|
|
||
| RMutaPlugin r_muta_plugin_sha384 = { | ||
| .meta = { | ||
| .name = "sha384", | ||
| .desc = "SHA384 hash", | ||
| .author = "pancake", | ||
| .license = "MIT", | ||
| }, | ||
| .type = R_MUTA_TYPE_HASH, | ||
| .implements = "sha384", | ||
| .update = update, | ||
| .end = update | ||
| }; | ||
|
|
||
| #ifndef R2_PLUGIN_INCORE | ||
| R_API RLibStruct radare_plugin = { | ||
| .type = R_LIB_TYPE_CRYPTO, | ||
| .data = &r_muta_plugin_sha384, | ||
| .version = R2_VERSION | ||
| }; | ||
| #endif | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| /* radare - LGPL - Copyright 2024-2026 - pancake */ | ||
|
|
||
| #include <r_lib.h> | ||
| #include <r_muta.h> | ||
| #include <r_hash.h> | ||
|
|
||
| static bool update(RMutaSession *cj, const ut8 *buf, int len) { | ||
| RHash *ctx = r_hash_new (true, R_HASH_SHA512); | ||
| if (!ctx) { | ||
| return false; | ||
| } | ||
| r_hash_do_begin (ctx, R_HASH_SHA512); | ||
| r_hash_do_sha512 (ctx, buf, len); | ||
| r_hash_do_end (ctx, R_HASH_SHA512); | ||
| r_muta_session_append (cj, ctx->digest, R_HASH_SIZE_SHA512); | ||
| r_hash_free (ctx); | ||
| return true; | ||
| } | ||
|
|
||
| RMutaPlugin r_muta_plugin_sha512 = { | ||
| .meta = { | ||
| .name = "sha512", | ||
| .desc = "SHA512 hash", | ||
| .author = "pancake", | ||
| .license = "MIT", | ||
| }, | ||
| .type = R_MUTA_TYPE_HASH, | ||
| .implements = "sha512", | ||
| .update = update, | ||
| .end = update | ||
| }; | ||
|
|
||
| #ifndef R2_PLUGIN_INCORE | ||
| R_API RLibStruct radare_plugin = { | ||
| .type = R_LIB_TYPE_CRYPTO, | ||
| .data = &r_muta_plugin_sha512, | ||
| .version = R2_VERSION | ||
| }; | ||
| #endif |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,15 @@ | ||||||||||||||||||||||||||
| OBJ_SHA384=muta_sha384.o | ||||||||||||||||||||||||||
| SRC_SHA384=muta_sha384.c | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| STATIC_OBJ+=${OBJ_SHA384} | ||||||||||||||||||||||||||
| SHARED_SHA384=$(SHLIBDIR)$(LDFLAGS) $(LIBOBJ) | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| TARGET_SHA384=muta_sha384.${EXT_SO} | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| all: $(TARGET_SHA384) | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| $(TARGET_SHA384): $(OBJ_SHA384) | ||||||||||||||||||||||||||
| $(CC) $(call libname,muta_sha384) ${LDFLAGS} ${CFLAGS} -o ${TARGET_SHA384} ${OBJ_SHA384} | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| clean:: | ||||||||||||||||||||||||||
| rm -f *.o *.${EXT_SO} *.a | ||||||||||||||||||||||||||
|
Comment on lines
+5
to
+15
|
||||||||||||||||||||||||||
| SHARED_SHA384=$(SHLIBDIR)$(LDFLAGS) $(LIBOBJ) | |
| TARGET_SHA384=muta_sha384.${EXT_SO} | |
| all: $(TARGET_SHA384) | |
| $(TARGET_SHA384): $(OBJ_SHA384) | |
| $(CC) $(call libname,muta_sha384) ${LDFLAGS} ${CFLAGS} -o ${TARGET_SHA384} ${OBJ_SHA384} | |
| clean:: | |
| rm -f *.o *.${EXT_SO} *.a | |
| ALL_TARGETS+=muta_sha384.${EXT_SO} |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,15 @@ | ||||||||||||||||||||||||||||||||||||||||||||||
| OBJ_SHA512=muta_sha512.o | ||||||||||||||||||||||||||||||||||||||||||||||
| SRC_SHA512=muta_sha512.c | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| STATIC_OBJ+=${OBJ_SHA512} | ||||||||||||||||||||||||||||||||||||||||||||||
| SHARED_SHA512=$(SHLIBDIR)$(LDFLAGS) $(LIBOBJ) | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| TARGET_SHA512=muta_sha512.${EXT_SO} | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| all: $(TARGET_SHA512) | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| $(TARGET_SHA512): $(OBJ_SHA512) | ||||||||||||||||||||||||||||||||||||||||||||||
| $(CC) $(call libname,muta_sha512) ${LDFLAGS} ${CFLAGS} -o ${TARGET_SHA512} ${OBJ_SHA512} | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| clean:: | ||||||||||||||||||||||||||||||||||||||||||||||
| rm -f *.o *.${EXT_SO} *.a | ||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+2
to
+15
|
||||||||||||||||||||||||||||||||||||||||||||||
| SRC_SHA512=muta_sha512.c | |
| STATIC_OBJ+=${OBJ_SHA512} | |
| SHARED_SHA512=$(SHLIBDIR)$(LDFLAGS) $(LIBOBJ) | |
| TARGET_SHA512=muta_sha512.${EXT_SO} | |
| all: $(TARGET_SHA512) | |
| $(TARGET_SHA512): $(OBJ_SHA512) | |
| $(CC) $(call libname,muta_sha512) ${LDFLAGS} ${CFLAGS} -o ${TARGET_SHA512} ${OBJ_SHA512} | |
| clean:: | |
| rm -f *.o *.${EXT_SO} *.a | |
| STATIC_OBJ+=${OBJ_SHA512} | |
| TARGET_SHA512=muta_sha512.${EXT_SO} | |
| ALL_TARGETS+=${TARGET_SHA512} | |
| $(TARGET_SHA512): $(OBJ_SHA512) | |
| $(CC) $(call libname,muta_sha512) ${LDFLAGS} ${CFLAGS} -o ${TARGET_SHA512} ${OBJ_SHA512} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing required includes. The file uses
RHashtype and related functions but doesn't include<r_lib.h>and<r_hash.h>. These includes are present in all similar hash plugin implementations (sha1, sha256, md5) and are necessary for the code to compile.