secret-sharing.js
Version:
Shamir's Secret Sharing Scheme for javascript - https://www.virtualcapitalofamerica.com
38 lines (32 loc) • 1.04 kB
HTML
<html>
<head>
<title>benchmark</title>
</head>
<body>
<script src="../node_modules/lodash/lodash.js"></script>
<script src="../node_modules/platform/platform.js"></script>
<script src="../node_modules/benchmark/benchmark.js"></script>
<script src="../build/secret-sharing.min.js"></script>
<script charset="utf-8">
var suite = new Benchmark.Suite;
suite.add('sharecombine', function () {
var key= secrets.random(512);
var shares=secrets.share(key, 10, 5);
var comb= secrets.combine(shares);
var newShare= secrets.newShare(8, shares)
})
/* .add('newPadLeft()', function () {
secrets._newPadLeft(padding, 256);
}) */
// add listeners
.on('cycle', function (event) {
console.log(String(event.target));
})
.on('complete', function () {
console.log('Fastest is ' + this.filter('fastest').map('name'));
})
// run async
.run({ 'async': true });
</script>
</body>
</html>