-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgrsed_core.py
More file actions
26 lines (20 loc) · 722 Bytes
/
grsed_core.py
File metadata and controls
26 lines (20 loc) · 722 Bytes
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
import base64
from random import choice
from string import ascii_letters
#grsed -r {number}
#grsed -e {string}
#grsed -d {encoded string}
def random_characters(lenght):
"Returns a string of character with the lenght of the number provided."
string = []
for number in range(lenght):
string.append(choice(ascii_letters))
return "".join(string)
def encode_string_64(string):
"Returns a string encoded in base64."
encodedString = base64.b64encode(string.encode("utf-8"))
return str(encodedString, "utf-8")
def decode_string_64(encoded_string):
"Returns an encoded base64 string decoded."
decodedString = base64.b64decode(encoded_string)
return str(decodedString, "utf-8")