diff options
author | Wei-Ning Huang <w@byzantine-lab.io> | 2019-06-23 15:39:23 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@byzantine-lab.io> | 2019-09-17 16:57:30 +0800 |
commit | e6f5201b178f40b516ffe7b98757df25f8aee028 (patch) | |
tree | 982d6281ac9670d0ad451ca6bbd0677488b52344 /vendor/github.com/byzantine-lab/mcl/ffi/cs | |
parent | f6e06ac35033f9e52b6b2e3ebfe623c23a39c338 (diff) | |
download | go-tangerine-e6f5201b178f40b516ffe7b98757df25f8aee028.tar.gz go-tangerine-e6f5201b178f40b516ffe7b98757df25f8aee028.tar.zst go-tangerine-e6f5201b178f40b516ffe7b98757df25f8aee028.zip |
import: switch consensus core to gitlab.com/tangerine-network/tangerine-consensus
Diffstat (limited to 'vendor/github.com/byzantine-lab/mcl/ffi/cs')
6 files changed, 0 insertions, 750 deletions
diff --git a/vendor/github.com/byzantine-lab/mcl/ffi/cs/App.config b/vendor/github.com/byzantine-lab/mcl/ffi/cs/App.config deleted file mode 100644 index 88fa4027b..000000000 --- a/vendor/github.com/byzantine-lab/mcl/ffi/cs/App.config +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<configuration> - <startup> - <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /> - </startup> -</configuration>
\ No newline at end of file diff --git a/vendor/github.com/byzantine-lab/mcl/ffi/cs/Properties/AssemblyInfo.cs b/vendor/github.com/byzantine-lab/mcl/ffi/cs/Properties/AssemblyInfo.cs deleted file mode 100644 index c87e1d44b..000000000 --- a/vendor/github.com/byzantine-lab/mcl/ffi/cs/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 -// アセンブリに関連付けられている情報を変更するには、 -// これらの属性値を変更してください。 -[assembly: AssemblyTitle("bn256")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("bn256")] -[assembly: AssemblyCopyright("Copyright © 2017")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから -// 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、 -// その型の ComVisible 属性を true に設定してください。 -[assembly: ComVisible(false)] - -// このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります -[assembly: Guid("e9d06b1b-ea22-4ef4-ba4b-422f7625966b")] - -// アセンブリのバージョン情報は次の 4 つの値で構成されています: -// -// メジャー バージョン -// マイナー バージョン -// ビルド番号 -// Revision -// -// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を -// 既定値にすることができます: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/vendor/github.com/byzantine-lab/mcl/ffi/cs/bn256.cs b/vendor/github.com/byzantine-lab/mcl/ffi/cs/bn256.cs deleted file mode 100644 index 0e1ed032c..000000000 --- a/vendor/github.com/byzantine-lab/mcl/ffi/cs/bn256.cs +++ /dev/null @@ -1,475 +0,0 @@ -using System; -using System.Text; -using System.Runtime.InteropServices; - -namespace mcl { - public class BN256 { - [DllImport("mclBn256.dll")] - public static extern int mclBn_init(int curve, int maxUnitSize); - [DllImport("mclBn256.dll")] - public static extern void mclBnFr_clear(ref Fr x); - [DllImport("mclBn256.dll")] - public static extern void mclBnFr_setInt(ref Fr y, int x); - [DllImport("mclBn256.dll")] - public static extern int mclBnFr_setStr(ref Fr x, [In][MarshalAs(UnmanagedType.LPStr)] string buf, long bufSize, int ioMode); - [DllImport("mclBn256.dll")] - public static extern int mclBnFr_isValid(ref Fr x); - [DllImport("mclBn256.dll")] - public static extern int mclBnFr_isEqual(ref Fr x, ref Fr y); - [DllImport("mclBn256.dll")] - public static extern int mclBnFr_isZero(ref Fr x); - [DllImport("mclBn256.dll")] - public static extern int mclBnFr_isOne(ref Fr x); - [DllImport("mclBn256.dll")] - public static extern void mclBnFr_setByCSPRNG(ref Fr x); - - [DllImport("mclBn256.dll")] - public static extern int mclBnFr_setHashOf(ref Fr x, [In][MarshalAs(UnmanagedType.LPStr)] string buf, long bufSize); - [DllImport("mclBn256.dll")] - public static extern int mclBnFr_getStr([Out]StringBuilder buf, long maxBufSize, ref Fr x, int ioMode); - - [DllImport("mclBn256.dll")] - public static extern void mclBnFr_neg(ref Fr y, ref Fr x); - [DllImport("mclBn256.dll")] - public static extern void mclBnFr_inv(ref Fr y, ref Fr x); - [DllImport("mclBn256.dll")] - public static extern void mclBnFr_add(ref Fr z, ref Fr x, ref Fr y); - [DllImport("mclBn256.dll")] - public static extern void mclBnFr_sub(ref Fr z, ref Fr x, ref Fr y); - [DllImport("mclBn256.dll")] - public static extern void mclBnFr_mul(ref Fr z, ref Fr x, ref Fr y); - [DllImport("mclBn256.dll")] - public static extern void mclBnFr_div(ref Fr z, ref Fr x, ref Fr y); - - [DllImport("mclBn256.dll")] - public static extern void mclBnG1_clear(ref G1 x); - [DllImport("mclBn256.dll")] - public static extern int mclBnG1_setStr(ref G1 x, [In][MarshalAs(UnmanagedType.LPStr)] string buf, long bufSize, int ioMode); - [DllImport("mclBn256.dll")] - public static extern int mclBnG1_isValid(ref G1 x); - [DllImport("mclBn256.dll")] - public static extern int mclBnG1_isEqual(ref G1 x, ref G1 y); - [DllImport("mclBn256.dll")] - public static extern int mclBnG1_isZero(ref G1 x); - [DllImport("mclBn256.dll")] - public static extern int mclBnG1_hashAndMapTo(ref G1 x, [In][MarshalAs(UnmanagedType.LPStr)] string buf, long bufSize); - [DllImport("mclBn256.dll")] - public static extern long mclBnG1_getStr([Out]StringBuilder buf, long maxBufSize, ref G1 x, int ioMode); - [DllImport("mclBn256.dll")] - public static extern void mclBnG1_neg(ref G1 y, ref G1 x); - [DllImport("mclBn256.dll")] - public static extern void mclBnG1_dbl(ref G1 y, ref G1 x); - [DllImport("mclBn256.dll")] - public static extern void mclBnG1_add(ref G1 z, ref G1 x, ref G1 y); - [DllImport("mclBn256.dll")] - public static extern void mclBnG1_sub(ref G1 z, ref G1 x, ref G1 y); - [DllImport("mclBn256.dll")] - public static extern void mclBnG1_mul(ref G1 z, ref G1 x, ref Fr y); - - [DllImport("mclBn256.dll")] - public static extern void mclBnG2_clear(ref G2 x); - [DllImport("mclBn256.dll")] - public static extern int mclBnG2_setStr(ref G2 x, [In][MarshalAs(UnmanagedType.LPStr)] string buf, long bufSize, int ioMode); - [DllImport("mclBn256.dll")] - public static extern int mclBnG2_isValid(ref G2 x); - [DllImport("mclBn256.dll")] - public static extern int mclBnG2_isEqual(ref G2 x, ref G2 y); - [DllImport("mclBn256.dll")] - public static extern int mclBnG2_isZero(ref G2 x); - [DllImport("mclBn256.dll")] - public static extern int mclBnG2_hashAndMapTo(ref G2 x, [In][MarshalAs(UnmanagedType.LPStr)] string buf, long bufSize); - [DllImport("mclBn256.dll")] - public static extern long mclBnG2_getStr([Out]StringBuilder buf, long maxBufSize, ref G2 x, int ioMode); - [DllImport("mclBn256.dll")] - public static extern void mclBnG2_neg(ref G2 y, ref G2 x); - [DllImport("mclBn256.dll")] - public static extern void mclBnG2_dbl(ref G2 y, ref G2 x); - [DllImport("mclBn256.dll")] - public static extern void mclBnG2_add(ref G2 z, ref G2 x, ref G2 y); - [DllImport("mclBn256.dll")] - public static extern void mclBnG2_sub(ref G2 z, ref G2 x, ref G2 y); - [DllImport("mclBn256.dll")] - public static extern void mclBnG2_mul(ref G2 z, ref G2 x, ref Fr y); - - [DllImport("mclBn256.dll")] - public static extern void mclBnGT_clear(ref GT x); - [DllImport("mclBn256.dll")] - public static extern int mclBnGT_setStr(ref GT x, [In][MarshalAs(UnmanagedType.LPStr)] string buf, long bufSize, int ioMode); - [DllImport("mclBn256.dll")] - public static extern int mclBnGT_isEqual(ref GT x, ref GT y); - [DllImport("mclBn256.dll")] - public static extern int mclBnGT_isZero(ref GT x); - [DllImport("mclBn256.dll")] - public static extern int mclBnGT_isOne(ref GT x); - [DllImport("mclBn256.dll")] - public static extern long mclBnGT_getStr([Out]StringBuilder buf, long maxBufSize, ref GT x, int ioMode); - [DllImport("mclBn256.dll")] - public static extern void mclBnGT_neg(ref GT y, ref GT x); - [DllImport("mclBn256.dll")] - public static extern void mclBnGT_inv(ref GT y, ref GT x); - [DllImport("mclBn256.dll")] - public static extern void mclBnGT_add(ref GT z, ref GT x, ref GT y); - [DllImport("mclBn256.dll")] - public static extern void mclBnGT_sub(ref GT z, ref GT x, ref GT y); - [DllImport("mclBn256.dll")] - public static extern void mclBnGT_mul(ref GT z, ref GT x, ref GT y); - [DllImport("mclBn256.dll")] - public static extern void mclBnGT_div(ref GT z, ref GT x, ref GT y); - - [DllImport("mclBn256.dll")] - public static extern void mclBnGT_pow(ref GT z, ref GT x, ref Fr y); - [DllImport("mclBn256.dll")] - public static extern void mclBn_pairing(ref GT z, ref G1 x, ref G2 y); - [DllImport("mclBn256.dll")] - public static extern void mclBn_finalExp(ref GT y, ref GT x); - [DllImport("mclBn256.dll")] - public static extern void mclBn_millerLoop(ref GT z, ref G1 x, ref G2 y); - - public static void init() - { - const int curveFp254BNb = 0; - const int maxUnitSize = 4; - if (mclBn_init(curveFp254BNb, maxUnitSize) != 0) { - throw new InvalidOperationException("mclBn_init"); - } - } - [StructLayout(LayoutKind.Sequential)] - public struct Fr { - private ulong v0, v1, v2, v3; - public void Clear() - { - mclBnFr_clear(ref this); - } - public void SetInt(int x) - { - mclBnFr_setInt(ref this, x); - } - public void SetStr(string s, int ioMode) - { - if (mclBnFr_setStr(ref this, s, s.Length, ioMode) != 0) { - throw new ArgumentException("mclBnFr_setStr" + s); - } - } - public bool IsValid() - { - return mclBnFr_isValid(ref this) == 1; - } - public bool Equals(Fr rhs) - { - return mclBnFr_isEqual(ref this, ref rhs) == 1; - } - public bool IsZero() - { - return mclBnFr_isZero(ref this) == 1; - } - public bool IsOne() - { - return mclBnFr_isOne(ref this) == 1; - } - public void SetByCSPRNG() - { - mclBnFr_setByCSPRNG(ref this); - } - public void SetHashOf(String s) - { - if (mclBnFr_setHashOf(ref this, s, s.Length) != 0) { - throw new InvalidOperationException("mclBnFr_setHashOf:" + s); - } - } - public string GetStr(int ioMode) - { - StringBuilder sb = new StringBuilder(1024); - long size = mclBnFr_getStr(sb, sb.Capacity, ref this, ioMode); - if (size == 0) { - throw new InvalidOperationException("mclBnFr_getStr:"); - } - return sb.ToString(); - } - public void Neg(Fr x) - { - mclBnFr_neg(ref this, ref x); - } - public void Inv(Fr x) - { - mclBnFr_inv(ref this, ref x); - } - public void Add(Fr x, Fr y) - { - mclBnFr_add(ref this, ref x, ref y); - } - public void Sub(Fr x, Fr y) - { - mclBnFr_sub(ref this, ref x, ref y); - } - public void Mul(Fr x, Fr y) - { - mclBnFr_mul(ref this, ref x, ref y); - } - public void Div(Fr x, Fr y) - { - mclBnFr_div(ref this, ref x, ref y); - } - public static Fr operator -(Fr x) - { - Fr y = new Fr(); - y.Neg(x); - return y; - } - public static Fr operator +(Fr x, Fr y) - { - Fr z = new Fr(); - z.Add(x, y); - return z; - } - public static Fr operator -(Fr x, Fr y) - { - Fr z = new Fr(); - z.Sub(x, y); - return z; - } - public static Fr operator *(Fr x, Fr y) - { - Fr z = new Fr(); - z.Mul(x, y); - return z; - } - public static Fr operator /(Fr x, Fr y) - { - Fr z = new Fr(); - z.Div(x, y); - return z; - } - } - [StructLayout(LayoutKind.Sequential)] - public struct G1 { - private ulong v00, v01, v02, v03, v04, v05, v06, v07, v08, v09, v10, v11; - public void Clear() - { - mclBnG1_clear(ref this); - } - public void setStr(String s, int ioMode) - { - if (mclBnG1_setStr(ref this, s, s.Length, ioMode) != 0) { - throw new ArgumentException("mclBnG1_setStr:" + s); - } - } - public bool IsValid() - { - return mclBnG1_isValid(ref this) == 1; - } - public bool Equals(G1 rhs) - { - return mclBnG1_isEqual(ref this, ref rhs) == 1; - } - public bool IsZero() - { - return mclBnG1_isZero(ref this) == 1; - } - public void HashAndMapTo(String s) - { - if (mclBnG1_hashAndMapTo(ref this, s, s.Length) != 0) { - throw new ArgumentException("mclBnG1_hashAndMapTo:" + s); - } - } - public string GetStr(int ioMode) - { - StringBuilder sb = new StringBuilder(1024); - long size = mclBnG1_getStr(sb, sb.Capacity, ref this, ioMode); - if (size == 0) { - throw new InvalidOperationException("mclBnG1_getStr:"); - } - return sb.ToString(); - } - public void Neg(G1 x) - { - mclBnG1_neg(ref this, ref x); - } - public void Dbl(G1 x) - { - mclBnG1_dbl(ref this, ref x); - } - public void Add(G1 x, G1 y) - { - mclBnG1_add(ref this, ref x, ref y); - } - public void Sub(G1 x, G1 y) - { - mclBnG1_sub(ref this, ref x, ref y); - } - public void Mul(G1 x, Fr y) - { - mclBnG1_mul(ref this, ref x, ref y); - } - } - [StructLayout(LayoutKind.Sequential)] - public struct G2 { - private ulong v00, v01, v02, v03, v04, v05, v06, v07, v08, v09, v10, v11; - private ulong v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23; - public void Clear() - { - mclBnG2_clear(ref this); - } - public void setStr(String s, int ioMode) - { - if (mclBnG2_setStr(ref this, s, s.Length, ioMode) != 0) { - throw new ArgumentException("mclBnG2_setStr:" + s); - } - } - public bool IsValid() - { - return mclBnG2_isValid(ref this) == 1; - } - public bool Equals(G2 rhs) - { - return mclBnG2_isEqual(ref this, ref rhs) == 1; - } - public bool IsZero() - { - return mclBnG2_isZero(ref this) == 1; - } - public void HashAndMapTo(String s) - { - if (mclBnG2_hashAndMapTo(ref this, s, s.Length) != 0) { - throw new ArgumentException("mclBnG2_hashAndMapTo:" + s); - } - } - public string GetStr(int ioMode) - { - StringBuilder sb = new StringBuilder(1024); - long size = mclBnG2_getStr(sb, sb.Capacity, ref this, ioMode); - if (size == 0) { - throw new InvalidOperationException("mclBnG2_getStr:"); - } - return sb.ToString(); - } - public void Neg(G2 x) - { - mclBnG2_neg(ref this, ref x); - } - public void Dbl(G2 x) - { - mclBnG2_dbl(ref this, ref x); - } - public void Add(G2 x, G2 y) - { - mclBnG2_add(ref this, ref x, ref y); - } - public void Sub(G2 x, G2 y) - { - mclBnG2_sub(ref this, ref x, ref y); - } - public void Mul(G2 x, Fr y) - { - mclBnG2_mul(ref this, ref x, ref y); - } - } - [StructLayout(LayoutKind.Sequential)] - public struct GT { - private ulong v00, v01, v02, v03, v04, v05, v06, v07, v08, v09, v10, v11; - private ulong v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23; - private ulong v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35; - private ulong v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47; - public void Clear() - { - mclBnGT_clear(ref this); - } - public void setStr(String s, int ioMode) - { - if (mclBnGT_setStr(ref this, s, s.Length, ioMode) != 0) { - throw new ArgumentException("mclBnGT_setStr:" + s); - } - } - public bool Equals(GT rhs) - { - return mclBnGT_isEqual(ref this, ref rhs) == 1; - } - public bool IsZero() - { - return mclBnGT_isZero(ref this) == 1; - } - public bool IsOne() - { - return mclBnGT_isOne(ref this) == 1; - } - public string GetStr(int ioMode) - { - StringBuilder sb = new StringBuilder(1024); - long size = mclBnGT_getStr(sb, sb.Capacity, ref this, ioMode); - if (size == 0) { - throw new InvalidOperationException("mclBnGT_getStr:"); - } - return sb.ToString(); - } - public void Neg(GT x) - { - mclBnGT_neg(ref this, ref x); - } - public void Inv(GT x) - { - mclBnGT_inv(ref this, ref x); - } - public void Add(GT x, GT y) - { - mclBnGT_add(ref this, ref x, ref y); - } - public void Sub(GT x, GT y) - { - mclBnGT_sub(ref this, ref x, ref y); - } - public void Mul(GT x, GT y) - { - mclBnGT_mul(ref this, ref x, ref y); - } - public void Div(GT x, GT y) - { - mclBnGT_div(ref this, ref x, ref y); - } - public static GT operator -(GT x) - { - GT y = new GT(); - y.Neg(x); - return y; - } - public static GT operator +(GT x, GT y) - { - GT z = new GT(); - z.Add(x, y); - return z; - } - public static GT operator -(GT x, GT y) - { - GT z = new GT(); - z.Sub(x, y); - return z; - } - public static GT operator *(GT x, GT y) - { - GT z = new GT(); - z.Mul(x, y); - return z; - } - public static GT operator /(GT x, GT y) - { - GT z = new GT(); - z.Div(x, y); - return z; - } - public void Pow(GT x, Fr y) - { - mclBnGT_pow(ref this, ref x, ref y); - } - public void Pairing(G1 x, G2 y) - { - mclBn_pairing(ref this, ref x, ref y); - } - public void FinalExp(GT x) - { - mclBn_finalExp(ref this, ref x); - } - public void MillerLoop(G1 x, G2 y) - { - mclBn_millerLoop(ref this, ref x, ref y); - } - } - } -} diff --git a/vendor/github.com/byzantine-lab/mcl/ffi/cs/bn256.csproj b/vendor/github.com/byzantine-lab/mcl/ffi/cs/bn256.csproj deleted file mode 100644 index 21a049f01..000000000 --- a/vendor/github.com/byzantine-lab/mcl/ffi/cs/bn256.csproj +++ /dev/null @@ -1,62 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> - <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProjectGuid>{E9D06B1B-EA22-4EF4-BA4B-422F7625966B}</ProjectGuid> - <OutputType>Exe</OutputType> - <AppDesignerFolder>Properties</AppDesignerFolder> - <RootNamespace>bn256</RootNamespace> - <AssemblyName>bn256</AssemblyName> - <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> - <FileAlignment>512</FileAlignment> - <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> - <DebugSymbols>true</DebugSymbols> - <OutputPath>..\..\bin\</OutputPath> - <DefineConstants>DEBUG;TRACE</DefineConstants> - <AllowUnsafeBlocks>false</AllowUnsafeBlocks> - <DebugType>full</DebugType> - <PlatformTarget>x64</PlatformTarget> - <ErrorReport>prompt</ErrorReport> - <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> - <OutputPath>..\..\bin\</OutputPath> - <DefineConstants>TRACE</DefineConstants> - <Optimize>true</Optimize> - <DebugType>pdbonly</DebugType> - <PlatformTarget>x64</PlatformTarget> - <ErrorReport>prompt</ErrorReport> - <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> - <Prefer32Bit>true</Prefer32Bit> - </PropertyGroup> - <ItemGroup> - <Reference Include="System" /> - <Reference Include="System.Core" /> - <Reference Include="System.Xml.Linq" /> - <Reference Include="System.Data.DataSetExtensions" /> - <Reference Include="Microsoft.CSharp" /> - <Reference Include="System.Data" /> - <Reference Include="System.Net.Http" /> - <Reference Include="System.Xml" /> - </ItemGroup> - <ItemGroup> - <Compile Include="bn256.cs" /> - <Compile Include="bn256_test.cs" /> - <Compile Include="Properties\AssemblyInfo.cs" /> - </ItemGroup> - <ItemGroup> - <None Include="App.config" /> - </ItemGroup> - <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> - <!-- To modify your build process, add your task inside one of the targets below and uncomment it. - Other similar extension points exist, see Microsoft.Common.targets. - <Target Name="BeforeBuild"> - </Target> - <Target Name="AfterBuild"> - </Target> - --> -</Project>
\ No newline at end of file diff --git a/vendor/github.com/byzantine-lab/mcl/ffi/cs/bn256.sln b/vendor/github.com/byzantine-lab/mcl/ffi/cs/bn256.sln deleted file mode 100644 index 6e6aa67ee..000000000 --- a/vendor/github.com/byzantine-lab/mcl/ffi/cs/bn256.sln +++ /dev/null @@ -1,22 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bn256", "bn256.csproj", "{E9D06B1B-EA22-4EF4-BA4B-422F7625966B}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {E9D06B1B-EA22-4EF4-BA4B-422F7625966B}.Debug|x64.ActiveCfg = Debug|x64 - {E9D06B1B-EA22-4EF4-BA4B-422F7625966B}.Debug|x64.Build.0 = Debug|x64 - {E9D06B1B-EA22-4EF4-BA4B-422F7625966B}.Release|x64.ActiveCfg = Release|x64 - {E9D06B1B-EA22-4EF4-BA4B-422F7625966B}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/vendor/github.com/byzantine-lab/mcl/ffi/cs/bn256_test.cs b/vendor/github.com/byzantine-lab/mcl/ffi/cs/bn256_test.cs deleted file mode 100644 index cad8c03d3..000000000 --- a/vendor/github.com/byzantine-lab/mcl/ffi/cs/bn256_test.cs +++ /dev/null @@ -1,149 +0,0 @@ -using System; - -namespace mcl { - using static BN256; - class BN256Test { - static int err = 0; - static void assert(string msg, bool b) - { - if (b) return; - Console.WriteLine("ERR {0}", msg); - err++; - } - static void Main(string[] args) - { - try { - assert("64bit system", System.Environment.Is64BitProcess); - init(); - TestFr(); - TestG1(); - TestG2(); - TestPairing(); - if (err == 0) { - Console.WriteLine("all tests succeed"); - } else { - Console.WriteLine("err={0}", err); - } - } catch (Exception e) { - Console.WriteLine("ERR={0}", e); - } - } - static void TestFr() - { - Console.WriteLine("TestFr"); - Fr x = new Fr(); - x.Clear(); - assert("0", x.GetStr(10) == "0"); - assert("0.IzZero", x.IsZero()); - assert("!0.IzOne", !x.IsOne()); - x.SetInt(1); - assert("1", x.GetStr(10) == "1"); - assert("!1.IzZero", !x.IsZero()); - assert("1.IzOne", x.IsOne()); - x.SetInt(3); - assert("3", x.GetStr(10) == "3"); - assert("!3.IzZero", !x.IsZero()); - assert("!3.IzOne", !x.IsOne()); - x.SetInt(-5); - x = -x; - assert("5", x.GetStr(10) == "5"); - x.SetInt(4); - x = x * x; - assert("16", x.GetStr(10) == "16"); - assert("10", x.GetStr(16) == "10"); - Fr y; - y = x; - assert("x == y", x.Equals(y)); - x.SetInt(123); - assert("123", x.GetStr(10) == "123"); - assert("7b", x.GetStr(16) == "7b"); - assert("y != x", !x.Equals(y)); - try { - x.SetStr("1234567891234x", 10); - Console.WriteLine("x = {0}", x); - } catch (Exception e) { - Console.WriteLine("exception test OK\n'{0}'", e); - } - x.SetStr("1234567891234", 10); - assert("1234567891234", x.GetStr(10) == "1234567891234"); - } - static void TestG1() - { - Console.WriteLine("TestG1"); - G1 P = new G1(); - P.Clear(); - assert("P.IsValid", P.IsValid()); - assert("P.IsZero", P.IsZero()); - P.HashAndMapTo("abc"); - assert("P.IsValid", P.IsValid()); - assert("!P.IsZero", !P.IsZero()); - G1 Q = new G1(); - Q = P; - assert("P == Q", Q.Equals(P)); - Q.Neg(P); - Q.Add(Q, P); - assert("P = Q", Q.IsZero()); - Q.Dbl(P); - G1 R = new G1(); - R.Add(P, P); - assert("Q == R", Q.Equals(R)); - Fr x = new Fr(); - x.SetInt(3); - R.Add(R, P); - Q.Mul(P, x); - assert("Q == R", Q.Equals(R)); - } - static void TestG2() - { - Console.WriteLine("TestG2"); - G2 P = new G2(); - P.Clear(); - assert("P is valid", P.IsValid()); - assert("P is zero", P.IsZero()); - P.HashAndMapTo("abc"); - assert("P is valid", P.IsValid()); - assert("P is not zero", !P.IsZero()); - G2 Q = new G2(); - Q = P; - assert("P == Q", Q.Equals(P)); - Q.Neg(P); - Q.Add(Q, P); - assert("Q is zero", Q.IsZero()); - Q.Dbl(P); - G2 R = new G2(); - R.Add(P, P); - assert("Q == R", Q.Equals(R)); - Fr x = new Fr(); - x.SetInt(3); - R.Add(R, P); - Q.Mul(P, x); - assert("Q == R", Q.Equals(R)); - } - static void TestPairing() - { - Console.WriteLine("TestG2"); - G1 P = new G1(); - P.HashAndMapTo("123"); - G2 Q = new G2(); - Q.HashAndMapTo("1"); - Fr a = new Fr(); - Fr b = new Fr(); - a.SetStr("12345678912345673453", 10); - b.SetStr("230498230982394243424", 10); - G1 aP = new G1(); - G2 bQ = new G2(); - aP.Mul(P, a); - bQ.Mul(Q, b); - GT e1 = new GT(); - GT e2 = new GT(); - GT e3 = new GT(); - e1.Pairing(P, Q); - e2.Pairing(aP, Q); - e3.Pow(e1, a); - assert("e2.Equals(e3)", e2.Equals(e3)); - e2.Pairing(P, bQ); - e3.Pow(e1, b); - assert("e2.Equals(e3)", e2.Equals(e3)); - } - } -} |