Closed neuroney closed 1 year ago
When I limited the bn_t size, it seems OK without the overflow.
bn_read_bin(b, bin, RLC_FP_BYTES*3); // RLC_FP_BYTES*1~3
But I still want to is it possible to convert the whole fp12_t into bn_t?
Hi,
Why would you want to convert an fp12_t into a bn_t? The type fp12_t actually stores 12 integers modulo p.
Your original code would work after you rebuild RELIC with a larger BN_PRECI
or with ALLOC=DYNAMIC
to store that many bytes in a bn_t type.
Thanks for your response! Actually I want to do a HASH on a fp12_t object, to map it into one integer modulo p. How can I add ALLOC=DYNAMIC during rebuilding? In a preset file?
When I wrote my preset file with "-DALLOC=DYNAMIC", I got errors during make
, as the figure below:
The preset file is here:
cmake -DCHECK=off -DARITH=gmp -DALLOC=DYNAMIC -DFP_PRIME=638 -DFP_QNRES=on -DFP_METHD="BASIC;COMBA;COMBA;MONTY;LOWER;LOWER;SLIDE" -DFPX_METHD="INTEG;INTEG;LAZYR" -DPP_METHD="LAZYR;OATEP" -DCFLAGS="-O2 -funroll-loops -fomit-frame-pointer" $1
If you want to hash an fp12_t element, you already have a byte vector with its contents right there, ready for hashing! After you hash to a smaller representation, then you can encode into an element modulo q.
Are you building the head of the main branch?
Yes! I have solved the hash like this method. Thanks for your explanation.
I built the code in releases https://github.com/relic-toolkit/relic/archive/refs/tags/0.6.0.tar.gz
What I change is add -DALLOC=DYNAMIC
into gmp-pbc-bls381.sh
, and then follows the instruction in Wiki. And it had errors like the figure above.
Oh, when I clone the main branch. No errors happen! Thanks for your time. We can close this issue now.
When I want to convert a fp12_t value into a bn_t value, I encountered something like this:
I choose the curve
B12_P638
under x86-64 ubuntu with the preset file:My code is as follows:
Additionally, If I want to add
-DALLOC=DYNAMIC
into my preset file, I had