From: Ian Jackson Date: Fri, 29 Nov 2019 21:27:00 +0000 (+0000) Subject: make-secnet-sites: Provide base91s_encode and base91s_decode X-Git-Tag: v0.6.0~107 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=secnet.git;a=commitdiff_plain;h=3f04bde1b26b0578027eda4d19ce296cd1c3b227 make-secnet-sites: Provide base91s_encode and base91s_decode We will use these in a moment. Signed-off-by: Ian Jackson --- diff --git a/make-secnet-sites b/make-secnet-sites index 38badbb..6cb131e 100755 --- a/make-secnet-sites +++ b/make-secnet-sites @@ -70,6 +70,7 @@ import ipaddress sys.path.insert(1,"/usr/local/share/secnet") sys.path.insert(1,"/usr/share/secnet") import ipaddrset +import base91 from argparseactionnoyes import ActionNoYes @@ -89,6 +90,12 @@ def debugrepr(*args): if debug_level > 0: print(repr(args), file=sys.stderr) +def base91s_encode(bindata): + return base91.encode(bindata).replace('"',"-") + +def base91s_decode(string): + return base91.decode(string.replace("-",'"')) + class Tainted: def __init__(self,s,tline=None,tfile=None): self._s=s