blob: 1aff5894fe2f34f97a827c06f3ee262dec91c069 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#!/usr/bin/python
import sys, botan
def encrypt(input):
pipe = botan.Pipe(botan.Filter("ARC4",
key = botan.SymmetricKey("AABB")),
botan.Filter("Hex_Encoder"))
pipe.start_msg()
pipe.write(input)
pipe.end_msg()
return pipe.read_all_as_string()
def decrypt(input):
pipe = botan.Pipe(botan.Filter("Hex_Decoder"),
botan.Filter("ARC4",
key = botan.SymmetricKey("AABB")))
pipe.start_msg()
pipe.write(input)
pipe.end_msg()
return pipe.read_all_as_string()
def main():
ciphertext = encrypt("hi chappy")
print ciphertext
print decrypt(ciphertext)
if __name__ == "__main__":
sys.exit(main())
|