Rizin
unix-like reverse engineering framework and cli tools
|
#include <stdio.h>
#include <string.h>
#include <rz_io.h>
#include <rz_main.h>
#include <rz_hash.h>
#include <rz_util/rz_print.h>
#include <rz_util.h>
#include <rz_crypto.h>
#include <rz_lib.h>
Go to the source code of this file.
Classes | |
struct | RzHashBuffer |
struct | RzHashOffset |
struct | rz_hash_context |
Macros | |
#define | RZ_HASH_DEFAULT_BLOCK_SIZE 0x1000 |
#define | rz_hash_bool_error(x, o, f, ...) |
#define | rz_hash_error(x, o, f, ...) |
#define | rz_hash_set_val(x, k, d, v) |
#define | rz_hash_ctx_set_val(x, k, d, v) |
#define | rz_hash_ctx_set_bool(x, k, i, t, f) |
#define | rz_hash_ctx_set_quiet(x) |
#define | rz_hash_ctx_set_signed(x, k, i) |
#define | rz_hash_ctx_set_unsigned(x, k, i) |
#define | rz_hash_ctx_set_input(x, k, s, h) |
#define | rz_hash_ctx_set_mode(x, m) rz_hash_ctx_set_val(x, mode, RZ_HASH_MODE_STANDARD, m) |
#define | rz_hash_ctx_set_op(x, o) rz_hash_ctx_set_val(x, operation, RZ_HASH_OP_UNKNOWN, o) |
#define | rz_hash_ctx_set_str(x, k, s) rz_hash_ctx_set_val(x, k, NULL, strdup(s)) |
Typedefs | |
typedef struct rz_hash_context | RzHashContext |
typedef bool(* | RzHashRun) (RzHashContext *ctx, RzIO *io, const char *filename) |
Enumerations | |
enum | RzHashMode { RZ_HASH_MODE_STANDARD = 0 , RZ_HASH_MODE_JSON , RZ_HASH_MODE_RANDOMART , RZ_HASH_MODE_QUIET , RZ_HASH_MODE_VERY_QUIET } |
enum | RzHashOp { RZ_HASH_OP_UNKNOWN = 0 , RZ_HASH_OP_ERROR , RZ_HASH_OP_HELP , RZ_HASH_OP_USAGE , RZ_HASH_OP_VERSION , RZ_HASH_OP_LIST_ALGO , RZ_HASH_OP_HASH , RZ_HASH_OP_DECRYPT , RZ_HASH_OP_ENCRYPT , RZ_HASH_OP_LUHN } |
#define rz_hash_ctx_set_mode | ( | x, | |
m | |||
) | rz_hash_ctx_set_val(x, mode, RZ_HASH_MODE_STANDARD, m) |
#define rz_hash_ctx_set_op | ( | x, | |
o | |||
) | rz_hash_ctx_set_val(x, operation, RZ_HASH_OP_UNKNOWN, o) |
#define rz_hash_ctx_set_quiet | ( | x | ) |
typedef struct rz_hash_context RzHashContext |
enum RzHashMode |
enum RzHashOp |
|
static |
Definition at line 977 of file rz-hash.c.
References rz_io_t::desc, free(), hash_parse_hexadecimal(), hash_parse_string(), hash_print_crypto(), malloc(), NULL, read(), RZ_CRYPTO_DIR_DECRYPT, rz_crypto_final(), rz_crypto_free(), rz_crypto_get_output(), rz_crypto_new(), rz_crypto_set_iv(), rz_crypto_set_key(), rz_crypto_update(), rz_crypto_use(), rz_io_desc_size(), rz_io_pread_at(), RZ_LOG_ERROR, to, and ut64().
Referenced by rz_main_rz_hash().
|
static |
Definition at line 1053 of file rz-hash.c.
References rz_io_t::desc, free(), hash_parse_hexadecimal(), hash_parse_string(), hash_print_crypto(), malloc(), NULL, read(), RZ_CRYPTO_DIR_ENCRYPT, rz_crypto_final(), rz_crypto_free(), rz_crypto_get_output(), rz_crypto_new(), rz_crypto_set_iv(), rz_crypto_set_key(), rz_crypto_update(), rz_crypto_use(), rz_io_desc_size(), rz_io_pread_at(), RZ_LOG_ERROR, to, and ut64().
Referenced by rz_main_rz_hash().
|
static |
Definition at line 800 of file rz-hash.c.
References rz_io_t::desc, free(), hash_context_compare_hashes(), hash_parse_hexadecimal(), hash_print_digest(), malloc(), benchmark::md, NULL, parse_hash_algorithms(), pj_end(), pj_o(), read(), rz_hash_cfg_configure(), rz_hash_cfg_final(), rz_hash_cfg_free(), rz_hash_cfg_get_result(), rz_hash_cfg_hmac(), rz_hash_cfg_init(), rz_hash_cfg_iterate(), rz_hash_cfg_new(), rz_hash_cfg_update(), RZ_HASH_MODE_JSON, rz_io_desc_size(), rz_io_pread_at(), rz_list_free(), rz_list_length(), RZ_LOG_ERROR, to, and ut64().
Referenced by rz_main_rz_hash().
|
static |
Definition at line 1135 of file rz-hash.c.
References from, input(), PFMT64u, PFMT64x, pj_end(), pj_kb(), pj_kn(), pj_ks(), pj_o(), printf(), rz_calculate_luhn_value(), RZ_HASH_MODE_JSON, RZ_HASH_MODE_QUIET, RZ_HASH_MODE_RANDOMART, RZ_HASH_MODE_STANDARD, RZ_HASH_MODE_VERY_QUIET, RZ_LOG_ERROR, snprintf, to, ut64(), and value.
Referenced by rz_main_rz_hash().
|
static |
Definition at line 760 of file rz-hash.c.
References PFMT64x, pj_kb(), pj_kn(), pj_ks(), printf(), RZ_HASH_MODE_JSON, RZ_HASH_MODE_QUIET, RZ_HASH_MODE_RANDOMART, RZ_HASH_MODE_STANDARD, RZ_HASH_MODE_VERY_QUIET, to, and ut64().
Referenced by calculate_hash().
Definition at line 500 of file rz-hash.c.
References desc, free(), NULL, rz_io_desc_close(), rz_io_open_nomap(), rz_io_pwrite_at(), RZ_LOG_ERROR, RZ_PERM_R, rz_stdin_slurp(), rz_str_newf(), and rz_warn_if_reached.
Referenced by hash_context_run().
Definition at line 536 of file rz-hash.c.
References desc, free(), hash_parse_hexadecimal(), hash_parse_string(), input(), is_string(), NULL, PFMTSZu, rz_io_desc_close(), rz_io_open_nomap(), rz_io_pwrite_at(), RZ_LOG_ERROR, RZ_PERM_R, rz_str_newf(), and rz_warn_if_reached.
Referenced by hash_context_run().
|
static |
Definition at line 489 of file rz-hash.c.
References free(), pj_free(), and rz_hash_free().
Referenced by rz_main_rz_hash().
|
static |
Definition at line 585 of file rz-hash.c.
References desc, hash_context_create_desc_io_stdin(), hash_context_create_desc_io_string(), i, NULL, pj_end(), pj_ka(), pj_new(), pj_o(), pj_string(), printf(), run(), RZ_HASH_MODE_JSON, rz_io_desc_close(), rz_io_free(), rz_io_new(), rz_io_open_nomap(), RZ_LOG_ERROR, RZ_PERM_R, and rz_warn_if_reached.
Referenced by rz_main_rz_hash().
|
static |
Definition at line 1179 of file rz-hash.c.
References free(), lib_hash_cb(), NULL, path, rz_lib_add_handler(), RZ_LIB_ENV, rz_lib_free(), rz_lib_new(), rz_lib_opendir(), RZ_LIB_TYPE_HASH, rz_path_home_prefix(), rz_path_system(), RZ_PLUGINS, RZ_STR_ISEMPTY, rz_sys_getenv(), and autogen_x86imm::tmp.
Referenced by rz_main_rz_hash().
|
static |
Definition at line 290 of file rz-hash.c.
References RzHashBuffer::buf, hash_parse_hexadecimal(), hash_parse_string(), RzHashBuffer::len, rz_file_slurp(), rz_hash_bool_error, RZ_HASH_OP_ERROR, and rz_stdin_slurp().
Referenced by hash_parse_cmdline().
|
static |
Definition at line 318 of file rz-hash.c.
References rz_getopt_t::arg, argv, c, compare(), hash_parse_any(), i, rz_getopt_t::ind, input(), IS_NULLSTR, key, len, NULL, PFMT64u, rz_file_is_directory(), rz_getopt_init(), rz_getopt_next(), rz_hash_ctx_set_bool, rz_hash_ctx_set_input, rz_hash_ctx_set_mode, rz_hash_ctx_set_op, rz_hash_ctx_set_quiet, rz_hash_ctx_set_signed, rz_hash_ctx_set_str, rz_hash_ctx_set_unsigned, RZ_HASH_DEFAULT_BLOCK_SIZE, rz_hash_error, RZ_HASH_MODE_JSON, RZ_HASH_MODE_RANDOMART, RZ_HASH_OP_DECRYPT, RZ_HASH_OP_ENCRYPT, RZ_HASH_OP_ERROR, RZ_HASH_OP_HASH, RZ_HASH_OP_HELP, RZ_HASH_OP_LIST_ALGO, RZ_HASH_OP_LUHN, RZ_HASH_OP_USAGE, RZ_HASH_OP_VERSION, rz_hash_set_val, and RZ_NEWS.
Referenced by rz_main_rz_hash().
|
static |
Definition at line 254 of file rz-hash.c.
References b, free(), malloc(), NULL, rz_hex_str2bin(), RZ_LOG_ERROR, rz_stdin_slurp(), and st64.
Referenced by calculate_decrypt(), calculate_encrypt(), calculate_hash(), hash_context_create_desc_io_string(), and hash_parse_any().
|
static |
Definition at line 222 of file rz-hash.c.
References b, free(), malloc(), memcpy(), NULL, RZ_LOG_ERROR, rz_stdin_slurp(), and rz_str_unescape().
Referenced by calculate_decrypt(), calculate_encrypt(), hash_context_create_desc_io_string(), and hash_parse_any().
|
static |
Definition at line 667 of file rz-hash.c.
References free(), from, i, len, malloc(), memcpy(), PFMT64x, pj_kn(), pj_ks(), printf(), RZ_HASH_MODE_JSON, RZ_HASH_MODE_QUIET, RZ_HASH_MODE_RANDOMART, RZ_HASH_MODE_STANDARD, RZ_HASH_MODE_VERY_QUIET, RZ_HASH_OP_ENCRYPT, RZ_LOG_ERROR, snprintf, to, value, and write.
Referenced by calculate_decrypt(), and calculate_encrypt().
|
static |
Definition at line 717 of file rz-hash.c.
References free(), from, len, benchmark::md, NULL, PFMT64x, pj_kb(), pj_kn(), pj_ks(), printf(), rz_hash_cfg_get_result(), rz_hash_cfg_get_result_string(), rz_hash_cfg_randomart(), RZ_HASH_MODE_JSON, RZ_HASH_MODE_QUIET, RZ_HASH_MODE_RANDOMART, RZ_HASH_MODE_STANDARD, RZ_HASH_MODE_VERY_QUIET, to, and value.
Referenced by calculate_hash().
|
static |
Definition at line 1173 of file rz-hash.c.
References rz_hash_plugin_add().
Referenced by hash_load_plugins().
|
static |
Definition at line 785 of file rz-hash.c.
References i, list(), rz_hash_plugin_t::name, NULL, rz_hash_plugin_by_index(), rz_list_append(), rz_list_newf(), rz_str_split_list(), and ut64().
Referenced by calculate_hash().
|
static |
Definition at line 109 of file rz-hash.c.
References rz_crypto_plugin_t::author, rz_hash_plugin_t::author, flags, i, rz_crypto_plugin_t::license, rz_hash_plugin_t::license, rz_crypto_plugin_t::name, rz_hash_plugin_t::name, printf(), rz_crypto_plugin_by_index(), rz_hash_plugin_by_index(), snprintf, and rz_hash_plugin_t::support_hmac.
Referenced by rz_main_rz_hash().
|
static |
Definition at line 72 of file rz-hash.c.
References printf().
Referenced by rz_main_rz_hash().
Definition at line 1205 of file rz-hash.c.
References argv, calculate_decrypt(), calculate_encrypt(), calculate_hash(), calculate_luhn(), hash_context_fini(), hash_context_run(), hash_load_plugins(), hash_parse_cmdline(), rz_hash_new(), RZ_HASH_OP_DECRYPT, RZ_HASH_OP_ENCRYPT, RZ_HASH_OP_ERROR, RZ_HASH_OP_HASH, RZ_HASH_OP_HELP, RZ_HASH_OP_LIST_ALGO, RZ_HASH_OP_LUHN, RZ_HASH_OP_USAGE, RZ_HASH_OP_VERSION, rz_hash_show_algorithms(), rz_hash_show_help(), and rz_main_version_print().
Referenced by MAIN_NAME().