All Downloads are FREE. Search and download functionalities are using the official Maven repository.

dk.alexandra.fresco.suite.spdz.gates.SpdzSubtractProtocolKnownRight Maven / Gradle / Ivy

There is a newer version: 1.3.7
Show newest version
package dk.alexandra.fresco.suite.spdz.gates;

import dk.alexandra.fresco.framework.DRes;
import dk.alexandra.fresco.framework.network.Network;
import dk.alexandra.fresco.framework.value.SInt;
import dk.alexandra.fresco.suite.spdz.SpdzResourcePool;
import dk.alexandra.fresco.suite.spdz.datatypes.SpdzElement;
import dk.alexandra.fresco.suite.spdz.datatypes.SpdzSInt;
import java.math.BigInteger;

public class SpdzSubtractProtocolKnownRight extends SpdzNativeProtocol {

  private DRes left;
  private BigInteger right;
  private SpdzSInt out;

  public SpdzSubtractProtocolKnownRight(DRes left, BigInteger right) {
    this.left = left;
    this.right = right;
  }

  @Override
  public SpdzSInt out() {
    return out;
  }

  @Override
  public EvaluationStatus evaluate(int round, SpdzResourcePool spdzResourcePool,
      Network network) {
    SpdzSInt left = (SpdzSInt) this.left.out();
    SpdzElement knownSpdzElement =
        SpdzKnownSIntProtocol.createKnownSpdzElement(spdzResourcePool, right);
    this.out = new SpdzSInt(left.value.subtract(knownSpdzElement));
    return EvaluationStatus.IS_DONE;
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy