Add EncodeHex() and DecodeHex() to Redbean

This commit is contained in:
Justine Tunney 2023-07-06 15:38:08 -07:00
parent 00acd81b2f
commit a186143f62
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
9 changed files with 97 additions and 13 deletions

View file

@ -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) {