Litteraly, I am killing myself over this. It should be a small thing, but I spent around several hours already on this.

```
function ssl_encrypt($pass, $data) {

    $salt = substr(md5(mt_rand(), true), 8);

    $key = md5($pass . $salt, true);
    $iv = md5($key . $pass . $salt, true);

    $ct = mcrypt_encrypt (MCRYPT_RIJNDAEL_128, $key, $data,
                          MCRYPT_MODE_CBC, $iv);

    return base64_encode('Salted__' . $salt . $ct);
}

 $key = ssl_encrypt('super', trim($_POST['pass']));

```

I am ecrypting a string and saving to file with:

```
 $value = $_POST['service'] . "=" . $key . "\n";

 file_put_contents($file, $value , FILE_APPEND); 

```

And it outputs something like this:

U2FsdGVkX1+0NB4++Kx28hUWNGwIqBoabI2O22U1TbpJ0n4FhzZvGtmSWiP7VOZj⏎ 

My thought that this last symbol is this "\n" from 

```
 $value = $_POST['service'] . "=" . $key . "\n";

```

I even tried something like this:

```
   $value = $_POST['service'] . "=" . $key.PHP_EOL;

        $fh = fopen($file,"a+");

        fwrite($fh, $value); //write to txtfile

        fclose($fh);

```

Still it outputs this:

U2FsdGVkX1+0NB4++Kx28hUWNGwIqBoabI2O22U1TbpJ0n4FhzZvGtmSWiP7VOZj⏎ 

How to get rid of that last backspace symbol? Please note that substring is not an option in this case.

this is how I decrypt:

```
function ssl_decrypt($pass, $data) {
    $data = base64_decode($data);
    $salt = substr($data, 8, 8);
    $ct = substr($data, 16);

    $key = md5($pass . $salt, true);
    $iv = md5($key . $pass . $salt, true);

    $pt = mcrypt_decrypt (MCRYPT_RIJNDAEL_128, $key, $ct,
                          MCRYPT_MODE_CBC, $iv);

    return $pt;
}

$Loader = new josegonzalez\Dotenv\Loader($pathtoenv);

```

// Parse the .env file

```
$environment = (new josegonzalez\Dotenv\Loader($pathtoenv))
              ->parse()
              ->toArray();

$digitalpass = ssl_decrypt('super', (string)$_ENV['digital']);

```