# ENCODE()

## Function Description

The `ENCODE()` function is used to encrypt strings symmetrically. It encodes the string by combining a secret key and requires the same key to decode it. Decryption needs to be performed with [`DECODE()`](https://omnifabric.cloudsigma.com/docs/reference/sql/Operators/operators/cast-functions-and-operators/decode.html.md).

## Function Syntax

```text
> ENCODE (str, pass_str);
```

## Parameter definition

| Parameters | Description |
| --- | --- |
| str | The original string to encode.           |
| pass_str | Password string (key) used for encryption.    |

## Example

```text
mysql> SELECT ENCODE('hello', 'mysecretkey');
+----------------------------+
| ENCODE(hello, mysecretkey) |
+----------------------------+
| ?;?                        |
+----------------------------+
1 row in set (0.00 sec)
```
