> For the complete documentation index, see [llms.txt](https://low-caps-hub.gitbook.io/lowcapshubterminal/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://low-caps-hub.gitbook.io/lowcapshubterminal/encryption-section/sha-256.md).

# SHA-256

Low Caps Hub uses exactly the same encryption algorithm as Bitcoin - unbreakable SHA-256. That's why, we strongly recommend to protect your private keys via it.

<figure><img src="https://3670432737-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwJuUkk9Y24vVhd9jDCn1%2Fuploads%2F4WGVDpma8p8Q7jO84U7V%2FX.PNG?alt=media&amp;token=5c900e01-7af5-4389-871b-974408f21553" alt=""><figcaption></figcaption></figure>

\
Function, which is using to encryption with SHA-256:

```python
def encrypt_data(data, passphrase):
    salt = os.urandom(16)
    kdf = PBKDF2HMAC(
        algorithm=hashes.SHA256(),
        length=32,
        salt=salt,
        iterations=100000,
        backend=default_backend()
    )
    key = kdf.derive(passphrase.encode())
    nonce = os.urandom(12)
    cipher = Cipher(algorithms.AES(key), modes.GCM(nonce), backend=default_backend())
    encryptor = cipher.encryptor()
    ciphertext = encryptor.update(data) + encryptor.finalize()
    return salt + nonce + encryptor.tag + ciphertext
```
