Skip to content

Commit 4f37ac5

Browse files
committed
Wrong copy & paste
1 parent 2415fac commit 4f37ac5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

source/Threema/MsgApi/Tools/CryptTool.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,14 @@ final public function encryptMessageText($text, $senderPrivateKey, $recipientPub
107107
$textBytes = "\x01" . $text;
108108

109109
/* determine random amount of PKCS7 padding */
110-
$padbytes = mt_rand(1, 255);
111-
112-
/* append padding */
113110
$padbytes = 0;
114111
while($padbytes < 1 || $padbytes > 255) {
115112
$padbytes = ord($this->createRandom(1));
116113
}
117114

115+
/* append padding */
116+
$textBytes .= str_repeat(chr($padbytes), $padbytes);
117+
118118
return $this->makeBox($textBytes, $nonce, $senderPrivateKey, $recipientPublicKey);
119119
}
120120

0 commit comments

Comments
 (0)