a portable and fast pairing-based cryptography library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
mcl/docs/demo/she2.html

58 lines
2.0 KiB

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<meta http-equiv="Content-Style-Type" content="text/css">
<title>Two-level Homomorphic Encryption demo</title>
<link rel="stylesheet" type="text/css" href="style.css">
<script type='text/javascript' src="jquery-3.2.1.min.js"></script>
<script type='text/javascript' src="exported-she.js"></script>
<script type='text/javascript' src="mclshe.js"></script>
<script type='text/javascript' src="she.js"></script>
<script type="text/javascript" src="she-demo2.js"></script>
</head>
<body>
<h1>Two-level Homorphic Encryption demo</h1>
<div>
library status <span name="status">initializing...</span>
</div>
<div id="left">
<h2>Client</h2>
secretKey : <div name="sec" class="hex"></div>
<table border=1 id="client_table" width="100%" summary="client">
<tr id="client_header"><th>x<th>y<th class="hex">EncG1(x)<th class="hex">EncG2(y)</tr>
</table>
<input type="text" name="append" value="1,1">
<button type="button" onclick="append()">1. append "x,y" and encrypt them (multiple times)</button>
<br>
<button type="button" onclick="send()">2. send to server</button>
<div>received ciphertext</div>
<div name="encSumC" class="hex">0</div>
<button type="button" onclick="dec()">6. decode ciphertext</button>
<div name="ret">0</div>
</div>
<div id="middle">
</div>
<div id="right">
<h2>Server</h2>
publicKey : <div name="pub" class="hex"></div>
<table border=1 id="server_table" width="100%" summary="server">
</table>
<button type="button" onclick="mul()">3. compute EncGT(x * y) := EncG1(x) * EncG2(y) for eacy row</button><br>
<button type="button" onclick="sum()">4. sum of all values in EncGT(x * y) colomn</button>
<div>result</div>
<div name="encSumS" class="hex">0</div>
<button type="button" onclick="recv()">5. return to client</button>
</div>
</body>
</html>