Пример #1
0
    def __init__(self, parent, title, configFile, width=900, height=600):
        super(Pathfinder, self).__init__(parent,
                                         title=title,
                                         size=(width, height + 40))

        self.width = width
        self.height = height
        self.getConfigFrom(configFile)
        self.bob = Bob(self.crossoverRate, self.mutationRate,
                       self.populationSize, self.chromosomeLength,
                       self.geneLength, self.entrance, self.exit_,
                       self.gameMap, self.rows, self.columns)
        self.InitUI()
Пример #2
0
def main(username, password, site, category, update):

    alice = Alice()
    alice.setup(username, password, site, update)

    a, p = alice.send_message()
    print('\na value (or alpha^r mod p): {0}'.format(a))
    bob = Bob()
    bob.setup(a, p)

    b = bob.receive_message()
    print('\nb value (or a^k mod p): {0}'.format(b))
    print('\nalpha raised to k mod p: {0}'.format(pow(alice.alpha, bob.k, p)))
    alice.compute_rwd(b, category)
Пример #3
0
def main():
    # 使用するqubitを用意
    bit_count = int(input('Bit count : '))
    qubits = [cirq.LineQubit(i) for i in range(bit_count)]

    alice = Alice()
    bob = Bob()
    eve = Eve()

    # アリスはランダムなビット列を生成する
    alice.create_origin_bits(bit_count)

    circuit = cirq.Circuit.from_ops(
        # アリスはX基底またはH基底でランダムにエンコードする
        # alice.set_initial_qubits(qubits),
        alice.encode(qubits),
        # # イヴが盗聴した場合
        # eve.decode(qubits),
        # ボブはX基底またはH基底でランダムにデコードする
        bob.decode(qubits))
    print(circuit)
    # ボブは結果を測定する
    bob.measure_qubits(circuit)

    # アリスとボブは互いにどのビットをどの基底でエンコード・デコードしたかを教えあう
    # 基底が一致したビットを抽出し、秘密鍵とする
    alice.set_secret_key(bob.decode_gates)
    bob.set_secret_key(alice.encode_gates)
Пример #4
0
def is_host_running():
    is_running = True

    try:
        alice_verifying_key = Alice.get_verifying_key()
        bob_encrypting_key, bob_verifying_key = Bob.get_keys()
    except:
        is_running = False

    return is_running
Пример #5
0
 def _executeBob(self, job):
     jobDefinition = self.jobDict.pop(job)
     newBob = Bob(jobDefinition)
     print("++++ {} ====".format(job))
     print('startTime {}'.format(newBob.startTime))
     print('endTime{}'.format(newBob.endTime))
     newBob.run()
     if newBob.open():
         newBob.run()
     else:
         self.jobDict[job] = jobDefinition
Пример #6
0
def main():
    listen_addr = '127.0.0.1'
    listen_port = 8082
    server_cert = 'server.crt'
    server_key = 'server.key'
    client_certs = 'client.crt'

    context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
    context.verify_mode = ssl.CERT_REQUIRED
    context.load_cert_chain(certfile=server_cert, keyfile=server_key)
    context.load_verify_locations(cafile=client_certs)

    bindsocket = socket.socket()
    bindsocket.bind((listen_addr, listen_port))
    bindsocket.listen(5)

    while True:
        print("Waiting for client")
        newsocket, fromaddr = bindsocket.accept()
        print("Client connected: {}:{}".format(fromaddr[0], fromaddr[1]))
        conn = context.wrap_socket(newsocket, server_side=True)
        print("SSL established. Peer: {}".format(conn.getpeercert()))

        data = conn.recv(4096)
        alice_data = pickle.loads(
            data)  # tuple containing alpha and p from alice
        alpha = alice_data[0]
        p = alice_data[1]

        bob = Bob()
        bob.setup(alpha, p)
        b = bob.receive_message()  # bob sends back b

        serialized_data = pickle.dumps(b)
        conn.sendall(serialized_data)

        conn.shutdown(socket.SHUT_RDWR)
        conn.close()
Пример #7
0
from alice import Alice
from bob import Bob
from mallet import Mallet

