We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
bytes.find()
bytes.index()
1 parent 240b0d8 commit f254895Copy full SHA for f254895
rsa/pkcs1.py
@@ -258,10 +258,8 @@ def decrypt(crypto: bytes, priv_key: key.PrivateKey) -> bytes:
258
cleartext_marker_bad = not compare_digest(cleartext[:2], b'\x00\x02')
259
260
# Find the 00 separator between the padding and the message
261
- try:
262
- sep_idx = cleartext.index(b'\x00', 2)
263
- except ValueError:
264
- sep_idx = -1
+ sep_idx = cleartext.find(b'\x00', 2)
+
265
# sep_idx indicates the position of the `\x00` separator that separates the
266
# padding from the actual message. The padding should be at least 8 bytes
267
# long (see https://tools.ietf.org/html/rfc8017#section-7.2.2 step 3), which
0 commit comments