diff --git a/lib/Net/LDAP3.php b/lib/Net/LDAP3.php
index 7df93ad044d245e7bc423e3e158a00eb818af081..69d0cc7fcc76812b5142422a4e3930786f85c49c 100644
--- a/lib/Net/LDAP3.php
+++ b/lib/Net/LDAP3.php
@@ -2734,11 +2734,7 @@ class Net_LDAP3
      */
     private static function _string2hex($str)
     {
-        $hex = '';
-        for ($i=0; $i < strlen($str); $i++)
-            $hex .= dechex(ord($str[$i]));
-
-        return $hex;
+        return implode(unpack("H*", $str));
     }
 
     /**