aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorMITSUNARI Shigeo <herumi@nifty.com>2017-09-11 10:16:24 +0800
committerMITSUNARI Shigeo <herumi@nifty.com>2017-09-11 10:16:24 +0800
commit709ef80e8947d8ceb7ccf0e74acf43ee8d3d2f2d (patch)
tree571ba8200bec21ba780a579499ca1b40827fb868 /docs
parent704103938171a1e7e3190cf38172193f8749afff (diff)
downloaddexon-bls-709ef80e8947d8ceb7ccf0e74acf43ee8d3d2f2d.tar
dexon-bls-709ef80e8947d8ceb7ccf0e74acf43ee8d3d2f2d.tar.gz
dexon-bls-709ef80e8947d8ceb7ccf0e74acf43ee8d3d2f2d.tar.bz2
dexon-bls-709ef80e8947d8ceb7ccf0e74acf43ee8d3d2f2d.tar.lz
dexon-bls-709ef80e8947d8ceb7ccf0e74acf43ee8d3d2f2d.tar.xz
dexon-bls-709ef80e8947d8ceb7ccf0e74acf43ee8d3d2f2d.tar.zst
dexon-bls-709ef80e8947d8ceb7ccf0e74acf43ee8d3d2f2d.zip
select curve type
Diffstat (limited to 'docs')
-rw-r--r--docs/demo/bls-demo.js19
-rw-r--r--docs/demo/bls.html13
2 files changed, 27 insertions, 5 deletions
diff --git a/docs/demo/bls-demo.js b/docs/demo/bls-demo.js
index 50364e7..dd9b246 100644
--- a/docs/demo/bls-demo.js
+++ b/docs/demo/bls-demo.js
@@ -20,12 +20,16 @@ function setupWasm(fileName, nameSpace, setupFct) {
return mod
}
+const MCLBN_CURVE_FP254BNB = 0
+const MCLBN_CURVE_FP382_1 = 1
+const MCLBN_CURVE_FP382_2 = 2
+
var MCLBN_FP_UNIT_SIZE = 6
var module = setupWasm('bls_c.wasm', null, function(mod, ns) {
define_exported_bls(mod)
define_extra_functions(mod)
- var r = blsInit(0, MCLBN_FP_UNIT_SIZE)
+ var r = blsInit(MCLBN_CURVE_FP382_1, MCLBN_FP_UNIT_SIZE)
setText('status', r ? 'err:' + r : 'ok')
})
@@ -150,6 +154,15 @@ function define_extra_functions(mod) {
mclBnGT_getStr = gen_getStr(_mclBnGT_getStr)
}
+function onChangeSelectCurve() {
+ let obj = document.selectCurve.curveType
+ let idx = obj.selectedIndex
+ let curve = obj.options[idx].value
+ console.log('idx=' + idx)
+ var r = blsInit(idx, MCLBN_FP_UNIT_SIZE)
+ setText('status', r ? 'err:' + r : 'ok')
+}
+
function rand(val) {
var x = mclBnFr_malloc()
mclBnFr_setByCSPRNG(x)
@@ -167,7 +180,8 @@ function bench(label, count, func) {
setText(label, t)
}
-function TestPairing() {
+function onClickTestPairing() {
+ document.getElementById('testPairing').disabled = true
var a = mclBnFr_malloc()
var b = mclBnFr_malloc()
var ab = mclBnFr_malloc()
@@ -214,4 +228,5 @@ function TestPairing() {
mclBnFr_free(ab)
mclBnFr_free(b)
mclBnFr_free(a)
+ document.getElementById('testPairing').disabled = false
}
diff --git a/docs/demo/bls.html b/docs/demo/bls.html
index 789b39c..2f51047 100644
--- a/docs/demo/bls.html
+++ b/docs/demo/bls.html
@@ -9,11 +9,18 @@
</script>
</head>
<body>
-<div>
+<p>
+<form name="selectCurve">
+<select name="curveType" onChange="onChangeSelectCurve()">
+<option value="0" selected>Fp254BNb</option>
+<option value="1">Fp382_1</option>
+<option value="2">Fp382_2</option>
+</select>
library status <span name="status">initializing...</span>
-</div>
+</form>
+</p>
<h2>init</h2>
-<button type="text" onclick="TestPairing()">test Pairing</button>
+<button type="text" id="testPairing" onclick="onClickTestPairing()">test Pairing</button>
<div>pairing time : <span name="time_pairing">0</span>msec</div>
<div>G1 scalar mul : <span name="time_g1mul">0</span>msec</div>
<div>G2 scalar mul : <span name="time_g2mul">0</span>msec</div>