def test_sign(): params = setup() # user parameters m = 10 # signer 1 (sk1, vk1) = keygen(params) sig1 = sign(params, sk1, m) # signer 2 (sk2, vk2) = keygen(params) sig2 = sign(params, sk2, m) # affregate signatures sig = aggregate_sign(sig1, sig2) # randomize signature randomize(params, sig) # aggregate keys vk = aggregate_keys(vk1, vk2) # verify signature assert verify(params, vk, m, sig)
def test_threshold_mix_sign(): q = 7 # number of messages hidden_m = [10] * 2 # hideen message clear_m = [3] * 1 # clear messages t, n = 2, 3 params = setup(q) (priv, pub) = elgamal_keygen(params) # El Gamal keypair # generate commitment and encryption for mix signature (cm, c, proof_s) = prepare_mix_sign(params, clear_m, hidden_m, pub) # generate key (sk, vk, vvk) = mix_ttp_th_keygen(params, t, n, q) # sign enc_sigs = [mix_sign(params, ski, cm, c, pub, proof_s, clear_m) for ski in sk] (h, enc_epsilon) = zip(*enc_sigs) sigs = [(h[0], elgamal_dec(params, priv, enc)) for enc in enc_epsilon] # aggregate signatures sig = aggregate_th_sign(params, sigs) # randomize signature sig = randomize(params, sig) # generate kappa and proof of correctness (kappa, proof_v) = show_mix_sign(params, vvk, hidden_m) # verify signature assert mix_verify(params, vvk, kappa, sig, proof_v, clear_m)
def test_threshold_blind_sign(): params = setup() # user parameters m = 10 t, n = 2, 4 # generate key (sk, vk, vvk) = ttp_th_keygen(params, t, n) (priv, pub) = elgamal_keygen(params) # generate commitment and encryption for blind signature (cm, c, proof_s) = prepare_blind_sign(params, m, pub) # sign blind_sigs = [blind_sign(params, ski, cm, c, pub, proof_s) for ski in sk] (h, enc_sig) = zip(*blind_sigs) sigs = [(h[0], elgamal_dec(params, priv, enc_sigi)) for enc_sigi in enc_sig] # affregate signatures sig = aggregate_th_sign(params, sigs) # randomize signature sig = randomize(params, sig) # generate kappa and proof of correctness (kappa, proof_v) = show_blind_sign(params, vvk, m) # verify signature assert blind_verify(params, vvk, kappa, sig, proof_v)
def execute(): first_user = setup() second_user = setup() first_user.get('https://bairdchat.azurewebsites.net') second_user.get('https://bairdchat.azurewebsites.net') actions1 = ActionChains(first_user) actions2 = ActionChains(second_user) time.sleep(2) first_name_input = first_user.find_element_by_id('userInput') second_name_input = second_user.find_element_by_id('userInput') first_connect = first_user.find_element_by_id('connection-form-btn') second_connect = second_user.find_element_by_id('connection-form-btn') type_in_el(first_name_input, "John Doe") type_in_el(second_name_input, "Moto Moto") time.sleep(4) click_el(actions1, first_connect) click_el(actions2, second_connect) time.sleep(2) first_message_input = first_user.find_element_by_id('messageInput') second_message_input = second_user.find_element_by_id('messageInput') type_in_el(first_message_input, "Howdy!") type_in_el(second_message_input, "You as big as you plumpy!") enter(first_message_input) enter(second_message_input) time.sleep(3) first_user.close() second_user.close()
def execute(): browser = setup() browser.get("https://zachbaird.me") # Wait for the browser to load the page. time.sleep(2) actions = ActionChains(browser) theme_switch = browser.find_element_by_id('input-25') click_el(actions, theme_switch) time.sleep(2) browser.close()
def test_threshold_sign(): params = setup() # user parameters m = 10 t, n = 2, 4 # generate key (sk, vk, vvk) = ttp_th_keygen(params, t, n) # sign sigs = [sign(params, ski, m) for ski in sk] # affregate signatures sig = aggregate_th_sign(params, sigs) # randomize signature sig = randomize(params, sig) # verify signature assert verify(params, vvk, m, sig)
def test_mix_sign(): # user parameters q = 7 # number of messages hidden_m = [10] * 5 # hideen message clear_m = [3] * 2 # clear messages params = setup(q) (priv, pub) = elgamal_keygen(params) # El Gamal keypair # generate commitment and encryption for mix signature (cm, c, proof_s) = prepare_mix_sign(params, clear_m, hidden_m, pub) # signer 1 (sk1, vk1) = mix_keygen(params, q) mix_sig1 = mix_sign(params, sk1, cm, c, pub, proof_s, clear_m) (h, enc_sig1) = mix_sig1 sig1 = (h, elgamal_dec(params, priv, enc_sig1)) # signer 1 (sk2, vk2) = mix_keygen(params, q) mix_sig2 = mix_sign(params, sk2, cm, c, pub, proof_s, clear_m) (h, enc_sig2) = mix_sig2 sig2 = (h, elgamal_dec(params, priv, enc_sig2)) # aggregate signatures sig = aggregate_sign(sig1, sig2) # randomize signature sig = randomize(params, sig) # aggregate keys vk = mix_aggregate_keys([vk1, vk2]) # generate kappa and proof of correctness (kappa, proof_v) = show_mix_sign(params, vk, hidden_m) # verify signature assert mix_verify(params, vk, kappa, sig, proof_v, clear_m)
def test_blind_sign(): params = setup() # user parameters m = 5 # message (priv, pub) = elgamal_keygen(params) # El Gamal keypair # generate commitment and encryption for blind signature (cm, c, proof_s) = prepare_blind_sign(params, m, pub) # signer 1 (sk1, vk1) = keygen(params) blind_sig1 = blind_sign(params, sk1, cm, c, pub, proof_s) (h, enc_sig1) = blind_sig1 sig1 = (h, elgamal_dec(params, priv, enc_sig1)) # signer 2 (sk2, vk2) = keygen(params) blind_sig2 = blind_sign(params, sk2, cm, c, pub, proof_s) (h, enc_sig2) = blind_sig2 sig2 = (h, elgamal_dec(params, priv, enc_sig2)) # aggregate signatures sig = aggregate_sign(sig1, sig2) # randomize signature sig = randomize(params, sig) # aggregate keys vk = aggregate_keys(vk1, vk2) # generate kappa and proof of correctness (kappa, proof_v) = show_blind_sign(params, vk, m) # verify signature assert blind_verify(params, vk, kappa, sig, proof_v)
] SERVER_PORT = [80] * len(SERVER_ADDR) REPEAT = 10 ROUTE_SERVER_INFO = "/" ROUTE_KEY_SET = "/key/set" ROUTE_SIGN_PUBLIC = "/sign/public" ROUTE_SIGN_PRIVATE = "/sign/private" # parameters ATTRIBUTE = 10 N = len(SERVER_ADDR) T = 2 # does not impact latency # crypto params = setup() (sk, _, vvk) = ttp_th_keygen(params, T, N) # timings mem = [] tic = 0 ########################################## # utils ########################################## # test server connection def test_connection(): for i in range(N): r = requests.get( "http://"+SERVER_ADDR[i]+":"+str(SERVER_PORT[i])+ROUTE_SERVER_INFO
from lib import get_file, setup,getCOGpval, getCOGfunction, getinfoNCBI, get_best_hit from matplotlib_venn import venn3,venn3_circles import matplotlib.pyplot as plt import pandas as pd import numpy as np files = ["HMM_precision.txt","HMM_coverage.txt","DIAMOND_precision.txt","DIAMOND_coverage.txt","Blastp_thermococcis_precision.txt","Blastp_thermococcales_precision.txt"] filename = ["HMM one-to-one","HMM coverage","DIAMOND one-to-one","DIAMOND coverage","Blastp NR Thermococcis","Blastp NR Thermococcales"] if __name__ == '__main__': while True: # We store the user answers answer1,answer2 = setup() # Get functional annotations from HMM method HMM_function = getCOGfunction(get_file(files[answer1[0]])) # Same for DIAMOND DIAMOND_function = getCOGfunction(get_file(files[answer1[1]])) # Get p_values from HMM method HMM_p_vals = getCOGpval(get_file(files[answer1[0]])) # Same for DIAMOND DIAMOND_p_vals = getCOGpval(get_file(files[answer1[1]])) # Finally, get accession numbers from NR NR_accession = getinfoNCBI(get_file(files[answer2]))
#!/usr/bin/env python3 import os import sys from pathlib import Path if sys.version_info < (3, 4): raise SystemExit("Sorry, this code need Python 3.4 or higher") else: try: next(filter(lambda file: file.name == "docker-compose.yml", Path(os.getcwd()).glob("*"))) except StopIteration as e: print("ERROR: You must execute this script in the root lecture viewer directory") sys.exit(1) from lib import setup setup()
#import projectAFunctions #from project_A import project_A from project_A import * #import project_A.project_A #import project_A if __name__ == "__main__": print("\n**** Main ****\n") argumentsObject = getArguments() config = parseArguments(argumentsObject) # cleanup setup(config) # execute differ task #execute_task("perform_diff",config) # execute_project_A_function(config) perform_diff(config) # generate report html and mail #generate_report(config) # mail report #mail_report(config) cleanup(config)