Fix #5556 - prints all hashes, even if have gap between the bits

This commit is contained in:
Tiago Gasiba 2016-08-28 19:36:59 +02:00 committed by radare
parent 84e871e456
commit 520106bac9
3 changed files with 12 additions and 8 deletions

View File

@ -271,11 +271,12 @@ static void algolist() {
ut64 bits;
int i;
eprintf ("Available Hashes: \n");
for (i = 0; ; i++) {
bits = ((ut64)1) << i;
for (i = 0; i < R_HASH_NBITS; i++) {
bits = 1ULL << i;
const char *name = r_hash_name (bits);
if (!name || !*name) break;
printf (" %s\n", name);
if (name && *name) {
printf (" %s\n", name);
}
}
eprintf ("\n");
eprintf ("Available Encoders/Decoders: \n");

View File

@ -1590,11 +1590,12 @@ static void disasm_strings(RCore *core, const char *input, RAnalFunction *fcn) {
static void algolist(int mode) {
int i;
for (i = 0; ; i++) {
ut64 bits = ((ut64)1) << i;
for (i = 0; i < R_HASH_NBITS ; i++) {
ut64 bits = 1ULL << i;
const char *name = r_hash_name (bits);
if (!name || !*name) break;
r_cons_println (name);
if (name && *name) {
r_cons_println (name);
}
}
if (!mode) r_cons_newline ();
}

View File

@ -80,6 +80,8 @@ typedef struct r_hash_seed_t {
#define R_HASH_SIZE_HAMDIST 1
#define R_HASH_SIZE_LUHN 1
#define R_HASH_NBITS (8*sizeof(ut64))
#define R_HASH_NONE 0
#define R_HASH_MD5 1
#define R_HASH_SHA1 2