mirror of
https://github.com/cathugger/mkp224o.git
synced 2025-01-30 04:27:05 -03:00
26 lines
403 B
C
26 lines
403 B
C
#include "fe.h"
|
|
|
|
// tmp MUST != out
|
|
// in MAY == out
|
|
void fe_batchinvert(fe *out[],fe tmp[],fe * const in[], size_t num)
|
|
{
|
|
fe acc;
|
|
fe tmpacc;
|
|
size_t i;
|
|
|
|
fe_1(acc);
|
|
|
|
for (i = 0;i < num;++i) {
|
|
fe_copy(tmp[i],acc);
|
|
fe_mul(acc,acc,*in[i]);
|
|
}
|
|
|
|
fe_invert(acc,acc);
|
|
|
|
i = num;
|
|
while (i--) {
|
|
fe_mul(tmpacc,acc,*in[i]);
|
|
fe_mul(*out[i],acc,tmp[i]);
|
|
fe_copy(acc,tmpacc);
|
|
}
|
|
}
|