public override void Evaluate(IClassicalState state) { IClassicalStateDebugger debuggerData = state.generateClassicalDebugger(); IClassicalStateDebugger debuggerElement = ReferenceBasis.getState(ReferenceElement).generateClassicalDebugger(); debuggerData.setValue(debuggerElement.getValue()); }
public override void Evaluate(IClassicalState state) { if (EffectiveNoiseFactor != 0) { IClassicalStateDebugger debugger = state.generateClassicalDebugger(); double value = debugger.getValue(); double size = FactoryRandom.GetSingleNormalized() / EffectiveNoiseFactor; double random = FactoryRandom.GetSingleDoubleIntervalByCenter(value, size / 2); debugger.setValue(random); } }
private void GENE_SlaveProcessBasisData(IProtocolAgent agent, IClassicalState state) { int receivedPos = Slave.counterReceivedClassical - 1; BB84Log("GENE: STEP 2: ", receivedPos, " | Slave State Receive: ", state.generateClassicalDebugger().ShortDebug); IClassicalBit classicalBit = FactoryClassicalData.generateBit(false); classicalBit.AssociateState(state); bool decode = FactoryClassicalData.decodeBitByUsualBasis(classicalBit); BB84Log("GENE: STEP 2: ", receivedPos, " | Slave conversion into Bit: ", decode.ToString()); // get element bool usedBasis = (bool)GENE_slaveUsedBasisCollection[receivedPos]; //bool decodedBit = (bool)GENE_slaveDecodedBitCollection[receivedPos]; bool coincidence = (usedBasis == decode); if (coincidence) { BB84Log("GENE: STEP 2: =========> Slave found coincidence in Basis at POS: ", receivedPos); } // store 'coincidence' pos GENE_slaveCoincidences.Add(coincidence); }
private void GENE_MasterProcessCoincidencesData(IProtocolAgent agent, IClassicalState state) { // no hace falta comparar con las bases usadas o datos usadas // en este caso solo se transmite si el la estación cliente detecto coincidencia int receivedPos = Master.counterReceivedClassical - 1; BB84Log("GENE: STEP 3: ", receivedPos, " | Master State Receive: ", state.generateClassicalDebugger().ShortDebug); IClassicalBit classicalBit = FactoryClassicalData.generateBit(false); classicalBit.AssociateState(state); bool decode = FactoryClassicalData.decodeBitByUsualBasis(classicalBit); BB84Log("GENE: STEP 3: ", receivedPos, " | Master conversion into Bit: ", decode.ToString()); if (decode) { BB84Log("GENE: STEP 3: =========> Master found coincidence in Basis at POS: ", receivedPos); } GENE_masterCoincidences.Add(decode); }
private void GENE_EavesdropperProcessCoincidencesData(IProtocolAgent agent, IClassicalState state) { int receivedPos = Eavesdropper.counterReceivedClassical - 1; BB84Log("GENE: STEP 3: ", receivedPos, " | Eavesdropper State Receive: ", state.generateClassicalDebugger().ShortDebug); IClassicalBit classicalBit = FactoryClassicalData.generateBit(false); classicalBit.AssociateState(state); bool decode = FactoryClassicalData.decodeBitByUsualBasis(classicalBit); BB84Log("GENE: STEP 3: ", receivedPos, " | Eavesdropper conversion into Bit: ", decode.ToString()); if (decode) { BB84Log("GENE: STEP 3: =========> Eavesdropper found in Basis coincidence at POS: ", receivedPos); } GENE_eavesdropperCoincidences.Add(decode); }
private void CHEC_SlaveProcessCheckValues(IProtocolAgent agent, IClassicalState state) { int receivedPos = Slave.counterReceivedClassical - 1; BB84Log("CHEC: STEP 2: ", receivedPos, " | Slave State Receive: ", state.generateClassicalDebugger().ShortDebug); IClassicalBit classicalBit = FactoryClassicalData.generateBit(false); classicalBit.AssociateState(state); bool decode = FactoryClassicalData.decodeBitByUsualBasis(classicalBit); BB84Log("CHEC: STEP 2: ", receivedPos, " | Slave conversion into Bit: ", decode.ToString()); //// get index int index = (int)CHEC_slaveComparisonIndexes[receivedPos]; BB84Log("CHEC: STEP 2: ", receivedPos, " | Slave stores for checking check POS ", index, " with VALUE ", decode); CHEC_slaveComparisonValuesReceived.Add(decode); }
private void CHEC_SlaveProcessCheckPositions(IProtocolAgent agent, IClassicalState state) { int receivedPos = Slave.counterReceivedClassical - 1; BB84Log("CHEC: STEP 1: ", receivedPos, " | Slave State Received: ", state.generateClassicalDebugger().ShortDebug); IClassicalBit classicalBit = FactoryClassicalData.generateBit(false); classicalBit.AssociateState(state); bool decode = FactoryClassicalData.decodeBitByUsualBasis(classicalBit); BB84Log("CHEC: STEP 1: ", receivedPos, " | Slave conversion into Bit: ", decode.ToString()); // store and 'decodedBit' CHEC_slaveComparisonSelected.Add(decode); if (decode) //seletected { CHEC_slaveComparisonIndexes.Add(receivedPos); } }
public ClBasicState(IClassicalState state) : this(state.generateClassicalDebugger().getNumLevels(), state.Value) { }
public static IClassicalState generateState(IClassicalState state) { IClassicalState result = generateState(state.generateClassicalDebugger().getNumLevels()); result.Value = state.Value; return result; }
// EVENTS public void transmitClassical(IProtocolAgent agent, IClassicalState state) { TesterLog("CLASSICAL TRANSMISSION " + agent.AgentName); TesterLog(state.generateClassicalDebugger().FullDebug); }
public void receiveClassical(IProtocolAgent agent, IClassicalState state) { TesterLog("CLASSICAL RECEPTION " + agent.AgentName); TesterLog(state.generateClassicalDebugger().FullDebug); }