mirror of
https://github.com/radareorg/radare2.git
synced 2026-04-20 16:39:07 +02:00
Fix the license checks for all the crypto/hash ##muta
This commit is contained in:
354
COPYING.md
354
COPYING.md
@@ -1,361 +1,15 @@
|
||||
# Radare2 License
|
||||
|
||||
In short, radare2 is mostly LGPLv3, but there are some components with compatible licenses like Apache, BSD or MIT.
|
||||
Most of radare2 is licensed under the LGPLv3, but as its dependencies and plugins are distributed with different licenses.
|
||||
|
||||
The only incompatible part that you may probably need to disable the build of the **GPL** parts which can be disabled with the `--without-gpl` configure flag.
|
||||
Probably the only concern for distributing static builds of radare2 is the **GPL** license, and you can skip the related code with the `--without-gpl` configure flag.
|
||||
|
||||
See `doc/licenses/` and `doc/licenses.md`.
|
||||
|
||||
To get a fully detailed SBOM report from a runtime build use the `licenses.r2.js` script that will return a JSON object with `-Vj` containing all the license and copyright detailed information of all the elements shipped in the build. Here's a sample output:
|
||||
|
||||
If you want to confirm the licenses you are shipping you can run the `scripts/licenses.r2.js` script to find out all the plugins and their copying statements.
|
||||
|
||||
```console
|
||||
$ r2 -qi scripts/licenses.r2.js --
|
||||
|
||||
LGPL-3.0-only
|
||||
capstone BSD-3-Clause OK
|
||||
sdb MIT OK
|
||||
arm64v35 Apache-2.0 OK
|
||||
armv7v35 Apache-2.0 OK
|
||||
- core
|
||||
- a2f : MIT OK
|
||||
- agD : LGPL-3.0-only OK
|
||||
- java : Apache-2.0 OK
|
||||
- prj : MIT OK
|
||||
- six : MIT OK
|
||||
- r2ai-client : MIT OK
|
||||
- r2dec : BSD-3 OK
|
||||
- r2ghidra : GPL3 OK
|
||||
- decai : MIT OK
|
||||
- sarif : MIT OK
|
||||
- r2jadx : MIT OK
|
||||
- goresym : MIT OK
|
||||
- codeshare : MIT OK
|
||||
- bin
|
||||
- any : LGPL-3.0-only OK
|
||||
- art : LGPL-3.0-only OK
|
||||
- avr : LGPL-3.0-only OK
|
||||
- bf : LGPL-3.0-only OK
|
||||
- bflt : LGPL-3.0-only OK
|
||||
- bios : LGPL-3.0-only OK
|
||||
- bootimg : LGPL-3.0-only OK
|
||||
- cgc : LGPL-3.0-only OK
|
||||
- coff : LGPL-3.0-only OK
|
||||
- dex : LGPL-3.0-only OK
|
||||
- dis : MIT OK
|
||||
- dmp64 : LGPL-3.0-only OK
|
||||
- dol : BSD-3-Clause OK
|
||||
- dyldcache : LGPL-3.0-only OK
|
||||
- elf : LGPL-3.0-only OK
|
||||
- elf64 : LGPL-3.0-only OK
|
||||
- fs : LGPL-3.0-only OK
|
||||
- hunk : MIT OK
|
||||
- io : MIT OK
|
||||
- java : LGPL-3.0-only OK
|
||||
- le : LGPL-3.0-only OK
|
||||
- lua : MIT OK
|
||||
- mach0 : LGPL-3.0-only OK
|
||||
- mach064 : LGPL-3.0-only OK
|
||||
- mbn : LGPL-3.0-only OK
|
||||
- mdmp : LGPL-3.0-only OK
|
||||
- menuet : LGPL-3.0-only OK
|
||||
- msx : LGPL-3.0-only OK
|
||||
- mz : MIT OK
|
||||
- ne : LGPL-3.0-only OK
|
||||
- nes : MIT OK
|
||||
- nin3ds : LGPL-3.0-only OK
|
||||
- ninds : LGPL-3.0-only OK
|
||||
- ningb : LGPL-3.0-only OK
|
||||
- ningba : LGPL-3.0-only OK
|
||||
- nro : MIT OK
|
||||
- nso : MIT OK
|
||||
- off : MIT OK
|
||||
- omf : LGPL-3.0-only OK
|
||||
- p9 : MIT OK
|
||||
- pcap : LGPL-3.0-only OK
|
||||
- pdp11 : MIT OK
|
||||
- pe : LGPL-3.0-only OK
|
||||
- pe64 : LGPL-3.0-only OK
|
||||
- pebble : LGPL-3.0-only OK
|
||||
- prg : LGPL-3.0-only OK
|
||||
- psxexe : LGPL-3.0-only OK
|
||||
- pyc : LGPL-3.0-only OK
|
||||
- qnx : LGPL-3.0-only OK
|
||||
- rel : LGPL-3.0-only OK
|
||||
- s390 : LGPL-3.0-only OK
|
||||
- sfc : LGPL-3.0-only OK
|
||||
- smd : LGPL-3.0-only OK
|
||||
- sms : LGPL-3.0-only OK
|
||||
- symbols : MIT OK
|
||||
- te : LGPL-3.0-only OK
|
||||
- tic : MIT OK
|
||||
- uf2 : MIT OK
|
||||
- vsf : LGPL-3.0-only OK
|
||||
- wad : LGPL-3.0-only OK
|
||||
- wasm : MIT OK
|
||||
- xbe : LGPL-3.0-only OK
|
||||
- xcoff64 : LGPL-3.0-only OK
|
||||
- kernelcache : LGPL-3.0-only OK
|
||||
- xtac : Apache-2.0 OK
|
||||
- z64 : LGPL-3.0-only OK
|
||||
- zimg : LGPL-3.0-only OK
|
||||
- xtr
|
||||
- xtr.dyldcache : LGPL-3.0-only OK
|
||||
- xtr.fatmach0 : LGPL-3.0-only OK
|
||||
- xtr.pemixed : LGPL-3.0-only OK
|
||||
- xtr.sep64 : LGPL-3.0-only OK
|
||||
- xtr.xalz : MIT OK
|
||||
- ldr
|
||||
- xtr.dyldcache : LGPL-3.0-only OK
|
||||
- xtr.fatmach0 : LGPL-3.0-only OK
|
||||
- xtr.pemixed : LGPL-3.0-only OK
|
||||
- xtr.sep64 : LGPL-3.0-only OK
|
||||
- xtr.xalz : MIT OK
|
||||
- arch
|
||||
- 6502 : LGPL-3.0-only OK
|
||||
- 6502.cs : LGPL-3.0-only OK
|
||||
- 8051 : LGPL-3.0-only OK
|
||||
- alpha : GPL-3.0-only OK
|
||||
- amd29k : BSD-3-Clause OK
|
||||
- any.as : LGPL-3.0-only OK
|
||||
- any.vasm : MIT OK
|
||||
- arc : LGPL-3.0-only OK
|
||||
- arm.nz : LGPL-3.0-only OK
|
||||
- arm : Apache-2.0 OK
|
||||
- arm.gnu : GPL-3.0-only OK
|
||||
- arm.v35 : BSD-3-Clause OK
|
||||
- avr : LGPL-3.0-only OK
|
||||
- bf : LGPL-3.0-only OK
|
||||
- bpf.mr : LGPL-3.0-only OK
|
||||
- bpf : BSD-3-Clause OK
|
||||
- chip8 : LGPL-3.0-only OK
|
||||
- cr16 : LGPL-3.0-only OK
|
||||
- cris : LGPL-3.0-only OK
|
||||
- dalvik : LGPL-3.0-only OK
|
||||
- dis : MIT OK
|
||||
- ebc : LGPL-3.0-only OK
|
||||
- evm : BSD-3-Clause OK
|
||||
- fslsp : LGPL-3.0-only OK
|
||||
- gb : LGPL-3.0-only OK
|
||||
- h8300 : LGPL-3.0-only OK
|
||||
- hppa : GPL-3.0-only OK
|
||||
- i4004 : LGPL-3.0-only OK
|
||||
- i8080 : LGPL-3.0-only OK
|
||||
- java : Apache-2.0 OK
|
||||
- jdh8 : LGPL-3.0-only OK
|
||||
- kvx : LGPL-3.0-only OK
|
||||
- lanai : GPL-3.0-only OK
|
||||
- lh5801 : LGPL-3.0-only OK
|
||||
- lm32 : BSD-3-Clause OK
|
||||
- loongarch : LGPL-3.0-only OK
|
||||
- lua : MIT OK
|
||||
- m680x : Apache-2.0 OK
|
||||
- m68k : BSD-3-Clause OK
|
||||
- m68k.gnu : GPL-3.0-only OK
|
||||
- mcore : LGPL-3.0-only OK
|
||||
- mcs96 : LGPL-3.0-only OK
|
||||
- mips : Apache-2.0 OK
|
||||
- mips.gnu : LGPL-3.0-only OK
|
||||
- msp430 : LGPL-3.0-only OK
|
||||
- nds32 : GPL-3.0-only OK
|
||||
- nios2 : LGPL-3.0-only OK
|
||||
- null : LGPL-3.0-only OK
|
||||
- or1k : LGPL-3.0-only OK
|
||||
- pdp11 : GPL-3.0-only OK
|
||||
- pic : LGPL-3.0-only OK
|
||||
- pickle : BSD-3-Clause OK
|
||||
- ppc : Apache-2.0 OK
|
||||
- ppc.gnu : LGPL-3.0-only OK
|
||||
- propeller : LGPL-3.0-only OK
|
||||
- pyc : LGPL-3.0-only OK
|
||||
- riscv : GPL-3.0-only OK
|
||||
- riscv.cs : Apache-2.0 OK
|
||||
- rsp : LGPL-3.0-only OK
|
||||
- s390 : Apache-2.0 OK
|
||||
- s390.gnu : BSD-3-Clause OK
|
||||
- sh : LGPL-3.0-only OK
|
||||
- sh.cs : Apache-2.0 OK
|
||||
- sm5xx : BSD-3-Clause OK
|
||||
- snes : LGPL-3.0-only OK
|
||||
- sparc : Apache-2.0 OK
|
||||
- sparc.gnu : GPL-3.0-only OK
|
||||
- stm8 : GPL-3.0-only OK
|
||||
- tms320 : LGPL-3.0-only OK
|
||||
- tricore : LGPL-3.0-only OK
|
||||
- tricore.cs : Apache-2.0 OK
|
||||
- uxn : MIT OK
|
||||
- v810 : LGPL-3.0-only OK
|
||||
- v850 : MIT OK
|
||||
- vax : GPL-3.0-only OK
|
||||
- wasm : LGPL-3.0-only OK
|
||||
- ws : LGPL-3.0-only OK
|
||||
- x86 : Apache-2.0 OK
|
||||
- x86.nasm : LGPL-3.0-only OK
|
||||
- x86.nz : LGPL-3.0-only OK
|
||||
- xap : LGPL-3.0-only OK
|
||||
- xcore : Apache-2.0 OK
|
||||
- xtensa : LGPL-3.0-only OK
|
||||
- z80 : GPL-3.0-only OK
|
||||
- r2ghidra : GPL3 OK
|
||||
- crypto
|
||||
- aes-ecb : MIT OK
|
||||
- aes-cbc : LGPL-3.0-only OK
|
||||
- aes-wrap : LGPL-3.0-only OK
|
||||
- base64 : LGPL-3.0-only OK
|
||||
- base91 : MIT OK
|
||||
- bech32 : BSD-3-Clause OK
|
||||
- blowfish : LGPL-3.0-only OK
|
||||
- cps2 : LGPL-3.0-only OK
|
||||
- des-ecb : LGPL-3.0-only OK
|
||||
- ed25519 : Zlib OK
|
||||
- entropy : MIT OK
|
||||
- punycode : LGPL-3.0-only OK
|
||||
- rc2 : LGPL-3.0-only OK
|
||||
- rc4 : LGPL-3.0-only OK
|
||||
- rc6 : LGPL-3.0-only OK
|
||||
- rol : LGPL-3.0-only OK
|
||||
- ror : LGPL-3.0-only OK
|
||||
- rot : MIT OK
|
||||
- serpent-ecb : LGPL-3.0-only OK
|
||||
- sip : MIT OK
|
||||
- sm4-ecb : LGPL-3.0-only OK
|
||||
- strhash : MIT OK
|
||||
- xor : MIT OK
|
||||
- md5 : undefined [31mERROR[0m
|
||||
- sha1 : undefined [31mERROR[0m
|
||||
- sha256 : undefined [31mERROR[0m
|
||||
- sha384 : undefined [31mERROR[0m
|
||||
- sha512 : undefined [31mERROR[0m
|
||||
- md4 : undefined [31mERROR[0m
|
||||
- xor : undefined [31mERROR[0m
|
||||
- xorpair : undefined [31mERROR[0m
|
||||
- parity : undefined [31mERROR[0m
|
||||
- entropy : undefined [31mERROR[0m
|
||||
- hamdist : undefined [31mERROR[0m
|
||||
- pcprint : undefined [31mERROR[0m
|
||||
- mod255 : undefined [31mERROR[0m
|
||||
- xxhash : undefined [31mERROR[0m
|
||||
- adler32 : undefined [31mERROR[0m
|
||||
- luhn : undefined [31mERROR[0m
|
||||
- ssdeep : undefined [31mERROR[0m
|
||||
- crc8smbus : undefined [31mERROR[0m
|
||||
- crc15can : undefined [31mERROR[0m
|
||||
- crc16 : undefined [31mERROR[0m
|
||||
- crc16hdlc : undefined [31mERROR[0m
|
||||
- crc16usb : undefined [31mERROR[0m
|
||||
- crc16citt : undefined [31mERROR[0m
|
||||
- crc24 : undefined [31mERROR[0m
|
||||
- crc32 : undefined [31mERROR[0m
|
||||
- crc32c : undefined [31mERROR[0m
|
||||
- crc32ecma267 : undefined [31mERROR[0m
|
||||
- crc32bzip2 : undefined [31mERROR[0m
|
||||
- crc32d : undefined [31mERROR[0m
|
||||
- crc32mpeg2 : undefined [31mERROR[0m
|
||||
- crc32posix : undefined [31mERROR[0m
|
||||
- crc32q : undefined [31mERROR[0m
|
||||
- crc32jamcrc : undefined [31mERROR[0m
|
||||
- crc32xfer : undefined [31mERROR[0m
|
||||
- crc64 : undefined [31mERROR[0m
|
||||
- crc64ecma : undefined [31mERROR[0m
|
||||
- crc64we : undefined [31mERROR[0m
|
||||
- crc64xz : undefined [31mERROR[0m
|
||||
- crc64iso : undefined [31mERROR[0m
|
||||
- fletcher8 : undefined [31mERROR[0m
|
||||
- fletcher16 : undefined [31mERROR[0m
|
||||
- fletcher32 : undefined [31mERROR[0m
|
||||
- fletcher64 : undefined [31mERROR[0m
|
||||
- elf : undefined [31mERROR[0m
|
||||
- debug
|
||||
- bf : LGPL-3.0-only OK
|
||||
- bochs : LGPL-3.0-only OK
|
||||
- esil : LGPL-3.0-only OK
|
||||
- evm : LGPL-3.0-only OK
|
||||
- gdb : LGPL-3.0-only OK
|
||||
- io : MIT OK
|
||||
- native : LGPL-3.0-only OK
|
||||
- null : MIT OK
|
||||
- qnx : LGPL-3.0-only OK
|
||||
- rap : LGPL-3.0-only OK
|
||||
- rv32ima : MIT OK
|
||||
- winkd : LGPL-3.0-only OK
|
||||
- egg
|
||||
- exec : MIT OK
|
||||
- xor : MIT OK
|
||||
- fs
|
||||
- ext2 : GPL-3.0-only OK
|
||||
- fat : GPL-3.0-only OK
|
||||
- fb : GPL-3.0-only OK
|
||||
- hfs : GPL-3.0-only OK
|
||||
- hfsplus : GPL-3.0-only OK
|
||||
- io : MIT OK
|
||||
- iso9660 : GPL-3.0-only OK
|
||||
- jfs : GPL-3.0-only OK
|
||||
- minix : GPL-3.0-only OK
|
||||
- ntfs : GPL-3.0-only OK
|
||||
- posix : MIT OK
|
||||
- r2 : MIT OK
|
||||
- reiserfs : GPL-3.0-only OK
|
||||
- sfs : GPL-3.0-only OK
|
||||
- squashfs : MIT OK
|
||||
- tar : GPL-3.0-only OK
|
||||
- udf : GPL-3.0-only OK
|
||||
- ufs : GPL-3.0-only OK
|
||||
- xfs : GPL-3.0-only OK
|
||||
- zip : MIT OK
|
||||
- io
|
||||
- ar : LGPL-3.0-only OK
|
||||
- bfdbg : LGPL-3.0-only OK
|
||||
- bochs : LGPL-3.0-only OK
|
||||
- cyclic : LGPL-3.0-only OK
|
||||
- debug : LGPL-3.0-only OK
|
||||
- default : LGPL-3.0-only OK
|
||||
- dsc : LGPL-3.0-only OK
|
||||
- fd : MIT OK
|
||||
- gdb : LGPL-3.0-only OK
|
||||
- gprobe : LGPL-3.0-only OK
|
||||
- gzip : LGPL-3.0-only OK
|
||||
- http : LGPL-3.0-only OK
|
||||
- ihex : LGPL-3.0-only OK
|
||||
- isotp : MIT OK
|
||||
- mach : LGPL-3.0-only OK
|
||||
- malloc : LGPL-3.0-only OK
|
||||
- mmap : LGPL-3.0-only OK
|
||||
- null : LGPL-3.0-only OK
|
||||
- qnx : GPL-3.0-only OK
|
||||
- r2k : LGPL-3.0-only OK
|
||||
- r2pipe : MIT OK
|
||||
- r2web : LGPL-3.0-only OK
|
||||
- rap : MIT OK
|
||||
- rbuf : LGPL-3.0-only OK
|
||||
- reg : LGPL-3.0-only OK
|
||||
- self : LGPL-3.0-only OK
|
||||
- serial : MIT OK
|
||||
- socket : MIT OK
|
||||
- sparse : LGPL-3.0-only OK
|
||||
- sysgdb : MIT OK
|
||||
- tcp : LGPL-3.0-only OK
|
||||
- treebuf : LGPL-3.0-only OK
|
||||
- uf2 : LGPL-3.0-only OK
|
||||
- winedbg : MIT OK
|
||||
- winkd : LGPL-3.0-only OK
|
||||
- xalz : MIT OK
|
||||
- xattr : LGPL-3.0-only OK
|
||||
- zip : BSD-3-Clause OK
|
||||
- frida : MIT OK
|
||||
- lang
|
||||
- s : LGPL-3.0-only OK
|
||||
- c : LGPL-3.0-only OK
|
||||
- cpipe : MIT OK
|
||||
- v : MIT OK
|
||||
- vala : LGPL-3.0-only OK
|
||||
- rust : MIT OK
|
||||
- zig : MIT OK
|
||||
- pipe : MIT OK
|
||||
- go : MIT OK
|
||||
- poke : LGPL-3.0-only OK
|
||||
- spp : MIT OK
|
||||
- lib : MIT OK
|
||||
- asm : LGPL-3.0-only OK
|
||||
- qjs : MIT OK
|
||||
- tsc : MIT OK
|
||||
- nim : MIT OK
|
||||
```
|
||||
|
||||
3
dist/plugins-cfg/plugins.def.cfg
vendored
3
dist/plugins-cfg/plugins.def.cfg
vendored
@@ -211,6 +211,9 @@ muta.serpent
|
||||
muta.sm4
|
||||
muta.xor
|
||||
muta.strhash
|
||||
muta.simplehash
|
||||
muta.xxhash
|
||||
muta.md4
|
||||
muta.sip
|
||||
muta.charset_ascii
|
||||
muta.charset_seven
|
||||
|
||||
3
dist/plugins-cfg/plugins.static.cfg
vendored
3
dist/plugins-cfg/plugins.static.cfg
vendored
@@ -133,6 +133,9 @@ muta.charset_iso8859_1
|
||||
muta.charset_jis7
|
||||
muta.charset_katakana
|
||||
muta.charset_pokered
|
||||
muta.simplehash
|
||||
muta.xxhash
|
||||
muta.md4
|
||||
debug.bf
|
||||
debug.io
|
||||
debug.esil
|
||||
|
||||
@@ -160,6 +160,9 @@ extern RMutaPlugin r_muta_plugin_sip;
|
||||
extern RMutaPlugin r_muta_plugin_sm4;
|
||||
extern RMutaPlugin r_muta_plugin_ssdeep;
|
||||
extern RMutaPlugin r_muta_plugin_strhash;
|
||||
extern RMutaPlugin r_muta_plugin_simplehash;
|
||||
extern RMutaPlugin r_muta_plugin_xxhash;
|
||||
extern RMutaPlugin r_muta_plugin_md4;
|
||||
extern RMutaPlugin r_muta_plugin_xor;
|
||||
extern RMutaPlugin r_muta_plugin_add;
|
||||
extern RMutaPlugin r_muta_plugin_charset_ascii;
|
||||
|
||||
@@ -52,6 +52,9 @@ r_muta_sources = files(
|
||||
'p/muta_sm4.c',
|
||||
'p/muta_ssdeep.c',
|
||||
'p/muta_strhash.c',
|
||||
'p/muta_simplehash.c',
|
||||
'p/muta_xxhash.c',
|
||||
'p/muta_md4.c',
|
||||
'p/algo/sm4.c',
|
||||
'p/algo/serpent.c',
|
||||
'p/muta_xor.c',
|
||||
|
||||
@@ -203,7 +203,11 @@ R_API char *r_muta_list(RMuta *cry, RMutaType type, int mode) {
|
||||
for (i = 0; i < 64; i++) {
|
||||
ut64 bits = ((ut64)1) << i;
|
||||
const char *name = r_hash_name (bits);
|
||||
if R_STR_ISEMPTY (name) {
|
||||
if (R_STR_ISEMPTY (name)) {
|
||||
continue;
|
||||
}
|
||||
// skip if already implemented by a muta plugin
|
||||
if (r_muta_find (cry, name)) {
|
||||
continue;
|
||||
}
|
||||
switch (mode) {
|
||||
|
||||
@@ -39,6 +39,7 @@ include charset_katakana.mk
|
||||
include charset_macintosh.mk
|
||||
include charset_pokemon.mk
|
||||
include charset_pokered.mk
|
||||
include charset_seven.mk
|
||||
include cps2.mk
|
||||
include crc.mk
|
||||
include des.mk
|
||||
@@ -56,6 +57,9 @@ include sip.mk
|
||||
include sm4.mk
|
||||
include ssdeep.mk
|
||||
include strhash.mk
|
||||
include simplehash.mk
|
||||
include xxhash.mk
|
||||
include md4.mk
|
||||
include xor.mk
|
||||
|
||||
clean:
|
||||
|
||||
9
libr/muta/p/md4.mk
Normal file
9
libr/muta/p/md4.mk
Normal file
@@ -0,0 +1,9 @@
|
||||
OBJ_MD4=muta_md4.o
|
||||
|
||||
STATIC_OBJ+=${OBJ_MD4}
|
||||
TARGET_MD4=muta_md4.${EXT_SO}
|
||||
|
||||
ALL_TARGETS+=${TARGET_MD4}
|
||||
|
||||
${TARGET_MD4}: ${OBJ_MD4}
|
||||
$(CC) $(call libname,muta_md4) ${LDFLAGS} ${CFLAGS} -o ${TARGET_MD4} ${OBJ_MD4}
|
||||
83
libr/muta/p/muta_md4.c
Normal file
83
libr/muta/p/muta_md4.c
Normal file
@@ -0,0 +1,83 @@
|
||||
/* radare - GPL-2.0-or-later - Copyright 2024-2026 - pancake */
|
||||
/* MD4 algorithm from SMB by Andrew Tridgell - GPL */
|
||||
|
||||
#include <r_lib.h>
|
||||
#include <r_muta.h>
|
||||
#include <r_hash.h>
|
||||
|
||||
typedef struct {
|
||||
RHash *ctx;
|
||||
} Md4State;
|
||||
|
||||
static RMutaSession *md4_begin(RMuta *muta) {
|
||||
RMutaSession *ms = r_muta_session_new (muta, muta->h);
|
||||
if (!ms) {
|
||||
return NULL;
|
||||
}
|
||||
return ms;
|
||||
}
|
||||
|
||||
static bool md4_update(RMutaSession *ms, const ut8 *buf, int len) {
|
||||
Md4State *state = ms->plugin_data;
|
||||
if (!state) {
|
||||
state = R_NEW0 (Md4State);
|
||||
state->ctx = r_hash_new (false, R_HASH_MD4);
|
||||
if (!state->ctx) {
|
||||
free (state);
|
||||
return false;
|
||||
}
|
||||
r_hash_do_begin (state->ctx, R_HASH_MD4);
|
||||
ms->plugin_data = state;
|
||||
}
|
||||
r_hash_do_md4 (state->ctx, buf, len);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool md4_end(RMutaSession *ms, const ut8 *buf, int len) {
|
||||
if (buf && len > 0) {
|
||||
if (!md4_update (ms, buf, len)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Md4State *state = ms->plugin_data;
|
||||
if (!state || !state->ctx) {
|
||||
return false;
|
||||
}
|
||||
r_hash_do_end (state->ctx, R_HASH_MD4);
|
||||
r_muta_session_append (ms, state->ctx->digest, R_HASH_SIZE_MD4);
|
||||
r_hash_free (state->ctx);
|
||||
state->ctx = NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool md4_fini(RMutaSession *ms) {
|
||||
Md4State *state = ms->plugin_data;
|
||||
if (state) {
|
||||
r_hash_free (state->ctx);
|
||||
R_FREE (ms->plugin_data);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
RMutaPlugin r_muta_plugin_md4 = {
|
||||
.meta = {
|
||||
.name = "md4",
|
||||
.desc = "MD4 hash",
|
||||
.author = "Andrew Tridgell",
|
||||
.license = "GPL-2.0-or-later",
|
||||
},
|
||||
.type = R_MUTA_TYPE_HASH,
|
||||
.implements = "md4",
|
||||
.begin = md4_begin,
|
||||
.update = md4_update,
|
||||
.end = md4_end,
|
||||
.fini = md4_fini
|
||||
};
|
||||
|
||||
#ifndef R2_PLUGIN_INCORE
|
||||
R_API RLibStruct radare_plugin = {
|
||||
.type = R_LIB_TYPE_CRYPTO,
|
||||
.data = &r_muta_plugin_md4,
|
||||
.version = R2_VERSION
|
||||
};
|
||||
#endif
|
||||
106
libr/muta/p/muta_simplehash.c
Normal file
106
libr/muta/p/muta_simplehash.c
Normal file
@@ -0,0 +1,106 @@
|
||||
/* radare - LGPL - Copyright 2024-2026 - pancake */
|
||||
|
||||
#include <r_lib.h>
|
||||
#include <r_muta.h>
|
||||
#include <r_hash.h>
|
||||
#include <r_endian.h>
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
int digest_size;
|
||||
} SimpleHashAlgorithm;
|
||||
|
||||
static const SimpleHashAlgorithm simplehash_algorithms[] = {
|
||||
{ "xorpair", 2 },
|
||||
{ "parity", 1 },
|
||||
{ "hamdist", 1 },
|
||||
{ "pcprint", 1 },
|
||||
{ "mod255", 1 },
|
||||
{ "adler32", 4 },
|
||||
{ "luhn", 1 },
|
||||
{ "elf", 4 },
|
||||
};
|
||||
|
||||
static const SimpleHashAlgorithm *simplehash_find(const char *algo) {
|
||||
const size_t amount = sizeof (simplehash_algorithms) / sizeof (simplehash_algorithms[0]);
|
||||
size_t i;
|
||||
for (i = 0; i < amount; i++) {
|
||||
if (!strcmp (algo, simplehash_algorithms[i].name)) {
|
||||
return &simplehash_algorithms[i];
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static bool simplehash_check(const char *algo) {
|
||||
return simplehash_find (algo) != NULL;
|
||||
}
|
||||
|
||||
static unsigned long elf_hash(const unsigned char *name) {
|
||||
unsigned long h = 0, g;
|
||||
while (*name) {
|
||||
h = (h << 4) + *name++;
|
||||
g = h & 0xf0000000;
|
||||
if (g) {
|
||||
h ^= g >> 24;
|
||||
}
|
||||
h &= ~g;
|
||||
}
|
||||
return h;
|
||||
}
|
||||
|
||||
static bool simplehash_update(RMutaSession *ms, const ut8 *buf, int len) {
|
||||
const SimpleHashAlgorithm *algo = ms->subtype? simplehash_find (ms->subtype): NULL;
|
||||
if (!algo) {
|
||||
return false;
|
||||
}
|
||||
ut8 digest[8] = { 0 };
|
||||
if (!strcmp (algo->name, "xorpair")) {
|
||||
ut16 res = r_hash_xorpair (buf, len);
|
||||
r_write_be16 (digest, res);
|
||||
} else if (!strcmp (algo->name, "parity")) {
|
||||
digest[0] = r_hash_parity (buf, len);
|
||||
} else if (!strcmp (algo->name, "hamdist")) {
|
||||
digest[0] = r_hash_hamdist (buf, len);
|
||||
} else if (!strcmp (algo->name, "pcprint")) {
|
||||
digest[0] = r_hash_pcprint (buf, len);
|
||||
} else if (!strcmp (algo->name, "mod255")) {
|
||||
digest[0] = r_hash_mod255 (buf, len);
|
||||
} else if (!strcmp (algo->name, "adler32")) {
|
||||
ut32 res = r_hash_adler32 (buf, len);
|
||||
r_write_be32 (digest, res);
|
||||
} else if (!strcmp (algo->name, "luhn")) {
|
||||
digest[0] = (ut8)r_hash_luhn (buf, len);
|
||||
} else if (!strcmp (algo->name, "elf")) {
|
||||
ut8 *s = (ut8 *)r_str_ndup ((const char *)buf, len);
|
||||
ut32 res = (ut32)elf_hash (s);
|
||||
free (s);
|
||||
r_write_be32 (digest, res);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
r_muta_session_append (ms, digest, algo->digest_size);
|
||||
return true;
|
||||
}
|
||||
|
||||
RMutaPlugin r_muta_plugin_simplehash = {
|
||||
.meta = {
|
||||
.name = "simplehash",
|
||||
.desc = "Simple hash algorithms (xorpair, parity, hamdist, pcprint, mod255, adler32, luhn, elf)",
|
||||
.author = "pancake",
|
||||
.license = "LGPL-3.0-only",
|
||||
},
|
||||
.type = R_MUTA_TYPE_HASH,
|
||||
.implements = "xorpair,parity,hamdist,pcprint,mod255,adler32,luhn,elf",
|
||||
.check = simplehash_check,
|
||||
.update = simplehash_update,
|
||||
.end = simplehash_update
|
||||
};
|
||||
|
||||
#ifndef R2_PLUGIN_INCORE
|
||||
R_API RLibStruct radare_plugin = {
|
||||
.type = R_LIB_TYPE_CRYPTO,
|
||||
.data = &r_muta_plugin_simplehash,
|
||||
.version = R2_VERSION
|
||||
};
|
||||
#endif
|
||||
36
libr/muta/p/muta_xxhash.c
Normal file
36
libr/muta/p/muta_xxhash.c
Normal file
@@ -0,0 +1,36 @@
|
||||
/* radare - BSD-2-Clause - Copyright 2024-2026 - pancake */
|
||||
/* xxhash algorithm by Yann Collet - BSD-2-Clause */
|
||||
|
||||
#include <r_lib.h>
|
||||
#include <r_muta.h>
|
||||
#include <r_hash.h>
|
||||
#include <r_endian.h>
|
||||
|
||||
static bool xxhash_update(RMutaSession *ms, const ut8 *buf, int len) {
|
||||
ut8 digest[4];
|
||||
ut32 res = r_hash_xxhash (buf, len);
|
||||
r_write_be32 (digest, res);
|
||||
r_muta_session_append (ms, digest, 4);
|
||||
return true;
|
||||
}
|
||||
|
||||
RMutaPlugin r_muta_plugin_xxhash = {
|
||||
.meta = {
|
||||
.name = "xxhash",
|
||||
.desc = "xxHash fast hash algorithm",
|
||||
.author = "Yann Collet",
|
||||
.license = "BSD-2-Clause",
|
||||
},
|
||||
.type = R_MUTA_TYPE_HASH,
|
||||
.implements = "xxhash",
|
||||
.update = xxhash_update,
|
||||
.end = xxhash_update
|
||||
};
|
||||
|
||||
#ifndef R2_PLUGIN_INCORE
|
||||
R_API RLibStruct radare_plugin = {
|
||||
.type = R_LIB_TYPE_CRYPTO,
|
||||
.data = &r_muta_plugin_xxhash,
|
||||
.version = R2_VERSION
|
||||
};
|
||||
#endif
|
||||
9
libr/muta/p/simplehash.mk
Normal file
9
libr/muta/p/simplehash.mk
Normal file
@@ -0,0 +1,9 @@
|
||||
OBJ_SIMPLEHASH=muta_simplehash.o
|
||||
|
||||
STATIC_OBJ+=${OBJ_SIMPLEHASH}
|
||||
TARGET_SIMPLEHASH=muta_simplehash.${EXT_SO}
|
||||
|
||||
ALL_TARGETS+=${TARGET_SIMPLEHASH}
|
||||
|
||||
${TARGET_SIMPLEHASH}: ${OBJ_SIMPLEHASH}
|
||||
$(CC) $(call libname,muta_simplehash) ${LDFLAGS} ${CFLAGS} -o ${TARGET_SIMPLEHASH} ${OBJ_SIMPLEHASH}
|
||||
9
libr/muta/p/xxhash.mk
Normal file
9
libr/muta/p/xxhash.mk
Normal file
@@ -0,0 +1,9 @@
|
||||
OBJ_XXHASH=muta_xxhash.o
|
||||
|
||||
STATIC_OBJ+=${OBJ_XXHASH}
|
||||
TARGET_XXHASH=muta_xxhash.${EXT_SO}
|
||||
|
||||
ALL_TARGETS+=${TARGET_XXHASH}
|
||||
|
||||
${TARGET_XXHASH}: ${OBJ_XXHASH}
|
||||
$(CC) $(call libname,muta_xxhash) ${LDFLAGS} ${CFLAGS} -o ${TARGET_XXHASH} ${OBJ_XXHASH}
|
||||
File diff suppressed because one or more lines are too long
@@ -217,6 +217,7 @@ cryp des-ecb DES with with Electronic Code Book mode
|
||||
sign ed25519 Elliptic curve pubkey cryptographic algorithm used for signing and verification
|
||||
hash entropy Shannon entropy
|
||||
hash fletcher Fletcher hash algorithms (implements: fletcher8,fletcher16,fletcher32,fletcher64)
|
||||
hash md4 MD4 hash
|
||||
hash md5 MD5 hash
|
||||
hash null mutate nothing
|
||||
char punycode Unicoded represented in plain ascii
|
||||
@@ -224,55 +225,13 @@ cryp rc Rivest Cipher (implements: rc2,rc4,rc6)
|
||||
cryp rot Rotate algorithms (rot13, rol, ror) (implements: rot,rol,ror)
|
||||
cryp serpent-ecb Serpent block cipher with Electronic Code Book mode
|
||||
hash sha Secure Hash Algorithm (SHA) (implements: sha1,sha256,sha384,sha512)
|
||||
hash simplehash Simple hash algorithms (xorpair, parity, hamdist, pcprint, mod255, adler32, luhn, elf) (implements: xorpair,parity,hamdist,pcprint,mod255,adler32,luhn,elf)
|
||||
hash sip SipHash-2-4
|
||||
cryp sm4-ecb ShāngMì4 block cipher with Electronic Code Book mode
|
||||
hash ssdeep ssdeep fuzzy hash
|
||||
hash strhash String hash using a modified DJB2 xor
|
||||
cryp xor Byte level Exclusive Or
|
||||
hash md5
|
||||
hash sha1
|
||||
hash sha256
|
||||
hash sha384
|
||||
hash sha512
|
||||
hash md4
|
||||
hash xor
|
||||
hash xorpair
|
||||
hash parity
|
||||
hash entropy
|
||||
hash hamdist
|
||||
hash pcprint
|
||||
hash mod255
|
||||
hash xxhash
|
||||
hash adler32
|
||||
hash luhn
|
||||
hash ssdeep
|
||||
hash crc8smbus
|
||||
hash crc15can
|
||||
hash crc16
|
||||
hash crc16hdlc
|
||||
hash crc16usb
|
||||
hash crc16citt
|
||||
hash crc24
|
||||
hash crc32
|
||||
hash crc32c
|
||||
hash crc32ecma267
|
||||
hash crc32bzip2
|
||||
hash crc32d
|
||||
hash crc32mpeg2
|
||||
hash crc32posix
|
||||
hash crc32q
|
||||
hash crc32jamcrc
|
||||
hash crc32xfer
|
||||
hash crc64
|
||||
hash crc64ecma
|
||||
hash crc64we
|
||||
hash crc64xz
|
||||
hash crc64iso
|
||||
hash fletcher8
|
||||
hash fletcher16
|
||||
hash fletcher32
|
||||
hash fletcher64
|
||||
hash elf
|
||||
hash xxhash xxHash fast hash algorithm
|
||||
EOF
|
||||
RUN
|
||||
|
||||
|
||||
Reference in New Issue
Block a user