if __name__ == "__main__":
    alice = Alice()
    mallet = Mallet()
    bob = Bob()
    vms = [
        alice,
        mallet,
        bob,
    ]
    for vm in vms:
        vm.run_tests()
    # print "Don't forget to run the manual tests:"
    # for vm in vms:
    #     print vm.name
    #     if getattr(vm, "manual_tests"):
    #         for i, t in enumerate(vm.manual_tests):
    #             print "{0}. {1}".format(i, t)
    #     print '-' * 80
Пример #8
0
class Pathfinder(wx.Frame):
    def __init__(self, parent, title, configFile, width=900, height=600):
        super(Pathfinder, self).__init__(parent,
                                         title=title,
                                         size=(width, height + 40))

        self.width = width
        self.height = height
        self.getConfigFrom(configFile)
        self.bob = Bob(self.crossoverRate, self.mutationRate,
                       self.populationSize, self.chromosomeLength,
                       self.geneLength, self.entrance, self.exit_,
                       self.gameMap, self.rows, self.columns)
        self.InitUI()

    def InitUI(self):
        self.Bind(wx.EVT_PAINT, self.OnPaint)
        self.Bind(wx.EVT_CHAR, self.OnKeyDown)
        self.Bind(EVT_DRAW, self.OnDraw)

        self.Centre()
        self.Show(True)

    def OnDraw(self, evt):
        self.Refresh()

    def OnPaint(self, e):
        dc = wx.PaintDC(self)
        self.dc = dc
        brush = wx.Brush('white')
        dc.SetBackground(brush)
        dc.Clear()

        self.bob.render(self.width, self.height, dc)

    def OnKeyDown(self, event):
        keycode = event.GetUnicodeKey()
        if keycode == wx.WXK_ESCAPE:
            sys.exit()
        if keycode == wx.WXK_RETURN:
            worker = DrawingThread(self, self.bob)
            worker.start()

        elif keycode == wx.WXK_SPACE:
            self.bob.busy = False
            self.worker.abort()

    def getConfigFrom(self, jsonFile):
        with open(jsonFile) as file:
            data = json.load(file)
            self.crossoverRate = data['crossoverRate']
            self.mutationRate = data['mutationRate']
            self.populationSize = data['populationSize']
            self.chromosomeLength = data['chromosomeLength']
            self.geneLength = data['geneLength']
            self.entrance = data['entrance']
            self.exit_ = data['exit']
            self.rows = data['rows']
            self.columns = data['columns']
            #self.gameMap = [[0 for i in range(self.columns)] for j in range(self.rows)]
            self.gameMap = np.zeros([self.rows, self.columns])
            matrix = data['gameMap']
            i = 0
            for row in matrix:
                j = 0
                for val in row:
                    self.gameMap[i][j] = val
                    j += 1
                i += 1
Пример #9
0
from alice import Alice
from bob import Bob
import numpy as np
import datetime

alice_messages = np.arange(10000)
print("Alice's messages: " + str(alice_messages))
bob_messages = np.arange(5000, 15000)
print("Bob's messages: " + str(bob_messages))
file_path = '.'

alice = Alice(alice_messages, file_path)
bob = Bob(bob_messages, file_path)
t1 = datetime.datetime.now()
intersection = alice.evaluate_intersection()
t2 = datetime.datetime.now()
print('Actual intersection: ' + str(intersection))
print('Evaluating intersection took: ' + str(t2 - t1))
Пример #10
0
def main_2():
    alice = Alice()
    bob = Bob()
    network = Network()
