mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 13:52:28 +00:00
Add EncodeHex() and DecodeHex() to Redbean
This commit is contained in:
parent
00acd81b2f
commit
a186143f62
9 changed files with 97 additions and 13 deletions
|
@ -27,6 +27,7 @@
|
|||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/stdio/rand.h"
|
||||
#include "libc/str/blake2.h"
|
||||
#include "libc/str/highwayhash64.h"
|
||||
#include "libc/testlib/ezbench.h"
|
||||
#include "libc/testlib/hyperion.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
|
@ -266,6 +267,13 @@ TEST(sha512, test) {
|
|||
EXPECT_EQ(0, memcmp(want, d, 64));
|
||||
}
|
||||
|
||||
static const uint64_t kTestKey1[4] = {
|
||||
0x0706050403020100,
|
||||
0x0F0E0D0C0B0A0908,
|
||||
0x1716151413121110,
|
||||
0x1F1E1D1C1B1A1918,
|
||||
};
|
||||
|
||||
BENCH(mbedtls, bench) {
|
||||
uint8_t d[64];
|
||||
EZBENCH_N("md5", kHyperionSize, mbedtls_md5_ret(kHyperion, kHyperionSize, d));
|
||||
|
@ -280,6 +288,8 @@ BENCH(mbedtls, bench) {
|
|||
EZBENCH_N("blake2b256", kHyperionSize,
|
||||
BLAKE2B256(kHyperion, kHyperionSize, d));
|
||||
EZBENCH_N("crc32_z", kHyperionSize, crc32_z(0, kHyperion, kHyperionSize));
|
||||
EZBENCH_N("highwayhash64", kHyperionSize,
|
||||
HighwayHash64(kHyperion, kHyperionSize, kTestKey1));
|
||||
}
|
||||
|
||||
char *mpi2str(mbedtls_mpi *m) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue