blob: 28c5af5b1c6b0b253325601c9e63a88d51352e61 [file] [log] [blame]
Barry Warsaw5e056bb1996-12-23 23:39:42 +00001import rotor
2
3r = rotor.newrotor("you'll never guess this")
4r = rotor.newrotor("you'll never guess this", 12)
5
6A = 'spam and eggs'
7B = 'cheese shop'
8
9a = r.encrypt(A)
Guido van Rossumc4c26411997-08-14 19:55:00 +000010print `a`
Barry Warsaw5e056bb1996-12-23 23:39:42 +000011b = r.encryptmore(B)
Guido van Rossumce320961997-08-18 13:42:28 +000012print `b`
Barry Warsaw5e056bb1996-12-23 23:39:42 +000013
14A1 = r.decrypt(a)
15print A1
Fred Drake132dce22000-12-12 23:11:42 +000016if A1 != A:
Barry Warsaw5e056bb1996-12-23 23:39:42 +000017 print 'decrypt failed'
18
19B1 = r.decryptmore(b)
20print B1
Fred Drake132dce22000-12-12 23:11:42 +000021if B1 != B:
Barry Warsaw5e056bb1996-12-23 23:39:42 +000022 print 'decryptmore failed'
23
Barry Warsaw5afafad1997-01-02 20:02:44 +000024try:
25 r.setkey()
26except TypeError:
27 pass
Barry Warsaw5e056bb1996-12-23 23:39:42 +000028r.setkey('you guessed it!')