Пример #11
0
class TeenagerTest(unittest.TestCase):
    def setUp(self):
        self.teenager = Bob()

    def test_stating_something(self):
        self.assertEqual('Whatever.', self.teenager.hey('Tom-ay-to, tom-aaaah-to.'))

    @unittest.skip("Unskip once you are ready.")
    def test_shouting(self):
        self.assertEqual('Woah, chill out!', self.teenager.hey('WATCH OUT!'))

    @unittest.skip("Unskip once you are ready.")
    def test_asking_a_question(self):
        self.assertEqual('Sure.', self.teenager.hey('Does this cryogenic chamber make me look fat?'))

    @unittest.skip("Unskip once you are ready.")
    def test_talking_forcefully(self):
        self.assertEqual('Whatever.', self.teenager.hey("Let's go make out behind the gym!"))

    @unittest.skip("Unskip once you are ready.")
    def test_using_acronyms_in_regular_speech(self):
        self.assertEqual('Whatever.', self.teenager.hey("It's OK if you don't want to go to the DMV."))

    @unittest.skip("Unskip once you are ready.")
    def test_forceful_questions(self):
        self.assertEqual('Woah, chill out!', self.teenager.hey('WHAT THE HELL WERE YOU THINKING?'))

    @unittest.skip("Unskip once you are ready.")
    def test_shouting_numbers(self):
        self.assertEqual('Woah, chill out!', self.teenager.hey('1, 2, 3 GO!'))

    @unittest.skip("Unskip once you are ready.")
    def test_shouting_with_special_characters(self):
        self.assertEqual('Woah, chill out!', self.teenager.hey('ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!'))

    @unittest.skip("Unskip once you are ready.")
    def test_shouting_with_no_exclamation_mark(self):
        self.assertEqual('Woah, chill out!', self.teenager.hey('I HATE YOU'))

    @unittest.skip("Unskip once you are ready.")
    def test_statement_containing_question_mark(self):
        self.assertEqual('Whatever.', self.teenager.hey('ing with ? means a question.'))

    @unittest.skip("Unskip once you are ready.")
    def test_silence(self):
        self.assertEqual('Fine. Be that way!', self.teenager.hey(''))

    @unittest.skip("Unskip once you are ready.")
    def test_more_silence(self):
        self.assertEqual('Fine. Be that way!', self.teenager.hey(None))

    @unittest.skip("Unskip once you are ready.")
    def test_long_silence(self):
        self.assertEqual('Fine. Be that way!', self.teenager.hey('        '))
Пример #12
0
#!.venv/bin/python3

from bob import Bob
from filelock import FileLock
from os import sys, path
from login import email, password

lock = FileLock("lock")
try:
    lock.acquire(timeout=10)
except Timeout:
    exit(0)
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
client = Bob(email, password)
try:
    client.listen()
except KeyboardInterrupt:
    client.logout()
Пример #13
0
 def setUp(self):
     self.teenager = Bob()
Пример #14
0
class TeenagerTest(unittest.TestCase):
    def setUp(self):
        self.teenager = Bob()

    def test_stating_something(self):
        self.assertEqual('Whatever.',
                         self.teenager.hey('Tom-ay-to, tom-aaaah-to.'))

    @unittest.skip("Unskip once you are ready.")
    def test_shouting(self):
        self.assertEqual('Woah, chill out!', self.teenager.hey('WATCH OUT!'))

    @unittest.skip("Unskip once you are ready.")
    def test_asking_a_question(self):
        self.assertEqual(
            'Sure.',
            self.teenager.hey('Does this cryogenic chamber make me look fat?'))

    @unittest.skip("Unskip once you are ready.")
    def test_talking_forcefully(self):
        self.assertEqual(
            'Whatever.',
            self.teenager.hey("Let's go make out behind the gym!"))

    @unittest.skip("Unskip once you are ready.")
    def test_using_acronyms_in_regular_speech(self):
        self.assertEqual(
            'Whatever.',
            self.teenager.hey("It's OK if you don't want to go to the DMV."))

    @unittest.skip("Unskip once you are ready.")
    def test_forceful_questions(self):
        self.assertEqual('Woah, chill out!',
                         self.teenager.hey('WHAT THE HELL WERE YOU THINKING?'))

    @unittest.skip("Unskip once you are ready.")
    def test_shouting_numbers(self):
        self.assertEqual('Woah, chill out!', self.teenager.hey('1, 2, 3 GO!'))

    @unittest.skip("Unskip once you are ready.")
    def test_shouting_with_special_characters(self):
        self.assertEqual(
            'Woah, chill out!',
            self.teenager.hey('ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!'))

    @unittest.skip("Unskip once you are ready.")
    def test_shouting_with_no_exclamation_mark(self):
        self.assertEqual('Woah, chill out!', self.teenager.hey('I HATE YOU'))

    @unittest.skip("Unskip once you are ready.")
    def test_statement_containing_question_mark(self):
        self.assertEqual('Whatever.',
                         self.teenager.hey('ing with ? means a question.'))

    @unittest.skip("Unskip once you are ready.")
    def test_silence(self):
        self.assertEqual('Fine. Be that way!', self.teenager.hey(''))

    @unittest.skip("Unskip once you are ready.")
    def test_more_silence(self):
        self.assertEqual('Fine. Be that way!', self.teenager.hey(None))

    @unittest.skip("Unskip once you are ready.")
    def test_long_silence(self):
        self.assertEqual('Fine. Be that way!', self.teenager.hey('        '))
