# Are cryptographies based on bitwise operations considered secure?

I have recently been reading (and writing) a lot off ECC on top of TCP via pythons sockets. I've stubbled across a couple of things mentioning how elliptical curves are more secure with the same key length as other algorithms. Just to humor myself I made a simple associate/communicative function and used it to with a 'base point' and played around making some public, private, and shared keys. The operation I was using is as follows:

"(x, y) => x | y"

I based my process around having a base point as a domain parameter (call it 'g') and creating a private key 'd' with its public key partner 'dg' (found by plugging d and g into the function above). Then one can encrypt by picking a new private key 'n' and using 'ndg' or 'dng' as the shared secret. Just slap 'ng' at the front of the message and the decrypter can go ahead and use their secret key to go from 'ng' to 'dng' which can be used as a shared secret for something like Rabbit. All these public and private keys can just be integers of some length.

What is insecure in this system?

• (x^y)^(x&y) is just |
– Marc
Dec 17 '17 at 15:39

## 2 Answers

If I understood correctly (using uppercase notation for public keys and $\lor$ instead of "|" to indicate the logical or) your scheme is:

• Public Domain $g \in \mathbb{Z}$
• Alice Private Key $a \in \mathbb{Z}$
• Alice Public Key $A=a \lor g$
• Bob Private Key $b \in \mathbb{Z}$
• Bob Public Key $B=b \lor g$

Shared Secret = $a \lor B = b \lor A = a \lor b \lor g$

Then I would say your system is insecure as an attacker can recover the shared secret using only the public keys as:

Shared Secret = $A \lor B = (a \lor g) \lor (b \lor g) = a \lor b \lor g$ (Given the property that $x \lor x = x$)

Bitwise operations work on the same principles as 2 way encryption (encryption that can be broken if you know the decryption procedure). The decryption key can be found by trying several iterations of these bitwise operations until the cracker can find dictionary words in a decrypted part of the communication.

So to conclude a bitwise encryption is insecure.

• What is "2 way encryption"? Isn't all symmetric encryption 2 way? You can't break it just by knowing the procedure. Dec 18 '17 at 1:10
• you can in many cases f.e base64 or Caesar's cipher. Bitwise encryption works in a similar way.
– AXANO
Dec 18 '17 at 15:26
• But that's not derivative of "Two way encryption", that's derivative of specific ciphers within the entire suite of "Two way encryption". I believe it's only true for keyless encryption schemes. Vigenere and OTP encryption is two way, but knowing that someone used a OTP scheme to encrypt something is more likely to make me consider it cryptographically impenetrable, rather than easily reversed. Dec 18 '17 at 15:51
• under bitwise operations i understand XOR AND NAND OR and the shifts. I may have understood it the wrong way.
– AXANO
Dec 18 '17 at 16:09
• Those are indeed bitwise operations, but "bitwise encryption" is not necessarily insecure. For example, a one-time pad which, while incredibly difficult to correctly use, can be extremely secure, is basically just x&y.
– A. Darwin
Dec 19 '17 at 21:46