Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

need suggestion for dividing a file into blocks of 128 bits.  RSS feed

 
sura watthana
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

there is a school project for RSA Cryptography
here is the requirement.

1. The encryption algorithm will encrypt content of a file and write out another
file
2. The decryption algorithm will decrypt the file encrypted using the
corresponding keys and write out a file with the same content as the original
data file
3. The two prime numbers: p and q must be 64 bits long
( I have figured this out)
4. A file must be divided into blocks of 128 bits. Each block must be encrypted in its entirety at a time

my problem is how do i divide a file into blocks of 128 bits according to the requirement?

Thanks for any helpful suggestion

Sura Watthanalamlert
 
Stuart Gray
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
AFAIK there are no facilities to read files bit by bit, but you can read one byte at a time. So to get 128 bits of data, just read (128 / 8 = 16) bytes.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!