Usage
Last updated
from SecureBase import SecureBase, SBEncoding
#enc = SBEncoding.UNICODE
enc = SBEncoding.UTF8
sb = SecureBase(encoding=enc)
sb.set_secret_key("set-secret-key")
#Text to Base64
encoded = sb.encode(inputdata)
#Base64 to Text
decoded = sb.decode(inputdata)
from SecureBase import SecureBase, SBEncoding
sb = SecureBase(encoding=SBEncoding.UTF8)
sb.set_secret_key("SET-SECRET-KEY")
try:
with open("data.txt", "r", encoding="utf-8") as file:
content = file.read()
file.close()
encoded = sb.encode(content)
with open("encoded.txt", "w") as fw:
fw.write(sb.encode(content))
fw.close()
with open("decoded.txt", "w") as fw:
fw.write(sb.decode(encoded))
fw.close()
except Exception as e:
print(f"!: {e}")
You can examine sample usage via the SecureBaseApp application on Github.
Last updated