Skip to content

Commit

Permalink
Book typo fix: Comments should say that the block size needs to be LE…
Browse files Browse the repository at this point in the history
…SS than the key size.
  • Loading branch information
asweigart committed May 11, 2013
1 parent 54e53cf commit f7f73c9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rsaCipher.py
Expand Up @@ -108,7 +108,7 @@ def encryptAndWriteToFile(messageFilename, keyFilename, message, blockSize=DEFAU

# Check that key size is greater than block size.
if keySize < blockSize * 8: # * 8 to convert bytes to bits
sys.exit('ERROR: Block size is %s bits and key size is %s bits. The RSA cipher requires the block size to be equal to or greater than the key size. Either decrease the block size or use different keys.' % (blockSize * 8, keySize))
sys.exit('ERROR: Block size is %s bits and key size is %s bits. The RSA cipher requires the block size to be equal to or less than the key size. Either increase the block size or use different keys.' % (blockSize * 8, keySize))


# Encrypt the message
Expand Down Expand Up @@ -143,7 +143,7 @@ def readFromFileAndDecrypt(messageFilename, keyFilename):

# Check that key size is greater than block size.
if keySize < blockSize * 8: # * 8 to convert bytes to bits
sys.exit('ERROR: Block size is %s bits and key size is %s bits. The RSA cipher requires the block size to be equal to or greater than the key size. Did you specify the correct key file and encrypted file?' % (blockSize * 8, keySize))
sys.exit('ERROR: Block size is %s bits and key size is %s bits. The RSA cipher requires the block size to be equal to or less than the key size. Did you specify the correct key file and encrypted file?' % (blockSize * 8, keySize))

# Convert the encrypted message into large int values.
encryptedBlocks = []
Expand Down

0 comments on commit f7f73c9

Please sign in to comment.