Skip to content

Commit

Permalink
Refine hashing support.
Browse files Browse the repository at this point in the history
  • Loading branch information
dfaranha committed Jan 25, 2025
1 parent 6f22ae0 commit 0cff31b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
12 changes: 6 additions & 6 deletions bench/bench_ep.c
Original file line number Diff line number Diff line change
Expand Up @@ -575,15 +575,15 @@ static void arith(void) {
}

BENCH_RUN("ep_map") {
uint8_t msg[5];
rand_bytes(msg, 5);
BENCH_ADD(ep_map(p, msg, 5));
uint8_t msg[4 * RLC_FP_BYTES];
rand_bytes(msg, ep_map_rnd_size());
BENCH_ADD(ep_map(p, msg, ep_map_rnd_size()));
} BENCH_END;

BENCH_RUN("ep_map_rnd") {
uint8_t msg[5];
rand_bytes(msg, 5);
BENCH_ADD(ep_map_rnd(p, msg, 5));
uint8_t msg[4 * RLC_FP_BYTES];
rand_bytes(msg, ep_map_rnd_size());
BENCH_ADD(ep_map_rnd(p, msg, ep_map_rnd_size()));
} BENCH_END;

#if EP_MAP == BASIC || !defined(STRIP)
Expand Down
2 changes: 2 additions & 0 deletions include/relic_label.h
Original file line number Diff line number Diff line change
Expand Up @@ -1012,6 +1012,7 @@
#undef ep_map_basic
#undef ep_map_sswum
#undef ep_map_swift
#undef ep_map_rnd_size
#undef ep_map_rnd
#undef ep_pck
#undef ep_upk
Expand Down Expand Up @@ -1107,6 +1108,7 @@
#define ep_map_basic RLC_PREFIX(ep_map_basic)
#define ep_map_sswum RLC_PREFIX(ep_map_sswum)
#define ep_map_swift RLC_PREFIX(ep_map_swift)
#define ep_map_rnd_size RLC_PREFIX(ep_map_rnd_size)
#define ep_map_rnd RLC_PREFIX(ep_map_rnd)
#define ep_pck RLC_PREFIX(ep_pck)
#define ep_upk RLC_PREFIX(ep_upk)
Expand Down
6 changes: 0 additions & 6 deletions src/ep/relic_ep_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -541,13 +541,7 @@ void ep_map_swift(ep_t p, const uint8_t *msg, size_t len) {
size_t ep_map_rnd_size(void) {
const size_t elm = (FP_PRIME + ep_param_level() + 7) / 8;

#if EP_MAP == BASIC || !defined(STRIP)
return elm;
#elif EP_MAP == SSWUM || !defined(STRIP)
return 2 * elm;
#elif EP_MAP == SWIFT || !defined(STRIP)
return 2 * elm + 1;
#endif
}

void ep_map_rnd(ep_t p, const uint8_t *uniform_bytes, size_t len) {
Expand Down

0 comments on commit 0cff31b

Please sign in to comment.