A few intro-level challenges.
This commit is contained in:
commit
5a6f3e0b7e
4 changed files with 51 additions and 0 deletions
26
intro.py
Normal file
26
intro.py
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import base64
|
||||
from Crypto.Util.number import *
|
||||
from pwntools import xor
|
||||
|
||||
|
||||
# Challenge intro-1
|
||||
def int_to_ascii(input: [int]) -> str:
|
||||
res = bytearray()
|
||||
for i in input:
|
||||
res += i.to_bytes()
|
||||
return res.decode("utf-8")
|
||||
|
||||
|
||||
# Challenge intro-2
|
||||
def hex_to_ascii(input: str) -> str:
|
||||
return bytes.fromhex(input).decode("utf-8")
|
||||
|
||||
|
||||
# Challenge intro-3
|
||||
def hex_to_b64(input: str) -> bytes:
|
||||
return base64.b64encode(bytes.fromhex(input))
|
||||
|
||||
|
||||
# Challenge intro-4
|
||||
def int_to_message_rsa(input: int) -> str:
|
||||
return long_to_bytes(input)
|
||||
Loading…
Add table
Add a link
Reference in a new issue