2015-02-17 22:13:18 +00:00
|
|
|
import base64
|
|
|
|
|
2021-05-27 05:50:04 +00:00
|
|
|
b = base64.b64encode(b"zlutoucky kun upel dabelske ody")
|
2015-02-17 22:13:18 +00:00
|
|
|
print(b)
|
|
|
|
|
2021-05-27 05:50:04 +00:00
|
|
|
if b != b"emx1dG91Y2t5IGt1biB1cGVsIGRhYmVsc2tlIG9keQ==":
|
2015-02-17 22:13:18 +00:00
|
|
|
raise Exception("Error")
|
|
|
|
|
|
|
|
d = base64.b64decode(b)
|
|
|
|
print(d)
|
|
|
|
|
2021-05-27 05:50:04 +00:00
|
|
|
if d != b"zlutoucky kun upel dabelske ody":
|
2015-02-17 22:13:18 +00:00
|
|
|
raise Exception("Error")
|
|
|
|
|
|
|
|
base64.test()
|
|
|
|
|
2021-05-27 05:50:04 +00:00
|
|
|
binary = b"\x99\x10\xaa"
|
2015-02-17 22:13:18 +00:00
|
|
|
b = base64.b64encode(binary)
|
2021-05-27 05:50:04 +00:00
|
|
|
if b != b"mRCq":
|
2015-02-17 22:13:18 +00:00
|
|
|
raise Exception("Error")
|
|
|
|
|
|
|
|
d = base64.b64decode(b)
|
|
|
|
print(d)
|
|
|
|
if d != binary:
|
|
|
|
raise Exception("Error")
|
|
|
|
|
2021-05-27 05:50:04 +00:00
|
|
|
d = base64.b32encode(b"zlutoucky kun upel dabelske ody")
|
|
|
|
if d != b"PJWHK5DPOVRWW6JANN2W4IDVOBSWYIDEMFRGK3DTNNSSA33EPE======":
|
2015-02-17 22:13:18 +00:00
|
|
|
raise Exception("Error")
|
|
|
|
|
|
|
|
print(d)
|
|
|
|
b = base64.b32decode(d)
|
2021-05-27 05:50:04 +00:00
|
|
|
if b != b"zlutoucky kun upel dabelske ody":
|
2015-02-17 22:13:18 +00:00
|
|
|
raise Exception("Error")
|
|
|
|
|
|
|
|
print("OK")
|