diff --git a/inc/blowfish.php b/inc/blowfish.php
index b81991b25d0982733a38ebf784f8d6c7c70f24f9..42e3a589ac64b0d8d3c06a54d39555c726f850d4 100644
--- a/inc/blowfish.php
+++ b/inc/blowfish.php
@@ -478,17 +478,18 @@ class Horde_Cipher_blowfish
  *
  * @author  lem9
  */
-function PMA_blowfish_encrypt($data, $secret) 
+function PMA_blowfish_encrypt($data, $secret)
 {
     $pma_cipher = new Horde_Cipher_blowfish;
     $encrypt = '';
-    
+
+    $data .= '_'; // triming fixed for DokuWiki FS#1690 FS#1713
     $mod = strlen($data) % 8;
-    
+
     if ($mod > 0) {
         $data .= str_repeat("\0", 8 - $mod);
     }
-    
+
     foreach (str_split($data, 8) as $chunk) {
         $encrypt .= $pma_cipher->encryptBlock($chunk, $secret);
     }
@@ -512,11 +513,9 @@ function PMA_blowfish_decrypt($encdata, $secret)
     $pma_cipher = new Horde_Cipher_blowfish;
     $decrypt = '';
     $data = base64_decode($encdata);
-    
+
     foreach (str_split($data, 8) as $chunk) {
         $decrypt .= $pma_cipher->decryptBlock($chunk, $secret);
     }
-    return trim($decrypt,"\0"); // triming fixed for DokuWiki FS#1690
+    return substr(rtrim($decrypt, "\0"), 0, -1); // triming fixed for DokuWiki FS#1690 FS#1713
 }
-
-?>