예제 #1
0
def generateModulus(size, e):
    p = e + 1
    q = e + 1
    while ((p % e) == 1):
        p = generatePrime(size // 2)
    while ((q % e) == 1):
        q = generatePrime(size // 2)
    return p * q
예제 #2
0
def generateModulus(size, e):
    p = e+1;
    q = e+1;
    while ((p%e) == 1):
        p = generatePrime(size//2);
    while ((q%e) == 1):
        q = generatePrime(size//2);
    return p*q;
예제 #3
0
파일: prob41.py 프로젝트: Darriall/cipher-1
def generate_rsa_key(bits, e=65537):
    result = { "e" : e }
    p = (e+1)
    q = (e+1)
    while ((p % e) == 1):
        p = generatePrime(bits//2);
    while ((q%e) == 1):
        q = generatePrime(bits//2);
    result["p"] = p;
    result["q"] = q;
    result["N"] = p*q;
    result["d"] = invmod(e, (p-1)*(q-1));
    return result;
예제 #4
0
def generate_rsa_key(bits, e=65537):
    result = {"e": e}
    p = (e + 1)
    q = (e + 1)
    while ((p % e) == 1):
        p = generatePrime(bits // 2)
    while ((q % e) == 1):
        q = generatePrime(bits // 2)
    result["p"] = p
    result["q"] = q
    result["N"] = p * q
    result["d"] = invmod(e, (p - 1) * (q - 1))
    return result