# Kullanım

{% tabs %}
{% tab title="Metin" %}

```python
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)
```

{% endtab %}

{% tab title="Dosya" %}

```python
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}")
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
[**Github**](https://github.com/beytullahakyuz/securebase-python)'ta bulunan [SecureBaseApp](https://github.com/beytullahakyuz/securebase-python/tree/main/demos/SecureBaseApp) uygulaması üzerinden örnek kullanımları inceleyebilirsiniz.
{% endhint %}

***
