diff --git a/module/VuFind/src/VuFind/Db/Row/User.php b/module/VuFind/src/VuFind/Db/Row/User.php
index a951bff834310883ef0ab4162f490a5ad99368d2..52d4f0588b6e34edfd821e4984030ff75bd89d86 100644
--- a/module/VuFind/src/VuFind/Db/Row/User.php
+++ b/module/VuFind/src/VuFind/Db/Row/User.php
@@ -431,9 +431,10 @@ class User extends RowGateway implements \VuFind\Db\Table\DbTableAwareInterface,
      */
     public function updateHash()
     {
-        $this->verify_hash = md5(
-            $this->username . $this->password . $this->pass_hash . rand()
-        ) . (time() % pow(10, 10));
+        $hash = md5($this->username . $this->password . $this->pass_hash . rand());
+        // Make totally sure the timestamp is exactly 10 characters:
+        $time = str_pad(substr((string) time(), 0, 10), 10, '0', STR_PAD_LEFT);
+        $this->verify_hash = $hash . $time;
         return $this->save();
     }