Пример #1
0
from factorizations.factordb import *

banner()

try:

    def factordb(n):
        f = FactorDB(n)
        f.connect()
        return f.get_factor_list()

    c = int(input("==> c = "))
    n = int(input("==> n = "))
    e = int(input("==> e = "))

    factordb = factordb(n)
    q = factordb[0]
    p = factordb[1]
    phi = (p - 1) * (q - 1)
    d = modinv(e, phi)
    decrypt = pow(c, d, n)
    Convert(decrypt)

except IndexError:
    slowprint("[-] Sorry Can't Factorize n ")
except ImportError:
    slowprint("\n[-] Module Not Setup")
except ValueError:
    slowprint("\n[-] c, e, n Must Be Integar Number")
except AssertionError:
    slowprint("\n[-] Wrong Data")
Пример #2
0
from factorizations.factordb import *

banner()

try:

    def factordb(n):
        f = FactorDB(n)
        f.connect()
        return f.get_factor_list()

    c = int(input("==> c = "))
    n = int(input("==> n = "))
    e = int(input("==> e = "))

    primes = factordb(n)
    print(primes)
    phi = 1
    for i in primes:
        phi *= i - 1
    print(phi)
    d = modinv(e, phi)
    m = pow(c, d, n)
    convert(m)

except IndexError:
    slowprint("[-] Sorry Can't Factorize n ")
except ImportError:
    slowprint("\n[-] Module Not Setup")
except ValueError:
    slowprint("\n[-] c,n,e Must Be Integer Number")