Esempio n. 1
0
def test_hack_RSA():
    print("Testing Wiener Attack")
    times = 5
    
    while(times>0):
        e,n,d = RSAvulnerableKeyGenerator.generateKeys(1024)
        print("(e,n) is (", e, ", ", n, ")")
        print("d = ", d)
    
        hacked_d = hack_RSA(e, n)
    
        if d == hacked_d:
            print("Hack WORKED!")
        else:
            print("Hack FAILED")
        
        print("d = ", d, ", hacked_d = ", hacked_d)
        print("-------------------------")
        times -= 1
def test_hack_RSA():
    """
    Test Weiner's attack on a set of known vulnerable keys
    """

    for i in range(0, 5):
        e, n, d = RSAvulnerableKeyGenerator.generateKeys(1024)
        print("(e, n) is (", e, ", ", n, ")")
        print("d = ", d)

        hacked_d = hack_RSA(e, n)

        if d == hacked_d:
            print("Attack worked!")
        else:
            print("Attack failed!")

        print("d = ", d, ", hacked_d = ", hacked_d)
        print("-------------------------")
def test_hack_RSA():
    print("Testing Wiener Attack")
    times = 5
    
    while(times>0):
        e,n,d = RSAvulnerableKeyGenerator.generateKeys(1024)
        print("(e,n) is (", e, ", ", n, ")")
        print("d = ", d)
    
        hacked_d = hack_RSA(e, n)
    
        if d == hacked_d:
            print("Hack WORKED!")
        else:
            print("Hack FAILED")
        
        print("d = ", d, ", hacked_d = ", hacked_d)
        print("-------------------------")
        times -= 1
Esempio n. 4
0
def test_hack_RSA():
    print "--------------------------------------------------------------------"
    print "Demo tan cong Wiener"
    print "--------------------------------------------------------------------"
    p, q, e, n, d = RSAvulnerableKeyGenerator.generateKeys(1024)
    print "p = ", p
    print "q = ", q
    print "n = ", n
    print "e = ", e
    print "d = ", d

    hacked_d = hack_RSA(e, n)

    if d == hacked_d:
        print("thanh cong!!")
    else:
        print("that bai :(")
    print "d ban dau: ", d
    print "d thu duoc: ", hacked_d
    return