# Suitable Symmetric Algorithm for Encryption

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 ):

• 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?
– mat
Aug 30, 2017 at 7:47
• 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. Aug 30, 2017 at 13:00
• 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” Sep 3, 2017 at 6:46
• 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. Sep 3, 2017 at 6:46
• 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) Sep 3, 2017 at 6:46

## 2 Answers

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).

• Blocksize and key size is not the same.
– mat
Aug 30, 2017 at 7:48
• 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. Aug 30, 2017 at 11:03
• Why is this answer being down voted without comment? It's a perfectly good answer and has the appropriate caveat. +1. Aug 30, 2017 at 12:12
• @andrey Ah, OK. It is a misleading double use of 40 bits meaning once the keylength and once the "5 letters". Sorry.
– mat
Aug 30, 2017 at 12:22
• @mat: no problem. I accepted your review of the answer. Thank you. Aug 30, 2017 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.

• 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. Aug 30, 2017 at 20:25
• 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? Sep 3, 2017 at 6:48