fix: do not escape 'secret!'

This commit is contained in:
ptrcnull 2024-11-06 04:20:45 +01:00
parent b51fb6569d
commit f300f2c538

View file

@ -18,7 +18,7 @@ def base16_encode(key: str) -> str:
char = string.ascii_uppercase[idx]
res += char
return res
def base16_decode(key: str) -> str:
res = ''
for char in key:
@ -29,6 +29,8 @@ def base16_decode(key: str) -> str:
return bytes.fromhex(res).decode()
def escape_key(key: str) -> str:
if key == 'secret!':
return key
if not re.fullmatch(keyre, key):
return 'based_' + base16_encode(key)
return key