from .decrypt import decrypt as d
from .encrypt import encrypt as e
from .generatekeys import genkeys as g
def pg(e, bit):
    dp = open("rsakeys/d", "w+")
    ep = open("rsakeys/e", "w+")
    np = open("rsakeys/n", "w+")
    a, b, c = g(e,bit)
    np.write(str(a))
    ep.write(str(b))
    dp.write(str(c))
    dp.close()
    ep.close()
    np.close()
def pe():
    mo = open("rsaoutput/eo", "w+")
    mp = open("rsainput/ei", "r")
    ep = open("rsakeys/e", "r")
    np = open("rsakeys/n", "r")
    ev=ep.read()
    nv=np.read()
    mv=mp.read()
    mo.write(str(e(int(mv), int(ev), int(nv))))
    mp.close()
    mo.close()
    ep.close()
    np.close()
def pd():
    mo = open("rsaoutput/do", "w+")
    mp = open("rsainput/di", "r")
    dp = open("rsakeys/d", "r")
    np = open("rsakeys/n", "r")
    dv=dp.read()
    nv=np.read()
    mv=mp.read()
    mo.write(str(d(int(mv), int(dv), int(nv))))
    mp.close()
    mo.close()
    dp.close()
    np.close()

from .decrypt import decrypt as d
from .encrypt import encrypt as e
from .generatekeys import genkeys as g
def pg(e, bit):
    dp = open("rsakeys/d", "w+")
    ep = open("rsakeys/e", "w+")
    np = open("rsakeys/n", "w+")
    a, b, c = g(e,bit)
    np.write(str(a))
    ep.write(str(b))
    dp.write(str(c))
    dp.close()
    ep.close()
    np.close()
def pe():
    mo = open("rsaoutput/eo", "w+")
    mp = open("rsainput/ei", "r")
    ep = open("rsakeys/e", "r")
    np = open("rsakeys/n", "r")
    ev=ep.read()
    nv=np.read()
    mv=mp.read()
    mo.write(str(e(int(mv), int(ev), int(nv))))
    mp.close()
    mo.close()
    ep.close()
    np.close()
def pd():
    mo = open("rsaoutput/do", "w+")
    mp = open("rsainput/di", "r")
    dp = open("rsakeys/d", "r")
    np = open("rsakeys/n", "r")
    dv=dp.read()
    nv=np.read()
    mv=mp.read()
    mo.write(str(d(int(mv), int(dv), int(nv))))
    mp.close()
    mo.close()
    dp.close()
    np.close()
