Tell me more ×
Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It's 100% free, no registration required.

What I want to know is, Is there a stream cipher with two modes Mode-1 (encrypt/decrypt) and Mode-2 (decrypt/encrypt)

i.e. it should be possible to encrypt and decrypt using Mode-1 and Mode-2 respectively and also it should be possible to encrypt and decrypt using Mode-2 and Mode-1 respectively.

Is it possible? if so let me know such stream cipher?

share|improve this question
This is still not a coherent question. – CodesInChaos Jan 24 at 17:07
Assume if there is such a stream cipher, i.e. two outputs from two modes (Mode-1 and Mode-2) for the same Plain-Text and Key (password) is entirely different and each output is reversible using the same password and Mode-2 and Mode-1 respectively. What does it mean/imply? – Auth Jan 24 at 17:29
It means that if done well you have to independant stream ciphers – Alexandre Yamajako Jan 24 at 17:50
Is there any significance to naming encryption/decryption in different order for your modes? And what do you want out of those modes? Do you just want two independent stream ciphers? That's easily achieved using a KDF, no matter which stream cipher you use. – CodesInChaos Jan 24 at 17:58
If it is two independent stream ciphers then reversal from cipher-text-1 and cipher-text-2 to Plain-text may be difficult or not possible. Is it POSSIBLE mathematically to have SINGLE stream cipher with the above mentioned behaviour (super-symmetry)? i.e. Encryption: Mode-1: F(x, k) = y1; Mode-2: F-1(x, k) = y2; Decryption: Mode-2: F-1(y1, k) = x; Mode-1: F(y2, k) = x; where F is Mode-1; F-1 is Mode-2; x is plain-text; k is password/key; and y1 and y2 are two entirely different outputs. – Auth Jan 24 at 19:06
show 1 more comment

closed as not a real question by CodesInChaos, Ilmari Karonen, Thomas, B-Con, Maeher Feb 10 at 10:53

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, see the FAQ.

1 Answer

Let a plaintext digit of n bits (n >= 1) be denoted by x and encryption/decryption in Mode 1 and Mode 2 be denoted by f1(x)/g1(x) and f2(x)/g2(x) respectively, i.e. g1(f1(x)) = g2(f2(x)) = x mod 2^n. From the symmetry between a function and its inverse, one has g1(f1(x)) = f2(g2(x)) = x mod 2^n. This is certainly fulfilled, if the system behaves in such a way that f1(x) = g2(x) and consequently f2(x) = g1(x). In case n = 1 one would have f1(x) = f2(x), which you said you don't want, but for n > 1 one can have f1(x) != f2(x) in general. Thus a permutation polynomial mod 2^n (n > 1) will qualify for the function f1(x) you are looking for. (For an implementation of such polynomials see my code JADE in http://s13.zetaboards.com/Crypto/)

share|improve this answer
What I need is a Single Cipher Method/process with two modes (F and F-1) and it should satisfy the following criteria: F-1(F(x, k), k) = F(F-1(x, k), k) = x; – Auth Jan 24 at 20:07
You obtain from the system at each step of your work, i.e. for the processing of an individual x, one function f1() (and hence also g1(), f2() and g2() as I said). The generation of that function f1(), and hence also the other 3 functions, is "dependent" on a single key that the user provides for running a certain algorithm in my code. Doesn't that fully satisfy your requirement? – Mok-Kong Shen Jan 24 at 20:18
[Addendum] The equation you just gave doesn't correspond to your OP. You should clearly distinguish between encryption and decryption in Mode 1 and encryption and decryption in Mode 2, as I have done. (BTW, a constant k is implicit in my description.) – Mok-Kong Shen Jan 24 at 20:32
It doesn't satisfy because my requirement is ONLY two functions using single key. – Auth Jan 24 at 20:34
I have (at each processing step) in fact only "one" function, namely f1()! The other 3 functions are automatically defined for a given f1(). g1() is the inverse of f1(), f2() is the same as g1(), g2() is the same as f1(). Do you see that? – Mok-Kong Shen Jan 24 at 20:39
show 8 more comments

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