Exemple #1
0
    print "E                = ", hex(E)  # 8-bits
    print "M                = ", hex(M)  # 1024-bits
    print "(X^E) mod M      = ", hex(C)  # 1024-bits
    print "(X^E) mod M      = ", hex(D)  # 1024-bits
    print "error            = ", hex(e)

#####################################################

if operation == 5:

    print "Test Vector for RSA\n"

    print "\n--- Precomputed Values"

    # Generate two primes (p,q), and modulus
    [p, q, N] = helpers.getModuli(1024)

    print "p            = ", hex(p)  # 512-bits
    print "q            = ", hex(q)  # 512-bits
    print "Modulus      = ", hex(N)  # 1024-bits

    # Generate Exponents
    [e, d] = helpers.getRandomExponents(p, q)

    print "Enc exp      = ", hex(e)  # 16-bits
    print "Dec exp      = ", hex(d)  # 1024-bits

    # Generate Message
    M = helpers.getRandomMessage(1024, N)

    print "Message      = ", hex(M)  # 1024-bits
Exemple #2
0
    print "E                = ", hex(E)  # 8-bits
    print "M                = ", hex(M)  # 512-bits
    print "(X^E) mod M      = ", hex(C)  # 512-bits
    print "(X^E) mod M      = ", hex(D)  # 512-bits
    print "error            = ", hex(e)

#####################################################

if operation == 5:

    print "Test Vector for RSA\n"

    print "\n--- Precomputed Values"

    # Generate two primes (p,q), and modulus
    [p, q, N] = helpers.getModuli(512)

    print "p            = ", hex(p)  # 512-bits
    print "q            = ", hex(q)  # 512-bits
    print "Modulus      = ", hex(N)  # 1024-bits

    # Generate Exponents
    [e, d] = helpers.getRandomExponents(p, q)

    print "Enc exp      = ", hex(e)  # 16-bits
    print "Dec exp      = ", hex(d)  # 1024-bits

    # Generate Message
    M = helpers.getRandomMessage(1024, N)

    print "Message      = ", hex(M)  # 512-bits