-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutil.py
executable file
·42 lines (23 loc) · 911 Bytes
/
util.py
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
35
36
37
38
39
40
41
42
#!/usr/bin/env python3
import binascii
import os
import sys
from math import ceil
def block_print():
sys.stdout = open(os.devnull, 'w')
def enable_print():
sys.stdout = sys.__stdout__
def print_split_blocks_b64(text):
print(b'|'.join([binascii.b2a_base64(text)[16*i:16*i+16] for i in range(0, ceil(len(text)/16))]))
def print_split_blocks_hex(text):
print(b'|'.join([binascii.b2a_hex(text)[32*i:32*i+32] for i in range(0, ceil(len(text)/16))]).decode())
def print_split_blocks(text):
print(b'|'.join([text[16*i:16*i+16] for i in range(0, ceil(len(text)/16))]))
def get_index(block_n, char_id):
return block_n * 16 + char_id
def split_blocks(text):
return [text[i:i+16] for i in range(0, len(text), 16)]
def print_split_n(text, n):
print('|'.join([text[i:i+n] for i in range(0, len(text), n)]))
def clear():
os.system('cls' if os.name == 'nt' else 'clear')