aboutsummaryrefslogtreecommitdiffstats
path: root/docs/index.html
blob: 0e6669b629a9e9df9d85b9d731a13eef9e78a80f (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<!DOCTYPE html> 
<html lang="ja">
<head>
<meta charset="UTF-8">
<h2>demo</h2>
<a href="demo/bls.html">bls demo</a>
<h2>API</h2>

<h3>curveType</h3>
<ul>
<li>MCLBN_CURVE_FP254BNB = 0
<li>MCLBN_CURVE_FP382_1 = 1
<li>MCLBN_CURVE_FP382_2 = 2
</ul>

<h3>object</h3>
<dl>
<dt>blsId
<dd>equal to mclBnFr ; create by blsId_malloc()

<dt>blsSecretKey
<dd>equal to mclBnFr ; create by blsSecretKey_malloc()

<dt>blsPrivateKey
<dd>equal to mclBnG1 ; create by blsPrivateKeyKey_malloc()

<dt>blsPublicKey
<dd>equal to mclBnG2 ; create by blsPublicKey_malloc()

<dt>blsSignature     ; create by blsSignatureKey_malloc()
<dd>equal to mclG1
</dl>
all objects are deleted by bls_free()

<h3>api</h3>
<dl>
<dt>int blsInit(int curve, int maxUnitSize)
<dd>curve = curveType, maxUnitSize = 6

<dt>string blsGetCurveOrder()
<dd>return the order of a group

<dt>string blsGetFieldOrder()
<dd>return the order of an finite field

<dt>blsGetGeneratorOfG2(blsPublicKey pub)
<dd>set pub to a generator of G2

<dt>blsIdSetInt(blsId id, int x)
<dd>set id by x

<dt>blsIdSetDecStr(blsId id, string s)
<dd>set id by decimal string s

<dt>blsIdSetHexStr(blsId id, string s)
<dd>set id by hexagonal string s

<dt>string blsIdGetDecStr(blsId id)
<dd>get decimal string of id

<dt>string blsIdGetHexStr(blsId id)
<dd>return hexiagonal string of id

<dt>Uint8Array blsIdSerialize(blsId id)
<dd>return Uint8Array of serialized id

<dt>Uint8Array blsSecretKeySerialize(blsSecretKey sec)
<dd>return Uint8Array of serialized sec

<dt>Uint8Array blsPublicKeySerialize(blsPublicKey pub)
<dd>return Uint8Array of serialized pub

<dt>Uint8Array blsSignatureSerialize(blsSignature sig)
<dd>return Uint8Array of serialized sig

<dt>blsIdDeserialize(blsId id, Uint8Array a)
<dd>set id by a

<dt>blsSecretKeyDeserialize(blsSecretKey sec, Uint8Array a)
<dd>set sec by a

<dt>blsPublicKeyDeserialize(blsPublicKey pub, Uint8Array a)
<dd>set pub by a

<dt>blsSignatureDeserialize(blsSignature sig, Uint8Array a)
<dd>set sig by a

<dt>blsIdIsEqual(blsId lhs, blsId rhs)
<dd>return 1 if lhs == rhs

<dt>blsSecretKeyIsEqual(blsSecretKey lhs, blsSecretKey rhs)
<dd>return 1 if lhs == rhs

<dt>blsPublicKeyIsEqual(blsPublicKey lhs, blsPublicKey rhs)
<dd>return 1 if lhs == rhs

<dt>blsSignatureIsEqual(blsSignature lhs, blsSignature rhs)
<dd>return 1 if lhs == rhs


<dt>blsSecretKeyAdd(blsSecretKey sec, blsSecretKey rhs)
<dt>sec += rhs

<dt>blsPublicKeyAdd(blsPublicKey pub, blsPublicKey rhs)
<dt>sec += rhs

<dt>blsSignatureAdd(blsSignature sig, blsSignature rhs)
<dt>sec += rhs


<dt>blsHashToSecretKey(blsSecretKey sec, (string|Uint8Array) s)
<dd>set sec by hash(s)

<dt>blsSecretKeySetByCSPRNG(blsSecretKey sec)
<dd>set sec by random number generator

<dt>blsGetPublicKey(blsPublicKey pub, blsSecretKey sec)
<dd>set public key pub by secret key sec

<dt>blsSecretKeyShare(blsSecretKey sec, array of blsSecretKey msk, blsId id)
<dd>share secret key sec by array of blsSecretKey msk with id

<dt>blsPublicKeyShare(blsPublicKey pub, array of blsPublicKey mpk, blsId id)
<dd>share public key pub by array of blsPublicKey mpk with id

<dt>blsSecretKeyRecover(blsSecretKey sec, array of blsSecretKey secVec, array of blsId idVec)
<dd>recover sec by n array of secVec and idVec

<dt>blsPublicKeyRecover(blsPublicKey pub, array of blsPublicKey pubVec, array of blsId idVec)
<dd>recover pub by n array of pubVec and idVec

<dt>blsSignatureRecover(blsSignature sig, array of blsSignature sigVec, array of blsId idVec)
<dd>recover sig by n array of sigVec and idVec

<dt>blsSign(blsSignature sig, blsSecretKey sec, (string|Uint8Array) m)
<dd>set sig by signing message m with sec

<dt>blsVerify(blsSignature sig, blsPublicKey pub, (string|Uint8Array) m)
<dd>verify sig by pub and message m
</body>
</html>