1- import string
2- import random
3- from base64 import b64encode , b64decode
1+ # Definition of radius
2+ r = 2
43
5- FLAG = 'flag{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}'
4+ # Import the math package
5+ import math
66
7- enc_ciphers = [ 'rot13' , 'b64e' , 'caesar' ]
8- # dec_ciphers = ['rot13', 'b64d', 'caesard']
7+ # Calculate C
8+ C = 2 * math . pi * r
99
10- def rot13 (s ):
11- _rot13 = string .maketrans (
12- "ABCDEFGHIJKLMabcdefghijklmNOPQRSTUVWXYZnopqrstuvwxyz" ,
13- "NOPQRSTUVWXYZnopqrstuvwxyzABCDEFGHIJKLMabcdefghijklm" )
14- return string .translate (s , _rot13 )
10+ # Calculate A
11+ A = math .pi * (r ** 2 )
1512
16- def b64e (s ):
17- return b64encode (s )
18-
19- def caesar (plaintext , shift = 3 ):
20- alphabet = string .ascii_lowercase
21- shifted_alphabet = alphabet [shift :] + alphabet [:shift ]
22- table = string .maketrans (alphabet , shifted_alphabet )
23- return plaintext .translate (table )
24-
25- def encode (pt , cnt = 50 ):
26- tmp = '2{}' .format (b64encode (pt ))
27- for cnt in xrange (cnt ):
28- c = random .choice (enc_ciphers )
29- i = enc_ciphers .index (c ) + 1
30- _tmp = globals ()[c ](tmp )
31- tmp = '{}{}' .format (i , _tmp )
32-
33- return tmp
34-
35- if __name__ == '__main__' :
36- print (encode (FLAG , cnt = ?))
13+ # Build printout
14+ print ("Circumference: " + str (C ))
15+ print ("Area: " + str (A ))
0 commit comments