aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/dexon-foundation/mcl/ffi/java/bn256.i
blob: 94a8edb7a8159f0b91d278eeaf072165ce108f43 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
%module Bn256

%include "std_string.i"
%include "std_except.i"


%{
#include <cybozu/random_generator.hpp>
#include <cybozu/crypto.hpp>
#include <mcl/bn256.hpp>
struct Param {
    cybozu::RandomGenerator rg;
    static inline Param& getParam()
    {
        static Param p;
        return p;
    }
};

static void HashAndMapToG1(mcl::bn256::G1& P, const std::string& m)
{
    std::string digest = cybozu::crypto::Hash::digest(cybozu::crypto::Hash::N_SHA256, m);
    mcl::bn256::Fp t;
    t.setArrayMask(digest.c_str(), digest.size());
    mcl::bn256::BN::param.mapTo.calcG1(P, t);
}

#include "bn256_impl.hpp"
%}

%include "bn256_impl.hpp"