mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-11 06:55:01 +00:00
Fix #1220 - Implement #parity
This commit is contained in:
parent
0fbe8700d6
commit
7def7f0413
@ -13,6 +13,7 @@ static void handle_crc16 (const ut8 *block, int len);
|
||||
static void handle_xor (const ut8 *block, int len);
|
||||
static void handle_entropy (const ut8 *block, int len);
|
||||
static void handle_hamdist (const ut8 *block, int len);
|
||||
static void handle_parity (const ut8 *block, int len);
|
||||
static void handle_pcprint (const ut8 *input, int len);
|
||||
|
||||
typedef struct {
|
||||
@ -31,6 +32,7 @@ static RHashHashHandlers HASH_HANDLERS[] = {
|
||||
{"crc16", handle_crc16},
|
||||
{"xor", handle_xor},
|
||||
{"entropy", handle_entropy},
|
||||
{"parity", handle_parity},
|
||||
{"hamdist", handle_hamdist},
|
||||
{"pcprint", handle_pcprint},
|
||||
{NULL, NULL},
|
||||
@ -103,6 +105,10 @@ static void handle_entropy (const ut8 *block, int len) {
|
||||
r_cons_printf ("%f\n", r_hash_entropy (block, len));
|
||||
}
|
||||
|
||||
static void handle_parity (const ut8 *block, int len) {
|
||||
r_cons_printf ("%d\n", r_hash_parity (block, len)?1:0);
|
||||
}
|
||||
|
||||
static void handle_hamdist (const ut8 *block, int len) {
|
||||
r_cons_printf ("%02x\n", r_hash_hamdist (block, len));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user