aaaaaaaaaaaaaaaaaa
This commit is contained in:
@ -7,7 +7,7 @@
|
||||
|
||||
<script src="https://cdn.socket.io/4.5.4/socket.io.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/crypto-js.min.js"></script>
|
||||
<script src="{{ url_for('static', filename='js/lz-string.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/lz-string.min.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/sha3.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/modules/interface/main.js') }}" type="module"></script>
|
||||
<script src="{{ url_for('static', filename='js/modules/crypto/main.js') }}" type="module"></script>
|
||||
@ -423,6 +423,24 @@
|
||||
console.log(`Bench done. Time per verification: ${performance.measure("rv-duration", "rv-start", "rv-end").duration / ROUNDS}`)
|
||||
}
|
||||
|
||||
function PrimeBench() {
|
||||
const ROUNDS = 20;
|
||||
|
||||
for (let i = 0; i < 2; i++) {
|
||||
generate_safe_prime()
|
||||
}
|
||||
|
||||
console.log("Benching")
|
||||
|
||||
performance.mark("p-start")
|
||||
for (let i = 0; i < ROUNDS; i++) {
|
||||
generate_safe_prime()
|
||||
}
|
||||
performance.mark("p-end")
|
||||
|
||||
console.log(`Bench done. Time per generation: ${performance.measure("p-duration", "p-start", "p-end").duration / ROUNDS}`)
|
||||
}
|
||||
|
||||
// https://gist.github.com/kawanet/352a2ed1d1656816b2bc
|
||||
function string_to_buffer(src) {
|
||||
return (new Uint16Array([].map.call(src, function(c) {
|
||||
@ -455,6 +473,31 @@
|
||||
};
|
||||
}
|
||||
|
||||
function FortifySize() {
|
||||
const regions = {
|
||||
A: paillier.pubKey.encrypt(0n),
|
||||
B: paillier.pubKey.encrypt(3n),
|
||||
C: paillier.pubKey.encrypt(-3n),
|
||||
D: paillier.pubKey.encrypt(0n),
|
||||
E: paillier.pubKey.encrypt(0n)
|
||||
}
|
||||
let ROUNDS = 10;
|
||||
|
||||
let size = 0;
|
||||
let compressedSize = 0;
|
||||
|
||||
for (let x = 0; x < ROUNDS; x++) {
|
||||
let s = JSON.stringify(proveFortify(regions));
|
||||
size += string_to_buffer(s).byteLength;
|
||||
compressedSize += LZString.compressToUint8Array(s).length;
|
||||
}
|
||||
|
||||
return {
|
||||
size: size / ROUNDS,
|
||||
compressedSize: compressedSize / ROUNDS
|
||||
};
|
||||
}
|
||||
|
||||
function BitLengthSize() {
|
||||
const ct = paillier.pubKey.encrypt(5n)
|
||||
let ROUNDS = 10;
|
||||
|
Reference in New Issue
Block a user