# What operations are used in symmetric cryptography and why?

In continuation to Why are bitwise rotations used in cryptography?: what other operations are commonly used in symmetric cryptography? Are there particular operations on numbers that are good for building ciphers? Do common ciphers tend to use the same basic building blocks?

Some similar questions:

which else operations are used in cryptography and why?

This question is hopelessly broad, but I'll give the "which" a shot. Ignoring asymmetric constructions like RSA, cryptographic primitives typically stick with operations that are either a single instruction in common architectures or can be implemented cheaply with a combination of a few instructions. Thus, bit rotations, arithmetic addition, logical bitwise operations like AND, OR, and XOR, and so on, are all good candidates for operations. Table lookups are also quite common to speed up implementations.

It's not really the operations themselves that are so important, however. The way you combine them is (obviously) far more important, and hence unless you have a specific question about why a specific operation has so much use, it's not really all that relevant to ask "what operations are used". Instead, study things like how the Merkle–Damgård construction can be used to build a hash function, how a substitution-permutation network can be used to build a block cipher, how HMAC can transform a relatively weak hash function into a good MAC. If you would like more examples, I can provide them.

These are the important building-blocks of primitives, not necessarily the operations underlying them. The operations are obviously important, but don't miss the forest for the trees.

On the other hand, you have the mathematical schemes, for lack of a better term. These use mathematics to achieve some goal, and hence the "operations" in them are virtually limitless. RSA and Diffie-Hellman both use modular exponentation, though in different ways; Shamir's secret sharing scheme relies on the idea that a $n$-degree polynomial can be uniquely identified with $n+1$ points, and so uses polynomial evaluation in a finite field as well as Lagrangian interpolation; the Merkle-Hellman knapsack cryptosystem relies on the subset-sum problem; and it just goes on and on.

There are zero-knowledge proofs, secure multiparty computation schemes, cryptographic voting schemes, fully-homomorphic encryption schemes, functional encryption schemes, identity-based schemes, ... the bounds are limitless. Trying to exhaustively list the operations used here is futile.

My point is that cryptography is a vast field. There are operations aplenty, but far more interesting are the schemes themselves. The operations are just means to an end.

What is the difference between addition modulo 2 (xor) and addition modulo 2 ^ register size (addition with overflow)?

XOR is not just "addition modulo 2"; it's bitwise addition modulo 2, and I dislike this definition. The point of bitwise exclusive-or is that the output of each bit is 1 if and only if the two input bits are different. Hence, it is an exclusive-or: exclusively, one of the bits may be turned on. If both are on, or both are off, the output is 0. This property makes XOR an involution, i.e. a function that is its own inverse. Bitwise-AND and bitwise-OR are not invertible.

Addition modulo 2^{register size} is just what it says on the tin: the addition can overflow or underflow.

• Comments are not for extended discussion; this conversation has been moved to chat. – e-sushi Feb 21 '16 at 17:31

what other operations are commonly used in symmetric cryptography?

every secure cryptosystem should have two features: diffusion and confusion, in symmetric cryptosystems (block cipher) for diffusion should use Permutation and for confusion should use Substitution box(S-Box) and almost all symmetric cryptosystems(block and stream) use XOR also Iterated rounds are necessary for providing diffusion and confusion, in stream cipher shift registers are very common,but in asymmetric cryptography like RSA,we need a hard problem and number theory has hard problems like Factoring or DLP,so we use number theory and numbers for designing our asymmetric cryptosystems