[ibe] add comment

dev
MITSUNARI Shigeo 7 years ago
parent 25285fcc1c
commit 80ff5db6b8
  1. 4
      docs/demo/ibe-demo.js

@ -8,6 +8,7 @@ mcl.init()
setText('status', 'ok') setText('status', 'ok')
}) })
// Enc(m) = [r P, m + h(e(r mpk, H(id)))]
function IDenc(id, P, mpk, m) { function IDenc(id, P, mpk, m) {
const r = new mcl.Fr() const r = new mcl.Fr()
r.setByCSPRNG() r.setByCSPRNG()
@ -29,10 +30,13 @@ function onClickIBE() {
const msk = new mcl.Fr() const msk = new mcl.Fr()
msk.setByCSPRNG() msk.setByCSPRNG()
setText('msk', msk.toHexStr()) setText('msk', msk.toHexStr())
// mpk = msk P
const mpk = mcl.mul(P, msk) const mpk = mcl.mul(P, msk)
setText('mpk', mpk.toHexStr()) setText('mpk', mpk.toHexStr())
// user KeyGen
const id = getText('id') const id = getText('id')
// sk = msk H(id)
const sk = mcl.mul(mcl.hashAndMapToG2(id), msk) const sk = mcl.mul(mcl.hashAndMapToG2(id), msk)
setText('sk', sk.toHexStr()) setText('sk', sk.toHexStr())

Loading…
Cancel
Save