0

i was wondering exactly how block cipher worked, i need to end up with 10 or less blocks after its done and i really haven't found anything online that can tell me how many blocks it will make and if i can limit it to 10 or less?

If you know of any resources like websites that can help me with this it would be greatly appreciated!

JimBob101
  • 173
  • 9
  • This should probably be asked over in http://crypto.stackexchange.com – Justin Pearce Mar 15 '16 at 18:26
  • 1
    RSA is not a block cipher. What does "up with 10 or less blocks" mean? What are you trying to accomplish? – zaph Mar 15 '16 at 18:28
  • I am trying to add message blocking to an rsa encryption algorithm that wrote and im completely lost on how to even starter it. – JimBob101 Mar 15 '16 at 18:29
  • block sizes of 10 or less is what i meant – JimBob101 Mar 15 '16 at 18:31
  • Why are you using RSA and not a symmetric algorithm such as AES? – zaph Mar 15 '16 at 18:34
  • its not really up to me. I was told to make it for a friend so im giving it a try – JimBob101 Mar 15 '16 at 18:37
  • Asymmetric key encryption (ex RSA) provided two keys or sizes of (generally) 512 to 4096 bits, one for encryption, one for decryption, it is the two keys that is the only real reason to use asymmetric encryption. It is very slow and the data size is limited to the key size and these attributes make it unsuitable for encryption data, it is usually used to encrypt keys and signing. Symmetric key encryption (ex AES) has one key of (generally) 128 to 256 bits for both encryption and decryption. They are fast and have no data size limitations, they are the work horse of data encryption. – zaph Mar 15 '16 at 18:46
  • Possible duplicate of [Decrypting “long” message encrypted with RSA java](http://stackoverflow.com/questions/2653591/decrypting-long-message-encrypted-with-rsa-java) – Artjom B. Mar 15 '16 at 22:37
  • Related: [what RSA max block size to encode?](http://stackoverflow.com/q/11822607/1816580) – Artjom B. Mar 15 '16 at 22:37

1 Answers1

2

A Block Cypher such as AES encrypts data a block at a time appending the block of encrypted data to the output. Block sized vary and AES uses a 16-byte block. (RSA is not a block cypher)

Since data is frequently not a multiple go the block size data is added to the end of the data, this is called padding and the most commonly used padding is PKCS#7 née PKCS#5. (As an option see CTR mode below)

Additionally there are modes such as ECB, CBC, CTR and others. ECB (Electric Code Book) is mostly a null mode in that it does nothing. CBC (Cypher Block Chaining) is a mode that includes some data from the previous block and also had an IV so that encryption the same data does not produce the same encrypted data. CTR (Counter) is a streaming mode that does not require padding but has other requirements such as a Nonce.

zaph
  • 111,848
  • 21
  • 189
  • 228