@@ -170,7 +170,7 @@ You can create a detached signature for a message using the
170170:py:func: `rsa.sign ` function:
171171
172172    >>> (pubkey, privkey) =  rsa.newkeys(512 ) 
173-     >>> message =  ' Go left at the blue tree'  
173+     >>> message =  ' Go left at the blue tree' .encode()  
174174    >>> signature =  rsa.sign(message, privkey, ' SHA-1'  ) 
175175
176176This hashes the message using SHA-1. Other hash methods are also
@@ -182,21 +182,21 @@ It is possible to calculate the hash and signature in separate operations
182182private key on remote server). To hash a message use the :py:func: `rsa.compute_hash `
183183function and then use the :py:func: `rsa.sign_hash ` function to sign the hash:
184184
185-     >>> message =  ' Go left at the blue tree'  
185+     >>> message =  ' Go left at the blue tree' .encode()  
186186    >>> hash  =  rsa.compute_hash(message, ' SHA-1'  )
187187    >>> signature =  rsa.sign_hash(hash , privkey, ' SHA-1'  ) 
188188
189189In order to verify the signature, use the :py:func: `rsa.verify `
190190function. This function returns True if the verification is successful:
191191
192-     >>> message =  ' Go left at the blue tree'  
192+     >>> message =  ' Go left at the blue tree' .encode()  
193193    >>> rsa.verify(message, signature, pubkey) 
194194    True 
195195
196196Modify the message, and the signature is no longer valid and a
197197:py:class: `rsa.pkcs1.VerificationError ` is thrown:
198198
199-     >>> message =  ' Go right at the blue tree'  
199+     >>> message =  ' Go right at the blue tree' .encode()  
200200    >>> rsa.verify(message, signature, pubkey) 
201201    Traceback (most recent call last): 
202202      File "<stdin>", line 1, in <module> 
0 commit comments