At https://stuvel.eu/python-rsa-doc/usage.html#signing-and-verification, the first example in this section states the following.
(pubkey, privkey) = rsa.newkeys(512) message = 'Go left at the blue tree' signature = rsa.sign(message, privkey, 'SHA-1')
and the second example states the following.
message = 'Go left at the blue tree' hash = rsa.compute_hash(message, 'SHA-1') signature = rsa.sign_hash(hash, privkey, 'SHA-1')
If these two are followed as-is, it would result as an AssertionError.
To solve this, we would need to add encoding
at L#2 of the first example,
(pubkey, privkey) = rsa.newkeys(512) message = 'Go left at the blue tree'.encode('utf-8') signature = rsa.sign(message, privkey, 'SHA-1')
and
at L#1 of the second example.
message = 'Go left at the blue tree'.encode('utf-8') hash = rsa.compute_hash(message, 'SHA-1') signature = rsa.sign_hash(hash, privkey, 'SHA-1')
Such kind of corrections is also needed in other examples of the same section.