Closed arosboro closed 10 months ago
Find the relevant code in:
zk_texas_holdem/src/work/zkPokerWorker
(Rust library built with wasm-pack).zk_texas_holdem/zk_texas_holdem/src/main.leo:encrypt(message, e, n)
zk_texas_holdem/zk_texas_holdem/src/main.leo:decrypt(cipher, d, n)
zk_texas_holdem/zk_texas_holdem/src/main.leo:encrypt_deck(player.e, player.n, deck.cards)
SRA Is implemented in web assembly with rust as a library that operates as a JavaScript worker thread in the browser. It will be used to generate phi and n. These two values will be shared publicly. The user takes phi and n and provides it to generate key pairs in their browser. These key pairs are shared with the contract privately. The javascript will need to generate 52 key pairs for each client in the second phase of securing the shuffled deck.
I used exp_by_squaring to achieve the same as a ** b while only requiring a max u64 register to store the squaring operation. Encrypt and decrypt are inline functions which can be relied upon by transitions in
main.leo
.