def compute_cipher (self, user, X, Y): C = self.conc(X, Y) dsa = DSA(self.point, self.n) u, v, m = dsa.sign(user, C) D = str(u) + '$' + str(v) + '$' + str(m) u_cipher = encrypt_AES(user, D) return u_cipher
def TransactionGen(p, q, g): #Generating one transaction (payer_a, payer_b) = DSA.KeyGen(p, q, g) #Generating Keys for Payer (payee_a, payee_b) = DSA.KeyGen(p, q, g) #Generating Keys for Payee transaction = BeforeSign(p, q, g, payer_b, payee_b) #Generating first part of the Transaction (r, s) = DSA.SignGen(transaction, p, q, g, payer_a, payer_b) #Signing the Transaction transaction += \ "Signature (r): " + str(r) + "\n" + \ "Signature (s): " + str(s) + "\n" #Appending the signatures return transaction
def verify_cipher (self, user, cipher, X, Y): D = decrypt_AES(user, cipher) [u, v, C] = D.split('$') u = int(u) v = int(v) if C != self.conc(Y, X): return 1, "[STS ERROR] Received message is different from expected" dsa = DSA(self.point, self.n) nb, error_m = dsa.verify(Y, C, u, v) if nb != 0: return nb, error_m return 0, "[STS] Verification OK, shared secret validated"
def GenTxBlock(p, q, g, count): whole_transaction = "" for i in range(count): transaction = "" transaction += "*** Bitcoin transaction ***\n" line = "Serial number: " x = uuid.uuid4().int line += str(x) + "\n" transaction += line line = "p: " + str(p) + "\n" transaction += line line = "q: " + str(q) + "\n" transaction += line line = "g: " + str(g) + "\n" transaction += line alpha, beta = DSA.KeyGen(p, q, g) line = "Payer Public Key (beta): " + str(beta) + "\n" transaction += line alpha2, beta2 = DSA.KeyGen(p, q, g) line = "Payee Public Key (beta): " + str(beta2) + "\n" transaction += line line = "Amount: " y = random.randint(1, 1000) line += str(y) + " Satoshi\n" transaction += line m = transaction (r, s) = DSA.SignGen(m, p, q, g, alpha, beta) line = "Signature (r): " + str(r) + "\n" transaction += line line = "Signature (s): " + str(s) + "\n" transaction += line whole_transaction += transaction return whole_transaction
def PoW(TxBlockFile, ChainFile, PoWLen, TxLen): #Updates LongestChain File for Each Block block = "" if TxBlockFile[-5] != "0": chainBuffer = open(ChainFile, "r") chain = chainBuffer.readlines() chainBuffer.close() block = chain[-1] #PoW for the Previous Transaction Block else: #for TransactionBlock0.txt block = "Day Zero Link in the Chain" + "\n" block += rootMerkle(TxBlockFile, TxLen) + "\n" #The Root Hash of the Merkle Tree while True: new_block = block + str(DSA.bitGenerator(2**128 - 1)) + "\n" new_PoW = hashlib.sha3_256(new_block).hexdigest() if new_PoW[:PoWLen] == "0" * PoWLen: new_PoW += "\n" #PoW block = new_block block += new_PoW break #Write/append to the ChainFile if TxBlockFile[-5] != "0": chainBuffer = open(ChainFile, "a") chainBuffer.write(block) chainBuffer.close() else: #for TransactionBlock0.txt chainBuffer = open(ChainFile, "w") chainBuffer.write(block) chainBuffer.close()
def GenSingleTx(p, q, g, alpha, beta): # Generating single transaction text file. transaction = nineLine(p, q, g, beta) # First nine lines will be hashed and signed. (r, s) = DSA.SignGen(transaction, p, q, g, alpha, beta) transaction += \ "Signature (r): " + str(r) + "\n" + \ "Signature (s): " + str(s) + "\n" return transaction # Returns the transaction string.
def GenSingleTx(p, q, g, alpha, beta): DSA_params = [p, q, g, alpha, beta] m = genMessageToHash(DSA_params) (r, s) = DSA.SignGen(m, p, q, g, alpha, beta) r = 'Signature (r): ' + str(r) s = 'Signature (s): ' + str(s) linesToBeWritten = '\n'.join( [m.rstrip(), r, s]) + '\n' return linesToBeWritten
def BeforeSign(p, q, g, payer_b, payee_b): #The Lines of the Transaction to be Signed transaction = \ "*** Bitcoin transaction ***" + "\n" + \ "Serial number: " + str(DSA.bitGenerator(2**128-1)) + "\n" + \ "p: " + str(p) + "\n" + \ "q: " + str(q) + "\n" + \ "g: " + str(g) + "\n" + \ "Payer Public Key (beta): " + str(payer_b) + "\n" + \ "Payee Public Key (beta): " + str(payee_b) + "\n" + \ "Amount: " + satoshi() + " Satoshi" + "\n" return transaction
def GenTxBlock(p, q, g, count): transaction = "" temp = "" for i in range(count): alpha_payee, beta_payee = DSA.KeyGen(p,q,g) alpha_payer, beta_payer = DSA.KeyGen(p,q,g) temp += "*** Bitcoin transaction ***\n" temp += "Serial number: " + str(random.getrandbits(128)) + "\n" temp += "p: " + str(p) + "\n" temp += "q: " + str(q) + "\n" temp += "g: " + str(g) + "\n" temp += "Payer Public Key (beta): " + str(beta_payer) + "\n" temp += "Payee Public Key (beta): " + str(beta_payee) + "\n" temp += "Amount: " + str(random.randint(0, 1000)) + " Satoshi\n" r, s = DSA.SignGen(temp, p, q, g, alpha_payer, beta_payer); temp += "Signature (r): " + str(r) + '\n' temp += "Signature (s): " + str(s) + '\n' transaction += temp temp = "" return transaction
def nineLine(p, q, g, beta): # First nine lines of single transaction. transaction = \ "*** Bitcoin transaction ***" + "\n" + \ "Serial number: " + str(DSA.bitGenerator(2**128-1)) + "\n" + \ "Payer: " + payee() + "\n" + \ "Payee: " + payee() + "\n" + \ "Amount: " + satoshi() + " Satoshi" + "\n" + \ "p: " + str(p) + "\n" + \ "q: " + str(q) + "\n" + \ "g: " + str(g) + "\n" + \ "Public Key (beta): " + str(beta) + "\n" return transaction
def main(): # DEPRECATED # returns a list containing p, q, g, r, s, beta # publicParams = DSA.main() # returns a list containing p, q, g, alpha, beta initParams = DSA.main() # Print SingleTransaction.txt file lines = GenSingleTx(initParams[0], initParams[1], initParams[2], initParams[3], initParams[4]) TxLib.writeToFile(lines.rstrip(), outputFiles[3]) print 'All text files are created.'
def GenSingleTx(p, q, g, alpha, beta): transaction = "" transaction += "*** Bitcoin transaction ***\n" line = "Serial number: " x = uuid.uuid4().int line += str(x) + "\n" transaction += line line = "Payer: " + id_generator() + "\n" transaction += line line = "Payee: " + id_generator() + "\n" transaction += line line = "Amount: " y = random.randint(1, 1000) line += str(y) + " Satoshi\n" transaction += line line = "p: " + str(p) + "\n" transaction += line line = "q: " + str(q) + "\n" transaction += line line = "g: " + str(g) + "\n" transaction += line line = "Public Key (beta): " + str(beta) + "\n" transaction += line m = transaction (r, s) = DSA.SignGen(m, p, q, g, alpha, beta) line = "Signature (r): " + str(r) + "\n" transaction += line line = "Signature (s): " + str(s) + "\n" transaction += line return transaction
def testSingleTx(): if os.path.exists('DSA_pkey.txt') == True and os.path.exists( 'DSA_skey.txt') == True: skeyFile = open('DSA_skey.txt', 'r') q = int(skeyFile.readline()) p = int(skeyFile.readline()) g = int(skeyFile.readline()) alpha = int(skeyFile.readline()) skeyFile.close() print("Public key is read from DSA_skey.txt") pkeyFile = open('DSA_pkey.txt', 'r') lines = pkeyFile.readlines() beta = int(lines[3]) pkeyFile.close() print("Public key is read from DSA_pkey.txt") else: print('DSA_skey.txt or DSA_pkey.txt does not exist') sys.exit() # pick a random message (string) TxFile = open("SingleTransaction.txt", "w") lines = TxFile.readlines() m = lines[0:9] print("message: ", m) r = int(lines[9][15:]) s = int(lines[10][15:]) print("Signature:") print("r: ", r) print("s: ", s) if DSA.SignVer(m, r, s, p, q, g, beta) == 1: print("Signature verifies:))") else: print("Signature does not verify:((") sys.exit()
def write_context_vectors(path_ctxvec, context_vectors_assoc, occ, min_occ,path_termlist_csv,source_lang,target_lang): termlist,termlist_inv = DSA.load_termlist(path_termlist_csv) with codecs.open(path_ctxvec,'w',encoding='utf-8') as f1 : for x in context_vectors_assoc: count = occ[x] if count >= min_occ : f1.write(context_vectors_assoc[x] + '\n') else: # If token has a frequency less than min_occ keep it as it is part of the evaluation list if termlist.has_key(x) and lang == source_lang: # keep the reference list line = context_vectors_assoc[x].split(':') token0 = line[0].split('#') result = str(token0[0]) + '#' + str(min_occ)+ ":" + ':'.join(line[1:]) f1.write(result.encode('utf-8') + '\n') else: if termlist_inv.has_key(x) and lang == target_lang: line = (context_vectors_assoc[x].split(':')) token0 = line[0].split('#') print token0 result = ((token0[0]) + '#' + (str(min_occ)) + ":" + (':'.join( line[1:]))) print result f1.write(result + '\n')
def GenSingleTx(p, q, g, alpha, beta): serialNum = random.getrandbits(128) payer = "Erdem Bozkurt" payee = ''.join( random.choice(string.ascii_uppercase + string.digits) for _ in range(10)) amount = random.randint(1, 10000) transaction = '''*** Bitcoin transaction *** Serial number: %d Payer: %s Payee: %s Amount: %d Satoshi p: %d q: %d g: %d Public Key (beta): %d ''' % (serialNum, payer, payee, amount, p, q, g, beta) r, s = DSA.SignGen(transaction, p, q, g, alpha, beta) transaction = transaction + '''Signature (r): %d Signature (s): %d ''' % (r, s) return transaction
s1 = 10137413521818981860558295844142463248736280669671376607939774420169 m2 = b"Ask me no questions, and I'll tell you no lies" r2 = 13601517662990253244919392623006368173804524139680316147330845851641 s2 = 5354638027707905626045156057361096890377811387248394522419069236340 shake1 = DSA.SHAKE128.new(m1) h1 = int.from_bytes(shake1.read(q.bit_length() // 8), byteorder='big') #computing hash for m1 shake2 = DSA.SHAKE128.new(m2) h2 = int.from_bytes(shake2.read(q.bit_length() // 8), byteorder='big') #computing hash for m2 x = 2 #coefficient between k1 and k2, start trying from 2 beta1_ = beta2_ = 0 while True: inv1 = DSA.modinv(s2 * r1 * x - s1 * r2, q) #i=2, j=1 inv2 = DSA.modinv(s1 * r2 * x - s2 * r1, q) #i=1, j=2 if inv1 != None: #if modular inverse exists a1 = ((s1 * h2 - s2 * h1 * x) * inv1) % q beta1_ = pow(g, a1, p) #corresponding public key if inv2 != None: #if modular inverse exists a2 = ((s2 * h1 - s1 * h2 * x) * inv2) % q beta2_ = pow(g, a2, p) #corresponding public key if beta == beta1_: #if it gives our public key print("Private key found when x =", x) print("Private key is found as", a1) break if beta == beta2_: #if it gives our public key print("Private key found when x = 1/", x) print("Private key is found as", a2) break
import DSA if __name__ == '__main__': while True: cmdGenerate = "0) Generate keys\n" cmdSign = "1) Signature generation\n" cmdVerify = "2) Signature verification\n" cmdExit = "3) Exit\n" opt = input("please input your command\n" + cmdGenerate + cmdSign + cmdVerify + cmdExit + "> ") if opt == "0": (p, q, g), pubKey, priKey = DSA.KeyGenerator() print("\n============== result ==============\n") print("P %X" % p) print("Q %X" % q) print("G %X" % g) print("pubKey %X" % pubKey) print("priKey %X\n" % priKey) elif opt == "1": m = input("Please enter your message: ") p = int(input("Please enter P(base 16): "), 16) q = int(input("Please enter Q(base 16): "), 16) g = int(input("Please enter G(base 16): "), 16) priKey = int(input("Please enter your key(base 16): "), 16) r, s = DSA.Sign(m, p, q, g, priKey) print("\n============== result ==============\n") print("R %X" % r) print("S %X\n" % s) elif opt == "2": m = input("Please enter your message: ") p = int(input("Please enter P(base 16): "), 16)
sys.exit() TxBlockFile = open(TxBlockFileName, "r") lines = TxBlockFile.readlines() TxBlockFile.close() # read the transaction txNo from the file and verify its signature transaction = lines[txNo*TxLen:(txNo+1)*TxLen] SignedPart = "".join(transaction[0:TxLen-2]) p = int(transaction[2][3:]) q = int(transaction[3][3:]) g = int(transaction[4][3:]) beta = int(transaction[5][25:]) r = int(transaction[8][15:]) s = int(transaction[9][15:]) if DSA.SignVer(SignedPart, r, s, p, q, g, beta)==1: print "The signature of the transaction verifies:))" else: print "The signature of the transaction does not verify:((" # Check if the transaction really belongs to that block # using "LongestChain.txt file" # The method is hash tree BlockChainFileName = "LongestChain.txt" if os.path.exists(BlockChainFileName) == False: print "Error: ", BlockChainFileName, "does not exist" sys.exit() BlockChainFile = open(BlockChainFileName, "r") blocks = BlockChainFile.readlines() # read the root hash from the BlockChainFileName file
if response.ok: res = response.json() print(res) c, N, e = res['c'], res['N'], res['e'] #get c, N, e else: print(response.json()) ###### #c = 6850041245076098620324426208284809865598841760601355452569737339927351640266063051633031519540852881248276490971209933718577133836504579781727541727907393107116722045684457705917182924930498126749834641777073669191391684909670209826184198364640308696309963363803404264413377922038109665920190322658776246031665560823913075896351811982752212355209132165312413531911427515411470755798203380954840262527373829334705065690391826299834426989543935194953188537288642925748676255132959650599692084424253943038794750498705386083735575602936006995765461839110456977783165336035330964125304394828315105519941869301711909130317 #N = 26570927162480737628985979203754072331946194492775210615224297972011744173941901816424061641629410774614008488685919271530391604171337234198111376684967784318130245430521386636931825815033716005580574144536158735220817017331513776598639232191685378945108934070246971078593116594187093852985690509208868473031905575752098253618707363954507549299255829726753255010984781668655145200872618181467368237195042352624541163587556719474038165282251445151777510755393767011091201655442513743652421000131775919984218048130718796389532361194191968866028104038025606263666775683757562416321168778465969563785651946597616485652527 #e = 65537 import DSA x = random.randint(pow(2, 8, N), pow(2, 9, N)) #picking a random integer g = DSA.egcd(x, N)[0] while g != 1: #pick the integer again if it's gcd(x,N) is not 1 (not relatively prime) x = random.randint(pow(2, 8, N), pow(2, 9, N)) g = DSA.egcd(x, N)[0] print("x is", x) x_inverse = DSA.modinv(x, N) #calculating x^-1 print("x inverse is", x_inverse) c_ = (c * pow(x, e, N)) % N #calculating c_ print("c_ is", c_) ###### Query Oracle it will return corresponding plaintext endpoint = '{}/{}/{}/{}'.format(API_URL, "RSA_Oracle_query", my_id, c_) response = requests.get(endpoint) if (response.ok): m_ = (response.json()['m_'])
random.seed(3) # uncommment if you want it to generate the same random number in every run ParamGenOn = 0 # set to 1 if you want to generate the DSA parameters ParamTestOn = 0 # set to 1 if you want to validate the DSA parameters KeyGenOn = 0 # set to 1 if your want to generate secret/public key pair for a user KeyTestOn = 0 # set to 1 if you want to validate the DSA keys SignTestOn = 0 # set to 1 if you want to test your signature generation and verification TxGenOn = 0 # set to 1 if you want to generate a signed bitcoin transaction TxTestOn = 0 # set to 1 if you want to validate your transaction # DSA parameter generation if ParamGenOn: print "DSA Parameter Generation: " small_bound = 1 << 256 large_bound = 1 << 2048 q, p, g = DSA.DL_Param_Generator(small_bound, large_bound) outf = open('DSA_params.txt', 'w') outf.write(str(q)) outf.write("\n") outf.write(str(p)) outf.write("\n") outf.write(str(g)) outf.close() print "p, q, and g were written into file DSA_params.txt" # Validation for DSA parameter generation if ParamTestOn: if ParamGenOn==0: if os.path.exists('DSA_params.txt') == True: inf = open('DSA_params.txt', 'r')
#-------------------------------------------------------------------------------------------------- #-------------------------------------------------------------------------------------------------- # Main #-------------------------------------------------------------------------------------------------- if __name__ == '__main__': stopwords = {} occ = {} coocc = {} tab_res = [] # Load arguments --------------------------------------------------------------------------------- args = DSA.load_args() # Parameters:--------------------------------------------------------------------------------------- corpus = args.corpus # sys.argv[1] lang = args.lang # sys.argv[2] # Language : en/fr/... corpus_type = args.corpus_type # sys.argv[3] # Flag : tok/lem/postag flag_filter = args.flag_filter # True if int(sys.argv[4]) == 1 else False # Filter stopwords 1/0 w = int( args.w ) # int(sys.argv[5]) # : window size 1/2/3... number of words before and after the center word corpus_dir = "../data/train/corpora/" + corpus + '/' + corpus_type + '/' + lang stopwords_path = "../data/train/stopwords/" + "stopwords_" + lang + ".txt" path_vocab = "../data/train/corpora/" + corpus + '/tmp/vocab_' + lang + ".csv" path_ctxvec = "../data/train/corpora/" + corpus + '/context_vectors/' + corpus + '_' + lang + '_w' + str( w) + ".vect"
def DSAVerifySignature(p, q, g, y, r, s, message): return DSA.verifySignature(p, q, g, y, r, s, message)
def DSAGenerateSignature(p, q, g, x, message): sign = DSA.generateSignature(p, q, g, x, message) r, s = sign[0], sign[1] return r, s
Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1I-J9zecIyOdI4ErcrwPOTCN2wo5-4mEP """ import DSA q = 18462870797958734358460540315802311963744999954506807981508498635091 p = 21844102112122237484058484990223222527816981702828279171498143036582716271485474028380542696862193720852272618397503658771128114568430034544311836848132556591324273117839115478343051538427437664722980830771161939139222964707695276957432968033365352302080366315415735532111302710857807281798249043320899027800135122873123243743524724602070457967657285884563858968187732680723369906222214201250288443824722261682828970158731587663585174032887767988219143996717380923998096794060064023264584949115354715211375168860544716843940259887168163262505413440632980952366656691935232538721726450037087263854935179798694999345517 g = 13843079639351340920273184714590884400432847093058770970775133079628015343474638985949514224469231316509301786191837239734743524804707156837615319355419215945094865320399756037490734275197507243978890158231379210099367755690209217652326933425758170008835084657241675545571324146202714002127571892258435472678396358353938476569410849475658691697420643000086724156167275855286708191941521213998074404126295230559090196852525498568126029906179168789585152438330622252753643553805877257623433974639379577436808678860489830511416186993204671106346196262903362008285485594747047950971109814842643611103016670841253194356243 beta = 6187481213658176498787124123601684091780046690985227386674127034254039365850646655310542241724937514112519192485497669738105144173607992347626869972509174309127140941080651743898030456747633487761927322752193676176314211884662768871783260572354989592156755352437101758031330846064492530779348477298394716501400849788380847680039744807953192006233069850428367974025006391433578254859633968702925514987402010031888483663325943692618870576893826021018783543580318493456251127341437691102522482919743872855098214539426447960934626890138798345418250945885432084267499991534185991486840567366979305573275554091497155603826 m1 = b"He who laugh last didn't get the joke" r1 = 6164572993148268278544315246158794966061243456603081427389792698784 s1 = 2412874836775368230194957659405258449579579568340501217618177629780 m2 = b"Ask me no questions, and I'll tell you no lies" r2 = 6164572993148268278544315246158794966061243456603081427389792698784 s2 = 343379365128270720539597367095485301128970178274104846189598795161 #r1 = r2 shake1 = DSA.SHAKE128.new(m1) h1 = int.from_bytes(shake1.read(q.bit_length()//8), byteorder='big') #computing hash for m1 shake2 = DSA.SHAKE128.new(m2) h2 = int.from_bytes(shake2.read(q.bit_length()//8), byteorder='big') #computing hash for m1 a = (s2*h1 - s1*h2) * DSA.modinv(r1 * (s1 - s2),q) #Computing a when i=2, j=1 a = a % q beta_ = pow(g,a,p) #computing corresponding public keys if beta_ == beta: #checking if it gives our public key print("Private key is:", a)
#----------------------------------------------------------------------------------------------------- # Main #----------------------------------------------------------------------------------------------------- if __name__=='__main__': context_vectors = {} Tab_occ_X ={} Tab_cooc_XY ={} Tab_cooc_X_ALL ={} Tab_cooc_ALL_Y ={} Total = 0 context_vectors_assoc = {} occ = {} # Load arguments --------------------------------------------------------------------------------- args = DSA.load_args() # ---------------------------------------------------------------------------------------------------- # Parameters:--------------------------------------------------------------------------------------- corpus = args.corpus # sys.argv[1] # Corpus lang = args.lang # sys.argv[2] # Language : en/fr/... source_lang = args.source_lang # sys.argv[3] # target_lang = args.target_lang # sys.argv[4] # assoc = args.assoc # sys.argv[5] # MI / JAC / ODDS w = int(args.w) # int(sys.argv[6]) # : window size 1/2/3... number of words before and after the center word min_occ = int(args.min_occ) # int(sys.argv[7]) # : filtering tokens with number of occurence less than min_occ termlist_name = args.termlist_name # sys.argv[8] # Term list name (evaluation list name) path_vocab = "../data/train/corpora/" + corpus + '/tmp/vocab_'+lang + ".csv" path_ctxvec = "../data/train/corpora/" + corpus + '/context_vectors/'+corpus+'_'+lang + '_w' + str(w) + ".vect" path_ctxvec_assoc = "../data/train/corpora/" + corpus + '/context_vectors/'+corpus+'_'+lang + '_w' + str(w) + "_min" + str(min_occ)+ "_"+ assoc + ".assoc"
if __name__=='__main__': source_vec = {} target_vec = {} termlist = {} termlist_inv = {} occ = {} sorted_vocab = [] cpt_src_terms = 0 cpt_target_cand = 0 # Load arguments --------------------------------------------------------------------------------- args = DSA.load_args() # ---------------------------------------------------------------------------------------------------- # Parameters:--------------------------------------------------------------------------------------- corpus = args.corpus # sys.argv[1] # Corpus source_lang = args.source_lang # sys.argv[2] # target_lang = args.target_lang # sys.argv[3] # assoc = args.assoc # sys.argv[4] # MI / JAC / ODDS sim = args.sim # cos / jac w = int(args.w) # int(sys.argv[5]) # : window size 1/2/3... number of words before and after the center word min_occ = int(args.min_occ) # int(sys.argv[6]) # : filtering tokens with number of occurence less than min_occ termlist_name = args.termlist_name # sys.argv[7] # Term list name (evaluation list name) dictionary_name = args.dictionary_name # sys.argv[8] # Bilinguam dictionary
# Main #----------------------------------------------------------------------------------------------------- if __name__=='__main__': occ_src = {} occ_tgt = {} context_vectors_assoc = {} context_vectors_trad = {} dico = {} dico_cooc = {} termlist = {} termlist_inv = {} # Load arguments --------------------------------------------------------------------------------- args = DSA.load_args() # ---------------------------------------------------------------------------------------------------- # Parameters:--------------------------------------------------------------------------------------- corpus = args.corpus # sys.argv[1] # Corpus source_lang = args.source_lang # sys.argv[2] # target_lang = args.target_lang # sys.argv[3] # assoc = args.assoc # sys.argv[4] # MI / JAC / ODDS w = int(args.w) # int(sys.argv[5]) # : window size 1/2/3... number of words before and after the center word min_occ = int(args.min_occ) # int(sys.argv[6]) # : filtering tokens with number of occurence less than min_occ termlist_name = args.termlist_name # sys.argv[7] # Term list name (evaluation list name) dictionary_name = args.dictionary_name # sys.argv[8] # Bilinguam dictionary path_vocab_src = "../data/train/corpora/" + corpus + '/tmp/vocab_'+source_lang + ".csv" path_vocab_tgt = "../data/train/corpora/" + corpus + '/tmp/vocab_'+target_lang + ".csv"