Please, I would like to encrypt word not more than 5 letters such as (GO, HI, APPLE, EYES) and my key length just (40 bits only), please I am looking for a suitable symmetric algorithm that it can be lightweight, fast as well as less processing required so it can suit my mechanism?

Please any suggestion and sorry for my weak English ):

  • 1
    $\begingroup$ Please specify, what you mean by "lightweight". What processor is it going to run on? How much RAM and code space does your target device have? Why must the key be not longer than 40 bits? $\endgroup$ – mat Aug 30 '17 at 7:47
  • 1
    $\begingroup$ Can the ciphertext be longer than 5 bytes? And does the ciphertext have to be printable text, or are arbitrary bytes okay? Also, never ever use 40 bit keys. 80 is the bare minimum, 128 are strongly recommended. $\endgroup$ – CodesInChaos Aug 30 '17 at 13:00
  • $\begingroup$ Well, let’s suppose we have a room filled up with persons (each person should has unique name) so when there is a new person wanna enter to this room, he should ask all the persons in this room (hey guys I will name myself “Jone” anyone has the same name? so if there is a person his name is “Jone” he will raise up his hand. But, in this case may that guy is lair and his name is not “Jone” $\endgroup$ – Al-Ani Sep 3 '17 at 6:46
  • $\begingroup$ so what I want to do is to make sure his name is “Jone”, I will pick up a random word within 5 letters (I chose 5 letters so it can be easy to encrypt and decrypt) and encrypt this word, then send this encrypted word to all the persons in this room and ask them if ur name is same my name u will be able to decrypt the word through using your name (since the word encrypted by “Jone” as a key) and tell me the word. $\endgroup$ – Al-Ani Sep 3 '17 at 6:46
  • $\begingroup$ In this case if his name is really “Jone” he will be able to decrypt the word and send back the word, while if his name is different he is not gonna be able to decrypt the word since the “name” “key” is different (: (this is just an example to clear my idea, I hope u guys get it) $\endgroup$ – Al-Ani Sep 3 '17 at 6:46

Is there any particular reason to use a key length of just 40 bits? Because it is vulnerable to brute-force attacks. To have a reasonable strength, the minimum reasonable key length nowadays is 128 bit (source).

If you don't care about this stuff, you may use one of the following: DES-40, RC2, RC5, Blowfish. These ciphers support a key length of 40 bits, as you require. Anyway, any of these ciphers always has block size different from 5 bytes, which you are probably interested into. I'm not aware of any cipher with a block size of 5-byte/40-bit. The alternative would be to use a stream cipher that supports a key length of 40 bits, such as RC4 (you can find many more here).

  • $\begingroup$ Blocksize and key size is not the same. $\endgroup$ – mat Aug 30 '17 at 7:48
  • $\begingroup$ I didn't say they are the same. I pointed out that the above ciphers support a key length of 40 bit but NOT a block size of 40 bit. Since the question wants to encrypt not more than 5 letters, I think it would be useful if also the block size is 40 bits. If he doesn't care about the block size, he may use those ciphers. $\endgroup$ – gentooise Aug 30 '17 at 11:03
  • $\begingroup$ Why is this answer being down voted without comment? It's a perfectly good answer and has the appropriate caveat. +1. $\endgroup$ – Paul Uszak Aug 30 '17 at 12:12
  • $\begingroup$ @andrey Ah, OK. It is a misleading double use of 40 bits meaning once the keylength and once the "5 letters". Sorry. $\endgroup$ – mat Aug 30 '17 at 12:22
  • $\begingroup$ @mat: no problem. I accepted your review of the answer. Thank you. $\endgroup$ – gentooise Aug 30 '17 at 14:21

You have the following requirements:

  • A $40$ bit key
  • considerably fast / lightweight / low processing time

With these requiements it is impossible to find anything, which is also secure. Basically, your own requirements make sure, that it's really easy to brute force - probably on a single computer already.

  • 1
    $\begingroup$ The question mentions "word not more than 5 letters". If the text is ASCII then that is 8 x 5 = 40 bits. This can be secure if a new random 40 bit key is picked for every word. That would make it an OTP, with the plaintext as long as the key. An OTP is computationally very simple and very secure. Of course, that brings in all the key generation and key handling problems of an OTP. $\endgroup$ – rossum Aug 30 '17 at 20:25
  • $\begingroup$ Hi, I really appreciate your help, please read the above comment just now I wrote it to clear my idea more, any question please ask me? $\endgroup$ – Al-Ani Sep 3 '17 at 6:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.