# Cryptographic Primitive Method

Is there any cryptographic primitive bijective (one-to-one and onto) function for creating cryptographic tools like symmetric encryption/decryption, Hash code generator, MAC, HMAC and Random number generator?

-
 I don't really get your question. You can build most symmetric primitives from a blockcipher with a block size of at least 256 bit that's not vulnerable to related key attacks. For example you could build all of the above from threefish. – CodesInChaos Jan 24 at 15:35 is it possible to build the above mentioned tools using a symmetric stream-cipher? – Auth Jan 24 at 15:51 A stream cipher is a rather inflexible building block. It might be possible, but it won't be pretty or efficient. Don't do that. If you want a universal building block, use a block cipher(that's what I recommend), or an unkeyed permutation like what keccak uses. There are simple ways to create stream ciphers, hashes, MACs etc. from a wide block cipher. – CodesInChaos Jan 24 at 15:54 Is there any stream-cipher (or cryptographic hash function) based on one-to-one and onto function/process? – Auth Jan 24 at 16:13 I still don't get your question, but keccak's building block is a unkeyed permutation. Permutations are bijective. Keccak can be used as a hash, MAC, stream cipher and RNG. – CodesInChaos Jan 24 at 16:15

As CodesInChaos notes, a secure block cipher satisfies all the criteria in your question:

• An $n$-bit block cipher is a (keyed family of) bijective function(s) on the set of $n$-bit bitstrings.
• A block cipher can be used for symmetric encryption in any of several modes of operation. In some of these modes (notably OFB and CTR) the block cipher effectively acts as a keystream generator for a synchronous stream cipher.
• A block cipher can be used in several ways to construct a one-way compression function, which in turn can be used to construct a cryptographic hash function. Indeed, most commonly used cryptographic hash functions are based on block ciphers.
• A hash function constructed from a block cipher can certainly be used in the HMAC construction, but there are also several ways (such as CBC-MAC, OMAC and PMAC) to construct a MAC directly from a block cipher.
• As noted above, a block cipher in CTR or OFB mode becomes a stream cipher, which is essentially the same thing as a cryptographically secure pseudorandom number generator.

Indeed, insofar as there exists a "universal building block" in modern cryptography, block ciphers are it. Pretty much the only thing they cannot do is public-key cryptography.

That said, block ciphers certainly aren't the only possible building block. For example, a cryptographic hash or pseudorandom function can be used in the Feistel / Luby–Rackoff construction to construct a block cipher, which can then be used to construct all the other things described above.

-