fix: do not escape 'secret!'
This commit is contained in:
parent
b51fb6569d
commit
f300f2c538
1 changed files with 3 additions and 1 deletions
|
@ -18,7 +18,7 @@ def base16_encode(key: str) -> str:
|
||||||
char = string.ascii_uppercase[idx]
|
char = string.ascii_uppercase[idx]
|
||||||
res += char
|
res += char
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def base16_decode(key: str) -> str:
|
def base16_decode(key: str) -> str:
|
||||||
res = ''
|
res = ''
|
||||||
for char in key:
|
for char in key:
|
||||||
|
@ -29,6 +29,8 @@ def base16_decode(key: str) -> str:
|
||||||
return bytes.fromhex(res).decode()
|
return bytes.fromhex(res).decode()
|
||||||
|
|
||||||
def escape_key(key: str) -> str:
|
def escape_key(key: str) -> str:
|
||||||
|
if key == 'secret!':
|
||||||
|
return key
|
||||||
if not re.fullmatch(keyre, key):
|
if not re.fullmatch(keyre, key):
|
||||||
return 'based_' + base16_encode(key)
|
return 'based_' + base16_encode(key)
|
||||||
return key
|
return key
|
||||||
|
|
Loading…
Reference in a new issue