Skip to content

Commit

Permalink
[C#] add wrapper of millerLoopVec
Browse files Browse the repository at this point in the history
  • Loading branch information
herumi committed Mar 21, 2024
1 parent 1cedbfb commit 3aabb9d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ffi/cs/mcl/mcl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ public class MCL {
[DllImport(dllName)] public static extern void mclBn_pairing(ref GT z, in G1 x, in G2 y);
[DllImport(dllName)] public static extern void mclBn_finalExp(ref GT y, in GT x);
[DllImport(dllName)] public static extern void mclBn_millerLoop(ref GT z, in G1 x, in G2 y);
[DllImport(dllName)] public static extern void mclBn_millerLoopVec(ref GT z, [In] G1[] xVec, [In] G2[] yVec, ulong n);

[DllImport(dllName)] public static extern ulong mclBnFp_setLittleEndianMod(ref Fp y, [In] byte[] buf, ulong bufSize);
[DllImport(dllName)] public static extern ulong mclBnFr_setLittleEndianMod(ref Fr y, [In] byte[] buf, ulong bufSize);
[DllImport(dllName)] public static extern ulong mclBnFp_setBigEndianMod(ref Fp y, [In] byte[] buf, ulong bufSize);
Expand Down Expand Up @@ -324,6 +326,11 @@ public static void MillerLoop(ref GT z, in G1 x, in G2 y)
{
mclBn_millerLoop(ref z, x, y);
}
public static void MilloerLoopVec(ref GT z, in G1[] xVec, in G2[] yVec)
{
if (xVec.Length != yVec.Length) throw new ArgumentException("bad length");
mclBn_millerLoopVec(ref z, xVec, yVec, (ulong)xVec.Length);
}
// y = f(x) with a polynomial f(t) = sum_i cVec[i] t^i
public static void Share(ref Fr y, in Fr[] cVec, in Fr x)
{
Expand Down

0 comments on commit 3aabb9d

Please sign in to comment.