blake2 hash support (#5995)

This commit is contained in:
Farhan Saiyed 2026-03-06 19:47:59 +05:30 committed by GitHub
parent d6f278e1a5
commit e4464a1c55
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 635 additions and 2 deletions

View file

@ -87,6 +87,7 @@ At the time of writing, these are:
* `use_sys_tree_sitter`
* `use_sys_softfloat`
* `use_sys_zydis`
* `use_sys_blake2`
* `use_sys_blake3`
See [meson_options.txt][] for a complete list of compile-time options.

View file

@ -14,6 +14,12 @@ hash_plugins_list = [
'keccak_384',
'keccak_512',
'sm3',
'blake2b',
'blake2bp',
'blake2xb',
'blake2s',
'blake2sp',
'blake2xs',
'blake3',
'fletcher8',
'fletcher16',
@ -94,6 +100,12 @@ rz_hash_sources = [
'p/algo_crca.c',
'p/algo_adler32.c',
'p/algo_fletcher.c',
'p/algo_blake2b.c',
'p/algo_blake2bp.c',
'p/algo_blake2xb.c',
'p/algo_blake2s.c',
'p/algo_blake2sp.c',
'p/algo_blake2xs.c',
'p/algo_blake3.c',
'p/algo_sm3.c',
'p/algo_md2.c',
@ -132,7 +144,7 @@ rz_hash_sources = [
'algorithms/sha3/sha3.c'
]
dependencies = [mth, rz_util_dep, xxhash_dep, blake3_dep]
dependencies = [mth, rz_util_dep, xxhash_dep, blake3_dep, blake2_dep]
if sys_openssl.found()
dependencies += [sys_openssl]

View file

@ -0,0 +1,83 @@
// SPDX-FileCopyrightText: 2026 Farhan-25 <shadowfinder1799@gmail.com>
// SPDX-License-Identifier: LGPL-3.0-only
#include <rz_hash.h>
#include <rz_util/rz_assert.h>
#include <blake2.h>
/**
* This file implements RzHashPlugin for BLAKE2b:
* - blake2b : sequential, 64-bit optimised, up to 512-bit digest
*/
static void *plugin_blake2b_context_new(void) {
return RZ_NEW0(blake2b_state);
}
static void plugin_blake2b_context_free(void *context) {
free(context);
}
static RzHashSize plugin_blake2b_digest_size(void *context) {
return BLAKE2B_OUTBYTES;
}
static RzHashSize plugin_blake2b_block_size(void *context) {
return BLAKE2B_BLOCKBYTES;
}
static bool plugin_blake2b_init(void *context) {
rz_return_val_if_fail(context, false);
return blake2b_init((blake2b_state *)context, BLAKE2B_OUTBYTES) == 0;
}
static bool plugin_blake2b_update(void *context, const ut8 *data, ut64 size) {
rz_return_val_if_fail(context && data, false);
return blake2b_update((blake2b_state *)context, data, size) == 0;
}
static bool plugin_blake2b_final(void *context, ut8 *digest) {
rz_return_val_if_fail(context && digest, false);
return blake2b_final((blake2b_state *)context, digest, BLAKE2B_OUTBYTES) == 0;
}
static bool plugin_blake2b_small_block(const ut8 *data, ut64 size, ut8 **digest, RzHashSize *digest_size) {
rz_return_val_if_fail(data && digest, false);
ut8 *dgst = malloc(BLAKE2B_OUTBYTES);
if (!dgst) {
return false;
}
if (blake2b(dgst, BLAKE2B_OUTBYTES, data, size, NULL, 0) < 0) {
free(dgst);
return false;
}
*digest = dgst;
if (digest_size) {
*digest_size = BLAKE2B_OUTBYTES;
}
return true;
}
RzHashPlugin rz_hash_plugin_blake2b = {
.name = "blake2b",
.license = "LGPL3",
.author = "Farhan-25",
.description = "BLAKE2b cryptographic hash",
.support_hmac = false,
.context_new = plugin_blake2b_context_new,
.context_free = plugin_blake2b_context_free,
.digest_size = plugin_blake2b_digest_size,
.block_size = plugin_blake2b_block_size,
.init = plugin_blake2b_init,
.update = plugin_blake2b_update,
.final = plugin_blake2b_final,
.small_block = plugin_blake2b_small_block,
};
#ifndef RZ_PLUGIN_INCORE
RZ_API RzLibStruct rizin_plugin_blake2b = {
.type = RZ_LIB_TYPE_HASH,
.data = &rz_hash_plugin_blake2b,
.version = RZ_VERSION
};
#endif

View file

@ -0,0 +1,83 @@
// SPDX-FileCopyrightText: 2026 Farhan-25 <shadowfinder1799@gmail.com>
// SPDX-License-Identifier: LGPL-3.0-only
#include <rz_hash.h>
#include <rz_util/rz_assert.h>
#include <blake2.h>
/**
* This file implements RzHashPlugin for BLAKE2bp:
* - blake2bp : parallel (4-lane) blake2b, up to 512-bit digest
*/
static void *plugin_blake2bp_context_new(void) {
return RZ_NEW0(blake2bp_state);
}
static void plugin_blake2bp_context_free(void *context) {
free(context);
}
static RzHashSize plugin_blake2bp_digest_size(void *context) {
return BLAKE2B_OUTBYTES;
}
static RzHashSize plugin_blake2bp_block_size(void *context) {
return BLAKE2B_BLOCKBYTES;
}
static bool plugin_blake2bp_init(void *context) {
rz_return_val_if_fail(context, false);
return blake2bp_init((blake2bp_state *)context, BLAKE2B_OUTBYTES) == 0;
}
static bool plugin_blake2bp_update(void *context, const ut8 *data, ut64 size) {
rz_return_val_if_fail(context && data, false);
return blake2bp_update((blake2bp_state *)context, data, size) == 0;
}
static bool plugin_blake2bp_final(void *context, ut8 *digest) {
rz_return_val_if_fail(context && digest, false);
return blake2bp_final((blake2bp_state *)context, digest, BLAKE2B_OUTBYTES) == 0;
}
static bool plugin_blake2bp_small_block(const ut8 *data, ut64 size, ut8 **digest, RzHashSize *digest_size) {
rz_return_val_if_fail(data && digest, false);
ut8 *dgst = malloc(BLAKE2B_OUTBYTES);
if (!dgst) {
return false;
}
if (blake2bp(dgst, BLAKE2B_OUTBYTES, data, size, NULL, 0) < 0) {
free(dgst);
return false;
}
*digest = dgst;
if (digest_size) {
*digest_size = BLAKE2B_OUTBYTES;
}
return true;
}
RzHashPlugin rz_hash_plugin_blake2bp = {
.name = "blake2bp",
.license = "LGPL3",
.author = "Farhan-25",
.description = "BLAKE2bp cryptographic hash",
.support_hmac = false,
.context_new = plugin_blake2bp_context_new,
.context_free = plugin_blake2bp_context_free,
.digest_size = plugin_blake2bp_digest_size,
.block_size = plugin_blake2bp_block_size,
.init = plugin_blake2bp_init,
.update = plugin_blake2bp_update,
.final = plugin_blake2bp_final,
.small_block = plugin_blake2bp_small_block,
};
#ifndef RZ_PLUGIN_INCORE
RZ_API RzLibStruct rizin_plugin_blake2bp = {
.type = RZ_LIB_TYPE_HASH,
.data = &rz_hash_plugin_blake2bp,
.version = RZ_VERSION
};
#endif

View file

@ -0,0 +1,83 @@
// SPDX-FileCopyrightText: 2026 Farhan-25 <shadowfinder1799@gmail.com>
// SPDX-License-Identifier: LGPL-3.0-only
#include <rz_hash.h>
#include <rz_util/rz_assert.h>
#include <blake2.h>
/**
* This file implements RzHashPlugin for BLAKE2s:
* - blake2s : sequential, 32-bit optimised, up to 256-bit digest
*/
static void *plugin_blake2s_context_new(void) {
return RZ_NEW0(blake2s_state);
}
static void plugin_blake2s_context_free(void *context) {
free(context);
}
static RzHashSize plugin_blake2s_digest_size(void *context) {
return BLAKE2S_OUTBYTES;
}
static RzHashSize plugin_blake2s_block_size(void *context) {
return BLAKE2S_BLOCKBYTES;
}
static bool plugin_blake2s_init(void *context) {
rz_return_val_if_fail(context, false);
return blake2s_init((blake2s_state *)context, BLAKE2S_OUTBYTES) == 0;
}
static bool plugin_blake2s_update(void *context, const ut8 *data, ut64 size) {
rz_return_val_if_fail(context && data, false);
return blake2s_update((blake2s_state *)context, data, size) == 0;
}
static bool plugin_blake2s_final(void *context, ut8 *digest) {
rz_return_val_if_fail(context && digest, false);
return blake2s_final((blake2s_state *)context, digest, BLAKE2S_OUTBYTES) == 0;
}
static bool plugin_blake2s_small_block(const ut8 *data, ut64 size, ut8 **digest, RzHashSize *digest_size) {
rz_return_val_if_fail(data && digest, false);
ut8 *dgst = malloc(BLAKE2S_OUTBYTES);
if (!dgst) {
return false;
}
if (blake2s(dgst, BLAKE2S_OUTBYTES, data, size, NULL, 0) < 0) {
free(dgst);
return false;
}
*digest = dgst;
if (digest_size) {
*digest_size = BLAKE2S_OUTBYTES;
}
return true;
}
RzHashPlugin rz_hash_plugin_blake2s = {
.name = "blake2s",
.license = "LGPL3",
.author = "Farhan-25",
.description = "BLAKE2s cryptographic hash",
.support_hmac = false,
.context_new = plugin_blake2s_context_new,
.context_free = plugin_blake2s_context_free,
.digest_size = plugin_blake2s_digest_size,
.block_size = plugin_blake2s_block_size,
.init = plugin_blake2s_init,
.update = plugin_blake2s_update,
.final = plugin_blake2s_final,
.small_block = plugin_blake2s_small_block,
};
#ifndef RZ_PLUGIN_INCORE
RZ_API RzLibStruct rizin_plugin_blake2s = {
.type = RZ_LIB_TYPE_HASH,
.data = &rz_hash_plugin_blake2s,
.version = RZ_VERSION
};
#endif

View file

@ -0,0 +1,83 @@
// SPDX-FileCopyrightText: 2026 Farhan-25 <shadowfinder1799@gmail.com>
// SPDX-License-Identifier: LGPL-3.0-only
#include <rz_hash.h>
#include <rz_util/rz_assert.h>
#include <blake2.h>
/**
* This file implements RzHashPlugin for BLAKE2sp:
* - blake2sp : parallel (8-lane) blake2s, up to 256-bit digest
*/
static void *plugin_blake2sp_context_new(void) {
return RZ_NEW0(blake2sp_state);
}
static void plugin_blake2sp_context_free(void *context) {
free(context);
}
static RzHashSize plugin_blake2sp_digest_size(void *context) {
return BLAKE2S_OUTBYTES;
}
static RzHashSize plugin_blake2sp_block_size(void *context) {
return BLAKE2S_BLOCKBYTES;
}
static bool plugin_blake2sp_init(void *context) {
rz_return_val_if_fail(context, false);
return blake2sp_init((blake2sp_state *)context, BLAKE2S_OUTBYTES) == 0;
}
static bool plugin_blake2sp_update(void *context, const ut8 *data, ut64 size) {
rz_return_val_if_fail(context && data, false);
return blake2sp_update((blake2sp_state *)context, data, size) == 0;
}
static bool plugin_blake2sp_final(void *context, ut8 *digest) {
rz_return_val_if_fail(context && digest, false);
return blake2sp_final((blake2sp_state *)context, digest, BLAKE2S_OUTBYTES) == 0;
}
static bool plugin_blake2sp_small_block(const ut8 *data, ut64 size, ut8 **digest, RzHashSize *digest_size) {
rz_return_val_if_fail(data && digest, false);
ut8 *dgst = malloc(BLAKE2S_OUTBYTES);
if (!dgst) {
return false;
}
if (blake2sp(dgst, BLAKE2S_OUTBYTES, data, size, NULL, 0) < 0) {
free(dgst);
return false;
}
*digest = dgst;
if (digest_size) {
*digest_size = BLAKE2S_OUTBYTES;
}
return true;
}
RzHashPlugin rz_hash_plugin_blake2sp = {
.name = "blake2sp",
.license = "LGPL3",
.author = "Farhan-25",
.description = "BLAKE2sp cryptographic hash",
.support_hmac = false,
.context_new = plugin_blake2sp_context_new,
.context_free = plugin_blake2sp_context_free,
.digest_size = plugin_blake2sp_digest_size,
.block_size = plugin_blake2sp_block_size,
.init = plugin_blake2sp_init,
.update = plugin_blake2sp_update,
.final = plugin_blake2sp_final,
.small_block = plugin_blake2sp_small_block,
};
#ifndef RZ_PLUGIN_INCORE
RZ_API RzLibStruct rizin_plugin_blake2sp = {
.type = RZ_LIB_TYPE_HASH,
.data = &rz_hash_plugin_blake2sp,
.version = RZ_VERSION
};
#endif

View file

@ -0,0 +1,83 @@
// SPDX-FileCopyrightText: 2026 Farhan-25 <shadowfinder1799@gmail.com>
// SPDX-License-Identifier: LGPL-3.0-only
#include <rz_hash.h>
#include <rz_util/rz_assert.h>
#include <blake2.h>
/**
* This file implements RzHashPlugin for BLAKE2xb:
* - blake2xb : extendable-output (XOF) built on blake2b, arbitrary digest length
*/
static void *plugin_blake2xb_context_new(void) {
return RZ_NEW0(blake2xb_state);
}
static void plugin_blake2xb_context_free(void *context) {
free(context);
}
static RzHashSize plugin_blake2xb_digest_size(void *context) {
return BLAKE2B_OUTBYTES;
}
static RzHashSize plugin_blake2xb_block_size(void *context) {
return BLAKE2B_BLOCKBYTES;
}
static bool plugin_blake2xb_init(void *context) {
rz_return_val_if_fail(context, false);
return blake2xb_init((blake2xb_state *)context, BLAKE2B_OUTBYTES) == 0;
}
static bool plugin_blake2xb_update(void *context, const ut8 *data, ut64 size) {
rz_return_val_if_fail(context && data, false);
return blake2xb_update((blake2xb_state *)context, data, size) == 0;
}
static bool plugin_blake2xb_final(void *context, ut8 *digest) {
rz_return_val_if_fail(context && digest, false);
return blake2xb_final((blake2xb_state *)context, digest, BLAKE2B_OUTBYTES) == 0;
}
static bool plugin_blake2xb_small_block(const ut8 *data, ut64 size, ut8 **digest, RzHashSize *digest_size) {
rz_return_val_if_fail(data && digest, false);
ut8 *dgst = malloc(BLAKE2B_OUTBYTES);
if (!dgst) {
return false;
}
if (blake2xb(dgst, BLAKE2B_OUTBYTES, data, size, NULL, 0) < 0) {
free(dgst);
return false;
}
*digest = dgst;
if (digest_size) {
*digest_size = BLAKE2B_OUTBYTES;
}
return true;
}
RzHashPlugin rz_hash_plugin_blake2xb = {
.name = "blake2xb",
.license = "LGPL3",
.author = "Farhan-25",
.description = "BLAKE2xb cryptographic hash",
.support_hmac = false,
.context_new = plugin_blake2xb_context_new,
.context_free = plugin_blake2xb_context_free,
.digest_size = plugin_blake2xb_digest_size,
.block_size = plugin_blake2xb_block_size,
.init = plugin_blake2xb_init,
.update = plugin_blake2xb_update,
.final = plugin_blake2xb_final,
.small_block = plugin_blake2xb_small_block,
};
#ifndef RZ_PLUGIN_INCORE
RZ_API RzLibStruct rizin_plugin_blake2xb = {
.type = RZ_LIB_TYPE_HASH,
.data = &rz_hash_plugin_blake2xb,
.version = RZ_VERSION
};
#endif

View file

@ -0,0 +1,83 @@
// SPDX-FileCopyrightText: 2026 Farhan-25 <shadowfinder1799@gmail.com>
// SPDX-License-Identifier: LGPL-3.0-only
#include <rz_hash.h>
#include <rz_util/rz_assert.h>
#include <blake2.h>
/**
* This file implements RzHashPlugin for BLAKE2xs:
* - blake2xs : extendable-output (XOF) built on blake2s, arbitrary digest length
*/
static void *plugin_blake2xs_context_new(void) {
return RZ_NEW0(blake2xs_state);
}
static void plugin_blake2xs_context_free(void *context) {
free(context);
}
static RzHashSize plugin_blake2xs_digest_size(void *context) {
return BLAKE2S_OUTBYTES;
}
static RzHashSize plugin_blake2xs_block_size(void *context) {
return BLAKE2S_BLOCKBYTES;
}
static bool plugin_blake2xs_init(void *context) {
rz_return_val_if_fail(context, false);
return blake2xs_init((blake2xs_state *)context, BLAKE2S_OUTBYTES) == 0;
}
static bool plugin_blake2xs_update(void *context, const ut8 *data, ut64 size) {
rz_return_val_if_fail(context && data, false);
return blake2xs_update((blake2xs_state *)context, data, size) == 0;
}
static bool plugin_blake2xs_final(void *context, ut8 *digest) {
rz_return_val_if_fail(context && digest, false);
return blake2xs_final((blake2xs_state *)context, digest, BLAKE2S_OUTBYTES) == 0;
}
static bool plugin_blake2xs_small_block(const ut8 *data, ut64 size, ut8 **digest, RzHashSize *digest_size) {
rz_return_val_if_fail(data && digest, false);
ut8 *dgst = malloc(BLAKE2S_OUTBYTES);
if (!dgst) {
return false;
}
if (blake2xs(dgst, BLAKE2S_OUTBYTES, data, size, NULL, 0) < 0) {
free(dgst);
return false;
}
*digest = dgst;
if (digest_size) {
*digest_size = BLAKE2S_OUTBYTES;
}
return true;
}
RzHashPlugin rz_hash_plugin_blake2xs = {
.name = "blake2xs",
.license = "LGPL3",
.author = "Farhan-25",
.description = "BLAKE2xs cryptographic hash",
.support_hmac = false,
.context_new = plugin_blake2xs_context_new,
.context_free = plugin_blake2xs_context_free,
.digest_size = plugin_blake2xs_digest_size,
.block_size = plugin_blake2xs_block_size,
.init = plugin_blake2xs_init,
.update = plugin_blake2xs_update,
.final = plugin_blake2xs_final,
.small_block = plugin_blake2xs_small_block,
};
#ifndef RZ_PLUGIN_INCORE
RZ_API RzLibStruct rizin_plugin_blake2xs = {
.type = RZ_LIB_TYPE_HASH,
.data = &rz_hash_plugin_blake2xs,
.version = RZ_VERSION
};
#endif

View file

@ -316,6 +316,8 @@ libdemangle_options = [
libdemangle_proj = subproject('libdemangle', default_options: libdemangle_options)
libdemangle_dep = libdemangle_proj.get_variable('libdemangle_dep')
blake2_dep = dependency('libblake2', fallback: ['blake2', 'libblake2_dep'])
# handle blake3 algo
blake3_dep = dependency('libblake3', required: get_option('use_sys_blake3'), static: is_static_build)
if not blake3_dep.found()
@ -879,6 +881,7 @@ summary({
'System zstd library': libzstd_dep.found() and libzstd_dep.type_name() != 'internal',
'System zip library': libzip_dep.found() and libzip_dep.type_name() != 'internal',
'System blake3 library': blake3_dep.found() and blake3_dep.type_name() != 'internal',
'System blake2 library': blake2_dep.found() and blake2_dep.type_name() != 'internal',
'Use ptrace-wrap': use_ptrace_wrap,
'Use RPATH': rpath_summary,
}, section: 'Configuration', bool_yn: true)

View file

@ -38,6 +38,7 @@ option('use_sys_libmspack', type: 'feature', value: 'disabled')
option('use_sys_tree_sitter', type: 'feature', value: 'disabled')
option('use_sys_pcre2', type: 'feature', value: 'disabled')
option('use_sys_softfloat', type: 'feature', value: 'disabled')
option('use_sys_blake2', type: 'feature', value: 'disabled')
option('use_sys_blake3', type: 'feature', value: 'disabled')
option('use_gpl', type: 'boolean', value: true, description: 'Set to false when you want to disable gpl code')
option('install_sigdb', type: 'boolean', value: false, description: 'Downloads and installs rizin sigdb')

5
subprojects/blake2.wrap Normal file
View file

@ -0,0 +1,5 @@
[wrap-git]
url = https://github.com/BLAKE2/BLAKE2.git
revision = ed1974ea83433eba7b2d95c5dcd9ac33cb847913
patch_directory = blake2
depth = 1

View file

@ -0,0 +1,29 @@
project('blake2', 'c',
version : '0.0.1',
license : 'CC0',
meson_version : '>=0.57.0',
)
blake2_inc = include_directories('ref')
blake2_sources = files(
'ref/blake2b-ref.c',
'ref/blake2s-ref.c',
'ref/blake2bp-ref.c',
'ref/blake2sp-ref.c',
'ref/blake2xb-ref.c',
'ref/blake2xs-ref.c',
)
blake2_lib = static_library('blake2',
blake2_sources,
include_directories : blake2_inc,
install : false,
)
libblake2_dep = declare_dependency(
link_with : blake2_lib,
include_directories : blake2_inc,
)
meson.override_dependency('libblake2', libblake2_dep)

File diff suppressed because one or more lines are too long

View file

@ -205,6 +205,12 @@ CMDS=!rz-hash -L
EXPECT=<<EOF
flags algorithm license author
____h_ adler32 LGPL3 deroad Adler-32 checksum
____h_ blake2b LGPL3 Farhan-25 BLAKE2b cryptographic hash
____h_ blake2bp LGPL3 Farhan-25 BLAKE2bp cryptographic hash
____h_ blake2s LGPL3 Farhan-25 BLAKE2s cryptographic hash
____h_ blake2sp LGPL3 Farhan-25 BLAKE2sp cryptographic hash
____h_ blake2xb LGPL3 Farhan-25 BLAKE2xb cryptographic hash
____h_ blake2xs LGPL3 Farhan-25 BLAKE2xs cryptographic hash
____h_ blake3 CC0 Samuel Neves,Jack O'Connor BLAKE3 cryptographic hash
____h_ crc15can LGPL3 deroad CRC-15 CAN checksum
____h_ crc16 LGPL3 deroad CRC-16 IBM/ARC checksum
@ -685,6 +691,12 @@ FILE==
CMDS=!rz-hash -a all -s "admin" -c 21232f297a57a5a743894a0e4a801fc3
EXPECT=<<EOF
string: 0x00000000-0x00000005 adler32: computed hash doesn't match the expected one
string: 0x00000000-0x00000005 blake2b: computed hash doesn't match the expected one
string: 0x00000000-0x00000005 blake2bp: computed hash doesn't match the expected one
string: 0x00000000-0x00000005 blake2s: computed hash doesn't match the expected one
string: 0x00000000-0x00000005 blake2sp: computed hash doesn't match the expected one
string: 0x00000000-0x00000005 blake2xb: computed hash doesn't match the expected one
string: 0x00000000-0x00000005 blake2xs: computed hash doesn't match the expected one
string: 0x00000000-0x00000005 blake3: computed hash doesn't match the expected one
string: 0x00000000-0x00000005 crc15can: computed hash doesn't match the expected one
string: 0x00000000-0x00000005 crc16: computed hash doesn't match the expected one
@ -1496,6 +1508,54 @@ string: 0x00000000-0x00000005 blake3: d289b2da9b7051f36b4e396e0af3e069e78cf119a7
EOF
RUN
NAME=rz-hash -a blake2b -s "hello"
FILE==
CMDS=!rz-hash -a blake2b -s "hello"
EXPECT=<<EOF
string: 0x00000000-0x00000005 blake2b: e4cfa39a3d37be31c59609e807970799caa68a19bfaa15135f165085e01d41a65ba1e1b146aeb6bd0092b49eac214c103ccfa3a365954bbbe52f74a2b3620c94
EOF
RUN
NAME=rz-hash -a blake2bp -s "hello"
FILE==
CMDS=!rz-hash -a blake2bp -s "hello"
EXPECT=<<EOF
string: 0x00000000-0x00000005 blake2bp: 3d9b524855d3675f3ccbe8e189b3f00a2712ba7301f9b88a7e31aad4916777459953a70f9c98869bc39872591c30e6dfa5b5decbfcf977c909db9f9f7e4441d1
EOF
RUN
NAME=rz-hash -a blake2xb -s "hello"
FILE==
CMDS=!rz-hash -a blake2xb -s "hello"
EXPECT=<<EOF
string: 0x00000000-0x00000005 blake2xb: e06286c0a7a340b49cc1c1a187ff088349d6ff51c225ca613f7d46a95f158942b7990b33c0caf9f3a1f4bede9f45d929bcfc028b348185c42040b2477b538df1
EOF
RUN
NAME=rz-hash -a blake2s -s "hello"
FILE==
CMDS=!rz-hash -a blake2s -s "hello"
EXPECT=<<EOF
string: 0x00000000-0x00000005 blake2s: 19213bacc58dee6dbde3ceb9a47cbb330b3d86f8cca8997eb00be456f140ca25
EOF
RUN
NAME=rz-hash -a blake2sp -s "hello"
FILE==
CMDS=!rz-hash -a blake2sp -s "hello"
EXPECT=<<EOF
string: 0x00000000-0x00000005 blake2sp: 223dfe42565ddf97210b34a384860b603717d5c63c1872c9fc99f1b15de6631b
EOF
RUN
NAME=rz-hash -a blake2xs -s "hello"
FILE==
CMDS=!rz-hash -a blake2xs -s "hello"
EXPECT=<<EOF
string: 0x00000000-0x00000005 blake2xs: b80636fc190a0bcfd71bb107167ecc7613cc84fbf96094db27a9f67086dd7b2e
EOF
RUN
NAME=rz-hash -a ssdeep -s "admin"
FILE==
CMDS=!rz-hash -a ssdeep -s "admin"

View file

@ -57,6 +57,12 @@ static hash_data_t hashes_to_test[] = {
{ INDATA("password"), .algo = "keccak-512", .expected = "a6818b8188b36c44d17784c5551f63accc5deaf8786f9d0ad1ae3cd8d887cbab4f777286dbb315fb14854c8774dc0d10b5567e4a705536cc2a1d61ec0a16a7a6" },
{ INDATA("password"), .algo = "sm3", .expected = "08594e140bcc046e345325435218f67a85c38c63de6443b197b544d70ee62f26" },
{ INDATA("password"), .algo = "blake3", .expected = "7f2611ba158b6dcea4a69c229c303358c5e04493abeadee106a4bfa464d55787" },
{ INDATA("password"), .algo = "blake2b", .expected = "7c863950ac93c93692995e4732ce1e1466ad74a775352ffbaaf2a4a4ce9b549d0b414a1f3150452be6c7c72c694a7cb46f76452917298d33e67611f0a42addb8" },
{ INDATA("password"), .algo = "blake2bp", .expected = "080da63448654deb2826ef1ba1d64757a86f4c244f2133b5d6d8f469d002817c13b84f8f13267a7e184e7376e4ba5474fe7d54d9c3f673db98082d3a474f7841" },
{ INDATA("password"), .algo = "blake2xb", .expected = "67847f0ef823e963181c83c5e509d951eb4a1a913630712669305358e870af17e414adcd1c008c74d22df605f3cd62a754dfd89686685391a0ed00b955666b7f" },
{ INDATA("password"), .algo = "blake2s", .expected = "4c81099df884bd6e14a639d648bccd808512e48af211ae4f44d545ea6d5e5f2b" },
{ INDATA("password"), .algo = "blake2sp", .expected = "6aa61cf2fe9824e67d30317c353e4b6f9ecd6203db5b7679c9a1ceaab787f1b8" },
{ INDATA("password"), .algo = "blake2xs", .expected = "666e7dfa9ce67d0b762f8abb4a66d361d744682f8df50d37cdb62ee469ad9b55" },
{ INDATA("password"), .algo = "fletcher8", .expected = "76" },
{ INDATA("password"), .algo = "fletcher16", .expected = "7698" },
{ INDATA("password"), .algo = "fletcher32", .expected = "cda87d23" },