private void CHEC_EavesdropperProcessCheckValuesSlave(IProtocolAgent agent, IClassicState state) { int receivedPos = Eavesdropper.counterReceivedClassic - 1; BB84Log("CHEC: STEP 2: ", receivedPos, " | Eavesdropper State Receive: ", state.generateClassicDebugger().ShortDebug); IClassicBit ClassicBit = ClassicDatatypeFactory.generateBit(false); ClassicBit.AssociateState(state); bool decode = ClassicDatatypeFactory.decodeBitByUsualBasis(ClassicBit); BB84Log("CHEC: STEP 2: ", receivedPos, " | Eavesdropper conversion into Bit: ", decode.ToString()); //// get index int index = (int)CHEC_masterComparisonIndexes[receivedPos]; BB84Log("CHEC: STEP 2: ", receivedPos, " | Eavesdropper -Slave- stores for checking check POS ", index, " with VALUE ", decode); CHEC_eavesdropperSlaveComparisonValuesReceived.Add(decode); }
private void CHEC_SlaveProcessCheckPositions(IProtocolAgent agent, IClassicState state) { int receivedPos = AgentSlave.counterReceivedClassic - 1; BB84Log("BB84 CHEC STEP 1", receivedPos,"Slave State Received", state.Debugger.ShortDebug); IClassicBit ClassicBit = ClassicDatatypeFactory.generateBit(false); ClassicBit.AssociateState(state); bool decode = ClassicDatatypeFactory.decodeBitByUsualBasis(ClassicBit); BB84Log("BB84 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 void receiveClassic(IProtocolAgent agent, IClassicState state) { TesterLog("Classic RECEPTION " + agent.AgentName); TesterLog(state.generateClassicDebugger().FullDebug); }
// EVENTS public void transmitClassic(IProtocolAgent agent, IClassicState state) { TesterLog("Classic TRANSMISSION " + agent.AgentName); TesterLog(state.generateClassicDebugger().FullDebug); }
private void GENE_SlaveProcessBasisData(IProtocolAgent agent, IClassicState state) { int receivedPos = AgentSlave.counterReceivedClassic - 1; BB84Log("BB84 GENE STEP 2", receivedPos,"Slave State Receive", state.Debugger.ShortDebug); IClassicBit ClassicBit = ClassicDatatypeFactory.generateBit(false); ClassicBit.AssociateState(state); bool decode = ClassicDatatypeFactory.decodeBitByUsualBasis(ClassicBit); BB84Log("BB84 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("BB84 GENE STEP 2","Slave found coincidence in Basis at POS", receivedPos); } // store 'coincidence' pos GENE_slaveCoincidences.Add(coincidence); }
private void master_BeforeTransmission(IProtocolAgent sender) { bool[] sendingData = master.exportBufferSend(); string sendingString = ArrayTools.EncodingASCII_ArrayBoolToString(sendingData); TesterLog("MASTER TRANSMITS", sendingData.Length, sendingString.Length, sendingString); }
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_EavesdropperProcessCoincidencesData(IProtocolAgent agent, IClassicState state) { int receivedPos = AgentEavesdropper.counterReceivedClassic - 1; BB84Log("BB84 GENE STEP 3", receivedPos,"Eavesdropper State Receive", state.Debugger.ShortDebug); IClassicBit ClassicBit = ClassicDatatypeFactory.generateBit(false); ClassicBit.AssociateState(state); bool decode = ClassicDatatypeFactory.decodeBitByUsualBasis(ClassicBit); BB84Log("BB84 GENE STEP 3", receivedPos,"Eavesdropper conversion into Bit", decode.ToString()); if (decode) { BB84Log("BB84 GENE STEP 3","Eavesdropper found in Basis coincidence at POS", receivedPos); } GENE_eavesdropperCoincidences.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 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 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); } }
private void GENE_EavesdropperProcessQuantumKeyData(IProtocolAgent agent, IQuantumState state) { int receivedPos = Eavesdropper.counterReceivedQuantum - 1; BB84Log("GENE: STEP 1: ", receivedPos, " | Eavesdropper State Received: ", state.generateQuantumDebugger().ShortDebug); // get the bit IQuantumBit quantumBit = QuantumDatatypeFactory.generateBit(false); quantumBit.AssociateState(state); bool usedBasis = RandomnessAlgorithmFactory.GetSingleBinary(); bool decodedBit = QuantumDatatypeFactory.decodeBitByBasis(quantumBit, usedBasis); BB84Log("GENE: STEP 1: ", receivedPos, " | Eavesdropper conversion into Bit: ", decodedBit.ToString()); // store 'usedBasis' and 'decodedBit' GENE_eavesdropperUsedBasisCollection.Add(usedBasis); GENE_eavesdropperDecodedBitCollection.Add(decodedBit); }
private void CHEC_SlaveProcessCheckValues(IProtocolAgent agent, IClassicState state) { int receivedPos = AgentSlave.counterReceivedClassic - 1; BB84Log("BB84 CHEC STEP 2", receivedPos,"Slave State Receive", state.Debugger.ShortDebug); IClassicBit ClassicBit = ClassicDatatypeFactory.generateBit(false); ClassicBit.AssociateState(state); bool decode = ClassicDatatypeFactory.decodeBitByUsualBasis(ClassicBit); BB84Log("BB84 CHEC STEP 2", receivedPos,"Slave conversion into Bit", decode.ToString()); //// get index int index = (int)CHEC_slaveComparisonIndexes[receivedPos]; BB84Log("BB84 CHEC STEP 2", receivedPos,"Slave stores for checking check POS", index,"with VALUE", decode); CHEC_slaveComparisonValuesReceived.Add(decode); }
private void GENE_SlaveProcessQuantumKeyData(IProtocolAgent agent, IQuantumState state) { int receivedPos = Slave.counterReceivedQuantum - 1; BB84Log("GENE: STEP 1: ", receivedPos, " | Slave State Received: ", state.generateQuantumDebugger().ShortDebug); // get the bit IQuantumBit quantumBit = FactoryQuantumData.generateBit(false); quantumBit.AssociateState(state); bool usedBasis = FactoryRandom.GetSingleBinary(); bool decodedBit = FactoryQuantumData.decodeBitByBasis(quantumBit,usedBasis); BB84Log("GENE: STEP 1: ", receivedPos, " | Slave conversion into Bit: ", decodedBit.ToString()); // store 'usedBasis' and 'decodedBit' GENE_slaveUsedBasisCollection.Add(usedBasis); GENE_slaveDecodedBitCollection.Add(decodedBit); }
private void GENE_EavesdropperProcessBasisData(IProtocolAgent agent, IClassicState state) { //int receivedPos = Eavesdropper.counterReceivedClassic - 1; //BB84Log(receivedPos,"Eavesdropper State Receive", state.Debugger.ShortDebug); //IClassicBit ClassicBit = ClassicDataFactory.generateBit(false); //ClassicBit.AssociateState(state); //bool decode = ClassicDataFactory.decodeBitByBasis(ClassicBit, FactoryRandom.GetSingleBinary()); //BB84Log(receivedPos,"Eavesdropper conversion into Bit", decode.ToString()); //// get element //bool usedBasis = (bool)GENE_eavesdropperUsedBasisCollection[receivedPos]; ////bool decodedBit = (bool)GENE_eavesdropperDecodedBitCollection[receivedPos]; //bool coincidence = (usedBasis == decode); //if (coincidence) //{ BB84Log(" Eavesdropper found coincidence at POS", receivedPos); } //// store 'coincidence' pos //GENE_eavesdropperCoincidences.Add(coincidence); }
private void deassociateChannels(IProtocolAgent agent) { if (agent != null) { agent.ClassicChannel = null; //agent.QuantumChannel = null; } }
private void GENE_MasterProcessCoincidencesData(IProtocolAgent agent, IClassicState 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 = AgentMaster.counterReceivedClassic - 1; BB84Log("BB84 GENE STEP 3", receivedPos,"Master State Receive", state.Debugger.ShortDebug); IClassicBit ClassicBit = ClassicDatatypeFactory.generateBit(false); ClassicBit.AssociateState(state); bool decode = ClassicDatatypeFactory.decodeBitByUsualBasis(ClassicBit); BB84Log("BB84 GENE STEP 3", receivedPos,"Master conversion into Bit", decode.ToString()); if (decode) { BB84Log("BB84 GENE STEP 3","Master found coincidence in Basis at POS", receivedPos); } GENE_masterCoincidences.Add(decode); }
public void receiveClassic(IProtocolAgent agent, IClassicState state) { TesterLog("Classic", "RECEPTION", agent.AgentName, state.Debugger.FullDebug); }
private void GENE_SlaveProcessQuantumKeyData(IProtocolAgent agent, IQuantumState state) { int receivedPos = AgentSlave.counterReceivedQuantum - 1; BB84Log("BB84 GENE STEP 1", receivedPos,"Slave State Received", state.Debugger.ShortDebug); // get the bit IQuantumBit quantumBit = QuantumDatatypeFactory.generateBit(false); quantumBit.AssociateState(state); bool usedBasis = RandomnessAlgorithmFactory.GetSingleBinary(); bool decodedBit = QuantumDatatypeFactory.decodeBitByBasis(quantumBit,usedBasis); BB84Log("BB84 GENE STEP 1", receivedPos,"Slave conversion into Bit", decodedBit.ToString()); // store 'usedBasis' and 'decodedBit' GENE_slaveUsedBasisCollection.Add(usedBasis); GENE_slaveDecodedBitCollection.Add(decodedBit); }
public void receiveQuantum(IProtocolAgent agent, IQuantumState state) { TesterLog("Quantum", "RECEPTION", agent.AgentName, state.Debugger.FullDebug); }
private void master_AfterTransmission(IProtocolAgent sender) { bool[] receivedData = slave.exportBufferReceive(); if (receivedData.Length > 0) { string receivedString = ArrayTools.EncodingASCII_ArrayBoolToString(receivedData); TesterLog("SLAVE RECEIVES", receivedData.Length, receivedString.Length, receivedString); } else { TesterLog("ERROR", "SLAVE RECEIVES NOTHING"); } }
// EVENTS public void transmitClassic(IProtocolAgent agent, IClassicState state) { TesterLog("Classic", "TRANSMISSION", agent.AgentName, state.Debugger.FullDebug); }
public void receiveQuantum(IProtocolAgent agent, IQuantumState state) { TesterLog("QUANTUM RECEPTION " + agent.AgentName); TesterLog(state.generateQuantumDebugger().FullDebug); }
public void transmitQuantum(IProtocolAgent agent, IQuantumState state) { TesterLog("Quantum", "TRANSMISSION", agent.AgentName, state.Debugger.FullDebug); }
public void transmitQuantum(IProtocolAgent agent, IQuantumState state) { TesterLog("QUANTUM TRANSMISSION " + agent.AgentName); TesterLog(state.generateQuantumDebugger().FullDebug); }
private void CHEC_EavesdropperProcessCheckPositions(IProtocolAgent agent, IClassicState state) { int receivedPos = Eavesdropper.counterReceivedClassic - 1; BB84Log("CHEC: STEP 1: ", receivedPos, " | Eavesdropper State Received: ", state.generateClassicDebugger().ShortDebug); IClassicBit ClassicBit = ClassicDatatypeFactory.generateBit(false); ClassicBit.AssociateState(state); bool decode = ClassicDatatypeFactory.decodeBitByUsualBasis(ClassicBit); BB84Log("CHEC: STEP 1: ", receivedPos, " | Eavesdropper conversion into Bit: ", decode.ToString()); // store and 'decodedBit' CHEC_eavesdropperComparisonSelected.Add(decode); if (decode) //seletected { CHEC_eavesdropperComparisonIndexes.Add(receivedPos); } }