repo.or.cz
/
python
/
dscho.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Added 'list_only' option (and modified 'run()' to respect it).
[python/dscho.git]
/
Lib
/
test
/
test_rotor.py
blob
a5c02aa48d9f65e34189bcaf829bd5ade345529b
1
import
rotor
2
3
r
=
rotor
.
newrotor
(
"you'll never guess this"
)
4
r
=
rotor
.
newrotor
(
"you'll never guess this"
,
12
)
5
6
A
=
'spam and eggs'
7
B
=
'cheese shop'
8
9
a
=
r
.
encrypt
(
A
)
10
print
`a`
11
b
=
r
.
encryptmore
(
B
)
12
print
`b`
13
14
A1
=
r
.
decrypt
(
a
)
15
print
A1
16
if
A1
<>
A
:
17
print
'decrypt failed'
18
19
B1
=
r
.
decryptmore
(
b
)
20
print
B1
21
if
B1
<>
B
:
22
print
'decryptmore failed'
23
24
try
:
25
r
.
setkey
()
26
except
TypeError
:
27
pass
28
r
.
setkey
(
'you guessed it!'
)