Add missing authors for the crypto plugins, update manpage ##hash

This commit is contained in:
pancake 2024-03-13 18:45:16 +01:00 committed by GitHub
parent 7150da3e56
commit 98de4be853
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 61 additions and 46 deletions

View File

@ -1,8 +1,8 @@
/* Copyright radare2 2014-2023 - Author: pancake, vane11ope */ /* Copyright radare2 2014-2024 - Author: pancake, vane11ope */
#include <r_core.h> #include <r_core.h>
/* few remaining static functions */ // few remaining static functions
static bool __init_panels_menu(RCore *core); static bool __init_panels_menu(RCore *core);
static bool __init_panels(RCore *core, RPanels *panels); static bool __init_panels(RCore *core, RPanels *panels);
static void __init_menu_screen_settings_layout(void *_core, const char *parent); static void __init_menu_screen_settings_layout(void *_core, const char *parent);
@ -120,8 +120,10 @@ static const char *menus_iocache[] = {
}; };
static const char *menus_View[] = { static const char *menus_View[] = {
"Console", "Hexdump", "Disassembly", "Disassemble Summary", "Decompiler", "Decompiler With Offsets", "Graph", "Tiny Graph", "Console", "Hexdump", "Disassembly", "Disassemble Summary", "Decompiler", "Decompiler With Offsets",
"Functions", "Function Calls", "Sections", "Segments", PANEL_TITLE_STRINGS_DATA, PANEL_TITLE_STRINGS_BIN, "Symbols", "Imports", "Graph", "Tiny Graph",
"Functions", "Function Calls", "Sections", "Segments", PANEL_TITLE_STRINGS_DATA, PANEL_TITLE_STRINGS_BIN,
"Symbols", "Imports",
"Info", "Database", "Breakpoints", "Comments", "Classes", "Entropy", "Entropy Fire", "Xrefs Here", "Methods", "Info", "Database", "Breakpoints", "Comments", "Classes", "Entropy", "Entropy Fire", "Xrefs Here", "Methods",
"Var READ address", "Var WRITE address", "Summary", "Relocs", "Headers", "File Hashes", PANEL_TITLE_ALL_DECOMPILER, "Var READ address", "Var WRITE address", "Summary", "Relocs", "Headers", "File Hashes", PANEL_TITLE_ALL_DECOMPILER,
NULL NULL
@ -143,7 +145,8 @@ static const char *menus_Emulate[] = {
}; };
static const char *menus_Debug[] = { static const char *menus_Debug[] = {
"Registers", "FPU Registers", "XMM Registers", "YMM Registers", "RegisterRefs", "RegisterCols", "DRX", "Breakpoints", "Watchpoints", "Registers", "FPU Registers", "XMM Registers", "YMM Registers", "RegisterRefs", "RegisterCols",
"DRX", "Breakpoints", "Watchpoints",
"Maps", "Modules", "Backtrace", "Locals", "Continue", "Maps", "Modules", "Backtrace", "Locals", "Continue",
"Stack", "Step", "Step Over", "Reload", "Stack", "Step", "Step Over", "Reload",
NULL NULL
@ -314,8 +317,7 @@ static RPanel *__get_panel(RPanels *panels, int i) {
static void __update_edge_x(RCore *core, int x) { static void __update_edge_x(RCore *core, int x) {
RPanels *panels = core->panels; RPanels *panels = core->panels;
int i, j; int i, j, tmp_x = 0;
int tmp_x = 0;
for (i = 0; i < panels->n_panels; i++) { for (i = 0; i < panels->n_panels; i++) {
RPanel *p0 = __get_panel (panels, i); RPanel *p0 = __get_panel (panels, i);
if (p0 && (p0->view->pos.x - 2 <= panels->mouse_orig_x && if (p0 && (p0->view->pos.x - 2 <= panels->mouse_orig_x &&

View File

@ -100,6 +100,7 @@ static bool update(RCryptoJob *cj, const ut8 *buf, int len) {
RCryptoPlugin r_crypto_plugin_aes_cbc = { RCryptoPlugin r_crypto_plugin_aes_cbc = {
.meta = { .meta = {
.name = "aes-cbc", .name = "aes-cbc",
.author = "pancake",
}, },
.set_key = aes_cbc_set_key, .set_key = aes_cbc_set_key,
.get_key_size = aes_cbc_get_key_size, .get_key_size = aes_cbc_get_key_size,

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2016-2022 - rakholiyajenish.07 */ /* radare - LGPL - Copyright 2016-2024 - rakholiyajenish.07 */
#include <r_lib.h> #include <r_lib.h>
#include <r_crypto.h> #include <r_crypto.h>
@ -40,7 +40,8 @@ static bool update(RCryptoJob *cj, const ut8 *buf, int len) {
RCryptoPlugin r_crypto_plugin_base91 = { RCryptoPlugin r_crypto_plugin_base91 = {
.meta = { .meta = {
.name = "base91", .name = "base91",
.author = "pancake", .author = "rakholiyajenish.07",
.license = "MIT",
}, },
.implements = "base91", .implements = "base91",
.type = R_CRYPTO_TYPE_ENCODER, .type = R_CRYPTO_TYPE_ENCODER,

View File

@ -178,7 +178,7 @@ static void blowfish_crypt(struct blowfish_state *const state, const ut8 *inbuf,
int index1, index2; int index1, index2;
if (!state || !inbuf || !outbuf || buflen < 0 || buflen%8 != 0) { if (!state || !inbuf || !outbuf || buflen < 0 || buflen%8 != 0) {
//let user deal with padding // let user deal with padding
if (buflen % 8 != 0) { if (buflen % 8 != 0) {
R_LOG_ERROR ("Invalid input length %d. Expected length is multiple of 8 bytes", buflen); R_LOG_ERROR ("Invalid input length %d. Expected length is multiple of 8 bytes", buflen);
} }
@ -310,10 +310,7 @@ static bool blowfish_set_key(RCryptoJob *cj, const ut8 *key, int keylen, int mod
static int blowfish_get_key_size(RCryptoJob *cj) { static int blowfish_get_key_size(RCryptoJob *cj) {
struct blowfish_state *st = get_st (cj); struct blowfish_state *st = get_st (cj);
if (st) { return st? st->key_size: -1;
return st->key_size;
}
return -1;
} }
static bool update(RCryptoJob *cj, const ut8 *buf, int len) { static bool update(RCryptoJob *cj, const ut8 *buf, int len) {
@ -343,6 +340,7 @@ RCryptoPlugin r_crypto_plugin_blowfish = {
.meta = { .meta = {
.name = "blowfish", .name = "blowfish",
.license = "LGPL3", .license = "LGPL3",
.author = "pancake"
}, },
.implements = "blowfish", .implements = "blowfish",
.set_key = blowfish_set_key, .set_key = blowfish_set_key,

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2009-2022 - pancake */ /* radare - LGPL - Copyright 2009-2024 - pancake */
#include <r_lib.h> #include <r_lib.h>
#include <r_crypto.h> #include <r_crypto.h>
@ -31,8 +31,7 @@ struct rc2_state {
int key_size; int key_size;
}; };
// takes a 8-128 len ut8 key // takes a 8-128 len ut8 key which expands to an 64 len ut16 key
// expands it to a 64 len ut16 key
static bool rc2_expandKey(struct rc2_state *state, const ut8 *key, int key_len) { static bool rc2_expandKey(struct rc2_state *state, const ut8 *key, int key_len) {
int i; int i;
@ -103,7 +102,6 @@ static void rc2_crypt8(struct rc2_state *state, const ut8 *inbuf, ut8 *outbuf) {
outbuf[7] = (ut8) (x76 >> 8); outbuf[7] = (ut8) (x76 >> 8);
} }
static void rc2_dcrypt8(struct rc2_state *state, const ut8 *inbuf, ut8 *outbuf) { static void rc2_dcrypt8(struct rc2_state *state, const ut8 *inbuf, ut8 *outbuf) {
int i; int i;
ut16 x76, x54, x32, x10; ut16 x76, x54, x32, x10;
@ -149,11 +147,10 @@ static void rc2_dcrypt8(struct rc2_state *state, const ut8 *inbuf, ut8 *outbuf)
} }
static void rc2_dcrypt(struct rc2_state *state, const ut8 *inbuf, ut8 *outbuf, int buflen) { static void rc2_dcrypt(struct rc2_state *state, const ut8 *inbuf, ut8 *outbuf, int buflen) {
int i;
char data_block[BLOCK_SIZE + 1] = {0}; char data_block[BLOCK_SIZE + 1] = {0};
int idx = 0;
char dcrypted_block[BLOCK_SIZE + 1] = {0}; char dcrypted_block[BLOCK_SIZE + 1] = {0};
char *ptr = (char *) outbuf; char *ptr = (char *) outbuf;
int i, idx = 0;
for (i = 0; i < buflen; i++) { for (i = 0; i < buflen; i++) {
data_block[idx] = inbuf[i]; data_block[idx] = inbuf[i];
@ -184,7 +181,6 @@ static void rc2_crypt(struct rc2_state *state, const ut8 *inbuf, ut8 *outbuf, in
idx = 0; idx = 0;
} }
} }
size_t mod = idx % BLOCK_SIZE; size_t mod = idx % BLOCK_SIZE;
if (mod) { if (mod) {
while (idx % BLOCK_SIZE) { while (idx % BLOCK_SIZE) {
@ -245,6 +241,8 @@ static bool fini(RCryptoJob *cj) {
RCryptoPlugin r_crypto_plugin_rc2 = { RCryptoPlugin r_crypto_plugin_rc2 = {
.meta = { .meta = {
.name = "rc2", .name = "rc2",
.author = "pancake",
.license = "LGPL",
}, },
.set_key = rc2_set_key, .set_key = rc2_set_key,
.get_key_size = rc2_get_key_size, .get_key_size = rc2_get_key_size,

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2016-2022 - pancake */ /* radare - LGPL - Copyright 2016-2024 - pancake */
#include <r_lib.h> #include <r_lib.h>
#include <r_crypto.h> #include <r_crypto.h>
@ -18,11 +18,7 @@ static __inline void swap_bytes(ut8 *a, ut8 *b) {
} }
} }
/* // Initialize an RC4 state buffer using the supplied arbitrary length key,
* Initialize an RC4 state buffer using the supplied key,
* which can have arbitrary length.
*/
static bool rc4_init(struct rc4_state *const state, const ut8 *key, int keylen) { static bool rc4_init(struct rc4_state *const state, const ut8 *key, int keylen) {
ut8 j; ut8 j;
int i; int i;
@ -109,6 +105,8 @@ static bool fini(RCryptoJob *cj) {
RCryptoPlugin r_crypto_plugin_rc4 = { RCryptoPlugin r_crypto_plugin_rc4 = {
.meta = { .meta = {
.name = "rc4", .name = "rc4",
.license = "LGPL",
.author = "pancake",
}, },
.implements = "rc4", .implements = "rc4",
.set_key = rc4_set_key, .set_key = rc4_set_key,

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2016-2022 - pancake */ /* radare - LGPL - Copyright 2016-2024 - pancake */
#include <r_lib.h> #include <r_lib.h>
#include <r_crypto.h> #include <r_crypto.h>

View File

@ -1,3 +1,5 @@
/* radare - LGPL - Copyright 2016-2024 - pancake */
#include <r_lib.h> #include <r_lib.h>
#include <r_crypto.h> #include <r_crypto.h>
@ -71,6 +73,8 @@ static bool fini(RCryptoJob *cj) {
RCryptoPlugin r_crypto_plugin_ror = { RCryptoPlugin r_crypto_plugin_ror = {
.meta = { .meta = {
.name = NAME, .name = NAME,
.author = "pancake",
.license = "LGPL",
}, },
.set_key = ror_set_key, .set_key = ror_set_key,
.get_key_size = ror_get_key_size, .get_key_size = ror_get_key_size,

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2017-2022 - pancake */ /* radare - LGPL - Copyright 2017-2024 - pancake */
#include <r_lib.h> #include <r_lib.h>
#include <r_crypto.h> #include <r_crypto.h>
@ -112,6 +112,8 @@ static bool end(RCryptoJob *cj, const ut8 *buf, int len) {
RCryptoPlugin r_crypto_plugin_serpent = { RCryptoPlugin r_crypto_plugin_serpent = {
.meta = { .meta = {
.name = "serpent-ecb", .name = "serpent-ecb",
.license = "LGPL",
.author = "pancake",
}, },
.set_key = serpent_set_key, .set_key = serpent_set_key,
.get_key_size = serpent_get_key_size, .get_key_size = serpent_get_key_size,

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2009-2017 - pancake */ /* radare - LGPL - Copyright 2009-2024 - pancake */
#include <r_lib.h> #include <r_lib.h>
#include <r_crypto.h> #include <r_crypto.h>
@ -54,6 +54,7 @@ static bool update(RCryptoJob *cj, const ut8 *buf, int len) {
RCryptoPlugin r_crypto_plugin_xor = { RCryptoPlugin r_crypto_plugin_xor = {
.meta = { .meta = {
.name = "xor", .name = "xor",
.author = "pancake",
.license = "MIT", .license = "MIT",
}, },
.implements = "xor", .implements = "xor",

View File

@ -1,4 +1,4 @@
.Dd June 7, 2023 .Dd March 13, 2024
.Dt R2PM 1 .Dt R2PM 1
.Sh NAME .Sh NAME
.Nm r2pm .Nm r2pm

View File

@ -1,4 +1,4 @@
.Dd Mar 12, 2022 .Dd Mar 12, 2024
.Dt RAHASH2 1 .Dt RAHASH2 1
.Sh NAME .Sh NAME
.Nm rahash2 .Nm rahash2
@ -6,12 +6,12 @@
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm rahash2 .Nm rahash2
.Op Fl BbdDehjrknvq .Op Fl BbdDehjrknvq
.Op Fl a Ar algorithm .Op Fl a Ar algo
.Op Fl b Ar size .Op Fl b Ar size
.Op Fl D Ar algo .Op Fl D Ar deco
.Op Fl E Ar algo .Op Fl E Ar enco
.Op Fl f Ar from .Op Fl f Ar from
.Op Fl i Ar iterations .Op Fl i Ar iters
.Op Fl I Ar IV .Op Fl I Ar IV
.Op Fl n Ar blocks .Op Fl n Ar blocks
.Op Fl s Ar string .Op Fl s Ar string
@ -39,11 +39,11 @@ Define the block size
.It Fl c Ar hash .It Fl c Ar hash
Compare the computed hash with this one. Allowed only when a single hash is computed. Compare the computed hash with this one. Allowed only when a single hash is computed.
.It Fl D Ar algo .It Fl D Ar algo
Decrypt instead of hash using the given algorithm (base64, base91, rc4, aes, xor, blowfish, rot, rol, ror, rc2, rc6, punycode) Decrypt or decode using the given algorithm (See: `rahash2 -L | grep -e ^e -e ^c`)
.It Fl e .It Fl e
Use little endian to display checksums Use little endian to display checksums
.It Fl E Ar algo .It Fl E Ar algo
Encrypt instead of hash using the given algorithm (base64, base91, rc4, aes, xor, blowfish, rot, rol, ror, rc2, rc6, punycode) Encrypt or encode using the given algorithm (see `rahash2 -L | grep -e ^e -e ^c`)
.It Fl i Ar iters .It Fl i Ar iters
Apply the hash Iters times to itself+seed Apply the hash Iters times to itself+seed
.It Fl I Ar [^]s:string|hexstr .It Fl I Ar [^]s:string|hexstr
@ -79,6 +79,16 @@ Show version information
.It Fl h .It Fl h
Show usage help message. Show usage help message.
.El .El
.Sh EXAMPLES
.Pp
Compute the md5 of the infamous 'ls':
.Pp
$ rahash2 -qqa md5 /bin/ls
.Pp
Base64 encoded Hello World:
.Pp
$ rahash2 -E base64 -s hello
.Pp
.Sh DIAGNOSTICS .Sh DIAGNOSTICS
.Ex -std .Ex -std
.Pp .Pp

View File

@ -163,24 +163,24 @@ FILE=-
CMDS=!rahash2 -L CMDS=!rahash2 -L
EXPECT=<<EOF EXPECT=<<EOF
c aes-ecb MIT pancake c aes-ecb MIT pancake
c aes-cbc LGPL c aes-cbc LGPL pancake
c aes-wrap LGPL Sylvain Pelissier c aes-wrap LGPL Sylvain Pelissier
e base64 LGPL rakholiyajenish.07 e base64 LGPL rakholiyajenish.07
e base91 LGPL pancake e base91 MIT rakholiyajenish.07
c blowfish LGPL3 c blowfish LGPL3 pancake
c cps2 LGPL pof,esanfelix c cps2 LGPL pof,esanfelix
c des-ecb LGPL deroad c des-ecb LGPL deroad
h entropy MIT pancake h entropy MIT pancake
e punycode LGPL e punycode LGPL
c rc2 LGPL c rc2 LGPL pancake
c rc4 LGPL c rc4 LGPL pancake
c rc6 LGPL pancake c rc6 LGPL pancake
c rol LGPL pancake c rol LGPL pancake
c ror LGPL c ror LGPL pancake
c rot MIT pancake c rot MIT pancake
c serpent-ecb LGPL c serpent-ecb LGPL pancake
c sm4-ecb LGPL3 Sylvain Pelissier c sm4-ecb LGPL3 Sylvain Pelissier
c xor MIT c xor MIT pancake
h md5 h md5
h sha1 h sha1
h sha256 h sha256