Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
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 '13 at 15:35
is it possible to build the above mentioned tools using a symmetric stream-cipher? – Auth Jan 24 '13 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 '13 at 15:54
Is there any stream-cipher (or cryptographic hash function) based on one-to-one and onto function/process? – Auth Jan 24 '13 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 '13 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.

share|improve this answer
It's important to note that constructing a hash from a block-cipher isn't possible for any block-cipher. The standard assumption of the cipher being a PRP (pseudo-random-permutation) isn't enough for a secure hash. It needs large blocks (256 bits for a 128 bit sec level) and must resist related key attacks (at least for Davies-Meyer). These mean that it's difficult to construct a hash from AES. – CodesInChaos Jan 26 '14 at 14:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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