mirror of
https://github.com/tornadocash/trusted-setup-server.git
synced 2024-11-21 17:36:54 +01:00
fix entropy calculating
This commit is contained in:
parent
5bfea46d69
commit
4f55b80dc7
@ -76,7 +76,7 @@ Example: `wasm-pack build --release --target web -- --no-default-features --feat
|
||||
|
||||
|
||||
## Initialize REAL ceremony:
|
||||
1. Choose what contribition to use for the ceremony. Also choose what hash of future ethereum block we will use, tweet about it and calculate the VDF.
|
||||
1. Choose what contribition to use for the ceremony (it should already exist). Also choose what hash of future ethereum block we will use, tweet about it and calculate the VDF.
|
||||
1. Make sure your machine has at least 150 GB RAM and 200 GB SSD.
|
||||
1. Download the response file of the contribution. You can use `aria2c` accelerator for it.
|
||||
1. `git clone https://github.com/tornadocash/phase2-bn254 && cd phase2-bn254`
|
||||
|
@ -180,12 +180,18 @@ export default {
|
||||
await timeout(100) // allow UI to update before freezing in wasm
|
||||
console.log('Source params', data)
|
||||
|
||||
const encoder = new TextEncoder(userInput)
|
||||
const entropyFromUser = encoder.encode(userInput)
|
||||
let msgBuffer = new TextEncoder('utf-8').encode(userInput)
|
||||
let hashBuffer = await window.crypto.subtle.digest('SHA-256', msgBuffer)
|
||||
const entropyFromUser = new Uint8Array(hashBuffer)
|
||||
console.log('entropyFromUser', entropyFromUser.toString())
|
||||
|
||||
msgBuffer = window.crypto.getRandomValues(new Uint8Array(1024))
|
||||
hashBuffer = await window.crypto.subtle.digest('SHA-256', msgBuffer)
|
||||
const entropyFromBrowser = new Uint8Array(hashBuffer)
|
||||
console.log('entropyFromBrowser', entropyFromBrowser.toString())
|
||||
|
||||
const entropy = new Uint8Array(userInput.length)
|
||||
const entropyFromBrowser = window.crypto.getRandomValues(entropy)
|
||||
// suffle the browser and user random
|
||||
const entropy = new Uint8Array(entropyFromBrowser.length)
|
||||
for (let i = 0; i < entropyFromBrowser.length; i++) {
|
||||
entropy[i] = entropyFromBrowser[i] + entropyFromUser[i]
|
||||
}
|
||||
@ -217,7 +223,7 @@ export default {
|
||||
} else if (resp.status === 422) {
|
||||
if (retry < 3) {
|
||||
console.log(`Looks like someone else uploaded contribution ahead of us, retrying`)
|
||||
await this.makeContribution({ retry: retry++ })
|
||||
await this.makeContribution({ userInput, retry: retry++ })
|
||||
} else {
|
||||
this.status.msg = `Failed to upload your contribution after ${retry} attempts`
|
||||
this.status.type = 'is-danger'
|
||||
|
Loading…
Reference in New Issue
Block a user