/** * Initialize the coin-tossing functionality by making the parties agree on a seed. * * @param network * The network instance */ public void initialize(Network network) { if (initialized) { throw new IllegalStateException("Already initialized"); } // Make space for a seed by allocating as many bytes as needed, which is // exactly 32 bytes for AesCtrDrbg byte[] seed = new byte[32]; rand.nextBytes(seed); byte[] otherSeed = exchangeSeeds(seed, network); ByteArrayHelper.xor(seed, otherSeed); this.coinTossingPrg = new AesCtrDrbg(seed); initialized = true; }