Пример #15
0
  parser.add_argument('key_size', help="Size of each key in bytes")
  parser.add_argument('-v', '--verbose', action="store_true", help="Verbose output")
  parser.add_argument('-e', '--eve', action="store_true", help="Eve is present")

  args = parser.parse_args()

  key_amount = int(args.key_amount)
  key_size = int(args.key_size)
  verbose = args.verbose
  eve_exists = args.eve
  detected = 0

  for i in range(key_amount):

    alice = Alice()
    bob = Bob()
    eve = Eve()

    alice.reset()
    bob.reset()

    qubits = bob.send_qubits(key_size * 8 * 4)

    qubits = qubits
    qubits = qubits
    qubits = qubits
    qubits = qubits
    if(eve_exists == True):
      qubits = eve.measure_qubits(qubits)
    qubits = qubits
    qubits = qubits
Пример #16
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("--point-permute", help="enable the point-and-permute optimization", action='store_true')
    parser.add_argument("--free-xor", help="enable the free-XOR optimization", action='store_true')
    parser.add_argument("--grr3", help="enable the GRR3 optimization", action='store_true')
    args = parser.parse_args()

    if args.grr3 and not args.point_permute:
        print("The GRR3 optimization requires the point-and-permute optimization to be enabled")
        exit(0)

    if args.free_xor:
        config.USE_FREE_XOR = True
        print("Optimization enabled: free-XOR")

    if args.point_permute:
        config.USE_POINT_PERMUTE = True
        print("Optimization enabled: point-and-permute")

    if args.grr3:
        config.USE_GRR3 = True
        print("Optimization enabled: GRR3")

    alice = Alice()
    bob = Bob()

    # In this implementation we store wires as strings, whose values are those supplied by the user. 
    # These strings uniquely identify the corresponding wire. Not to be confused with labels, for which there are 
    # two for every unique wire!
    print(
        "Welcome! Please define your circuit by entering a sequence of logic gate specifications of the form \"z = x "
        "OP y\", where:")
    print(" - x and y are identifiers that uniquely specify the gate's two input wires, ")
    print(" - z is an identifier that uniquely specifies the gate's output wire")
    print(" - OP is the gate operation, which is one of \"and\", \"or\", \"xor\"")
    print(
        "Please enter one logic gate per line. When you are finished defining gates and are ready to proceed, "
        "please enter a blank line.")
    wires = dict()
    out_wires = []
    in_wires = []
    while True:
        gate_info = input()
        if not gate_info:
            break
        gate_info = gate_info.split()
        gate = Gate()
        if gate_info[3] == "and":
            gate.op = 'AND'
        elif gate_info[3] == "or":
            gate.op = 'OR'
        elif gate_info[3] == "xor":
            gate.op = 'XOR'
        else:
            raise ValueError("Operation must be one of \"and\", \"or\", \"xor\"")

        gate.in1 = gate_info[2]
        gate.in2 = gate_info[4]
        gate.out = gate_info[0]

        gates[gate.out] = gate

        wires[gate.in1] = ""
        wires[gate.in2] = ""
        wires[gate.out] = ""

        in_wires.append(gate.in1)
        in_wires.append(gate.in2)
        out_wires.append(gate.out)

        wires[gate_info[0]] = ""
        wires[gate_info[2]] = ""
        wires[gate_info[4]] = ""

    input_wires = []
    output_wires = []

    for w in wires:  # select the wires that are ONLY input and ONLY output
        if w in in_wires and w not in out_wires:
            input_wires.append(w)
        if w in out_wires and w not in in_wires:
            output_wires.append(w)

    print("Detected the following INPUT wires:  " + str(input_wires))
    print("Detected the following OUTPUT wires: " + str(output_wires))

    alice_wires = []
    alice_wire_values = []
    bob_wires = []
    bob_wire_values = []

    print("Among the input wires " + str(
        input_wires) + ", which are supplied by Alice, the garbler? Please enter the wire identifiers seperated by commas.")
    alice_wires = input().split(",")

    if len(alice_wires) > 0:  # Alice has at least one input
        print(
            "What are Alice's boolean input values? Please enter a sequence of 0s and 1s corresponding to her input wires, separated by commas.")
        alice_wire_values = list(map(int, input().split(",")))

        # ...therefore, the remaining inputs must be owned by Bob
        for w in input_wires:
            if w not in alice_wires:
                bob_wires.append(w)

        if len(bob_wires) > 0:
            print("The remaining input wires, " + str(bob_wires),
                  " must be supplied by Bob. Please enter a sequence of 0s and 1s corresponding to his input wires, separated by commas.")
            bob_wire_values = list(map(int, input().split(",")))
        else:
            print("Assuming all inputs are supplied by Alice, and Bob only evaluates.")

    else:  # Alice has no inputs; all inputs must be owned by Bob
        print(
            "Assuming all inputs are supplied by Bob, the evaluator. What are Bob's boolean input values? Please enter a sequence of 0s and 1s corresponding to his input wires, separated by commas.")
        bob_input_values = input().split(",")

    # TODO Instead of exiting, handle bad user input gracefully.
    assert (len(alice_wires) == len(alice_wire_values))
    assert (len(bob_wire_values) == len(bob_wire_values))

    alice.input_wires = dict(zip(alice_wires, alice_wire_values))
    bob.input_wires = dict(zip(bob_wires, bob_wire_values))

    print()
    print("Successfully generated the following circuit: ")
    circuit = Circuit()
    # at the moment, we only support one output wire; hence output_wires[0]
    # but the infrastructure is in place to change this, if we so desire
    # to do this, we would likely have to represent the circuit as a digraph instead of a tree
    # and reimplement our construction and evaluation algorithms accordingly 
    circuit.build(output_wires[0], gates)
    circuit.tree.show()

    # Give the circuit to Alice to garble
    alice.circuit = circuit

    # Instruct Alice to generate labels and garble garble gates using the generated labels
    print()
    print("Alice generates labels for the circuit, and garbles gates accordingly:")
    alice.garble_gates()

    # Instruct Alice to permute the garbled tables
    print()
    print("Alice permutes the entries in each garbled gate's garbled truth table:")
    alice.permute_entries()

    # Transfer the circuit to Bob
    print()
    print("Alice transfers the circuit to Bob.")
    bob.circuit = alice.circuit

    for wire in alice.input_wires:
        # Transfer the labels corresponding to Alice's input to Bob
        bob.known_labels[wire] = alice.wire_labels[wire][alice.input_wires[wire]]

    # Simulate OT between Alice and Bob so that Bob can acquire labels corresponding to his input
    print()
    print("Bob uses OT to request from Alice labels corresponding to his input bits:")
    bob.request_labels(alice)

    # Instruct Bob to evaluate the circuit
    print()
    print("Bob proceeds to evaluate the circuit:")
    result = bob.evaluate()

    print()
    print("Alice reveals the value of the label that Bob computed as the circuit's output:")
    # Instruct Alice to reveal the result of Bob's computation
    alice.reveal_result(result)
Пример #17
0
canal = "canal.txt"

# O caminho_chave_privada serve para provar que seus números secretos podem ser diferentes e que resultam na mesma chave privada
# NÃO É UTILIZADO EM UM SISTEMA DH REAL
caminho_chave_privada_alice = "chave_privada_alice.txt"
caminho_chave_privada_bob = "chave_privada_bob.txt"

# Limpa os arquivos privados e o canal público
limpa_canais(canal, caminho_chave_privada_alice, caminho_chave_privada_bob)

# É selecionado aleatoriamente um número primo positivo até 1000 e calculado sua menor raiz primitiva
(g, p) = calcula_raiz_primitiva_e_primo()

# São criados Alice e Bob recebendo o gerador e o número primo pelo canal público
alice = Alice(canal, caminho_chave_privada_alice, g, p)
bob = Bob(canal, caminho_chave_privada_bob, g, p)
input()

# Ada e Bob vão armazenar localmente as variáveis g e p que eles escolheram pelo público
alice.calcula_e_grava_A()
bob.calcula_e_grava_B()
input()

# Ada e Bob vão ler os resultados das chaves intermediárias um do outro que foram passados pela rede pública
alice.ler_B()
bob.ler_A()

# Os números secretos são salvos para provar que mesmo podendo ser diferentes, a chave privada é idêntica
# Ada e Bob vão gravar localmente sua chave privada, que será usada para descriptografar as mensagens
alice.mostrar_chave_secreta()
bob.mostrar_chave_secreta()
Пример #18
0
def parse_message(message_json):
    message = json.loads(message_json)
    msg_id = message['id']
    msg_cmd = message['cmd']

    # have a check to make sure that nucypher network is running.
    # if not, fail.
    if is_host_running() == False:
        output = {}
        output["id"] = msg_id
        output["cmd"] = "isHostRunning"
        output["type"] = "failure"
        output["result"] = "nuBox Host is not running"

        send_message(json.dumps(output))
        return

    if msg_cmd == "isHostRunning":
        output = {}
        output["id"] = msg_id
        output["cmd"] = "isHostRunning"
        output["type"] = "success"
        output["result"] = "nuBox Host is running"

        send_message(json.dumps(output))

    # get Bob's public keys
    elif msg_cmd == "bob_keys":
        output = {}
        output["id"] = msg_id
        output["cmd"] = "bob_keys"
        output["args"] = message['args']

        try:
            bob_encrypting_key, bob_verifying_key = Bob.get_keys()

            output["type"] = "success"
            output["result"] = {}
            output["result"]["bek"] = bob_encrypting_key
            output["result"]["bvk"] = bob_verifying_key
        except:
            output["type"] = "failure"

        send_message(json.dumps(output))

    # encrypt operation
    elif msg_cmd == 'encrypt':
        plaintext = message['args']['plaintext']
        label = message['args']['label']

        output = {}
        output["id"] = msg_id
        output["cmd"] = "encrypt"
        output["args"] = message['args']

        try:
            encrypted = Alice.encrypt(label, plaintext)
            output["type"] = "success"
            output["result"] = encrypted
        except Exception as e:
            output["type"] = "failure"
            output["result"] = str(e)

        send_message(json.dumps(output))

    # grant operation
    elif msg_cmd == 'grant':
        output = {}
        output["id"] = msg_id
        output["cmd"] = "grant"
        output["args"] = message['args']

        response = Bob.grant(label=message['args']['label'],
                             bob_encrypting_key=message['args']['bek'],
                             bob_verifying_key=message['args']['bvk'],
                             expiration=message['args']['expiration'])

        if response.status_code == 200:
            output["type"] = "success"
            output["result"] = "granted"
        else:
            logging.error(response.content.decode("utf-8"))
            output["type"] = "failure"
            output["result"] = "Failed to grant for this label"

        send_message(json.dumps(output))

    # revoke operation
    elif msg_cmd == 'revoke':
        label = message['args']['label']
        bvk = message['args']['bvk']

        output = {}
        output["id"] = msg_id
        output["cmd"] = "revoke"
        output["args"] = message['args']

        response = Alice.revoke(label, bvk)
        if response.status_code == 200:
            output["type"] = "success"
            output["result"] = "Revoked"
        else:
            logging.error(response.content.decode("utf-8"))
            output["type"] = "failure"
            output["result"] = "Failed to revoke for this label"

        send_message(json.dumps(output))

    # decrypt operation
    elif msg_cmd == 'decrypt':
        encrypted = message['args']['encrypted']
        label = message['args']['label']

        output = {}
        output["id"] = msg_id
        output["cmd"] = "decrypt"
        output["args"] = message['args']

        try:
            plaintext = Bob.decrypt(label, encrypted)
            output["type"] = "success"
            output["result"] = plaintext
        except:
            output["type"] = "failure"
            output["result"] = "Failed to decrypt for this label"

        send_message(json.dumps(output))
Пример #19
0
 def setUp(self):
     self.teenager = Bob()
Пример #20
0
import random
from alice import Alice
from bob import Bob
from eve import Eve
from matplotlib import pyplot as plt
import pandas as pd

alice = Alice()
bob = Bob()
eve = Eve()
num_bits = [500]
bits = []
basis = []
qc_polarization = []  #양자채널로 보내진 polarization
count = 0
QBER = []
sum_QBER = 0
sum_data = 0
eavesdropping_rate = 0.1

for i in range(0, len(num_bits)):

    #print("비트의 개수 : ",num_bits[i])

    while (eavesdropping_rate <= 1):

        random.seed()

        alice.reset()
        bob.reset()
        eve.reset()