Tag Info

Hot answers tagged

19

Yes, this is a widely-used cryptographic construction called a stream cipher. For more information about this and other encryption schemes, Coursera's cryptography class is a good resource.


17

It's a good question. As pg1989 said, this is the basis behind stream ciphers, which are very fast in practice. I thought I'd quickly expand upon your statement that "the one-time pad is the perfect cipher and impossible to crack." This is true, in a sense, but it's worth pointing out that sometimes an attacker wants to do something simpler than "cracking" ...


9

Security issues related to block size boil down to the following: a pseudorandom permutation is not a pseudorandom function, and the difference becomes visible when you query the function too many times. Imagine a function which accepts as inputs, and offers as outputs, elements from a set of size $N$. For instance, the inputs and outputs are blocks of $n$ ...


6

The answer is yes, non-US ciphers exist and are in fact very popular. Actually, some who are looking for alternatives, opt for non-NSA/NIST ciphers, for instance Salsa/ChaCha from DJB (who is US citizen). A lot of ciphers have been developed in EU and Japan. China definitely has developed ciphers for its own use, just like many other countries. But long ...


6

A stream cipher where you can calculate the stream at any offset without deriving the prior stream bytes is probably the simplest option. AES-CTR is a mode that uses AES like a stream cipher. To decrypt at a random spot, you need only know the offset from the beginning and you can perform a single AES encryption call. AES-CTR overview: Generate a unique ...


6

You should think of Rijndael's S-box as a function that maps bytes to bytes, where a byte (octet) is considered to be a member of a finite field of size $2^8$ (with xor as addition). It's not seen as a 16x16 octet array, really. The substitution is then just done byte-wise: every octet in the 4x4 block is replaced by its function value under the S-box ...


6

Some brief thoughts: Shared secret Generation: $$s=E_a(B)=E_b(A)$$ The shared secret is generated by encrypting the other users public key with your private key. This is effectively an ECDH step, which is very reasonable, and one of the key aims of C25519$^{[1]}$. Key Generation: $$s_0=\mathrm{SHA256}(s); s_i=\mathrm{SHA256}(s_{i-1})$$ First, using the ...


5

Any block cipher in CTR mode can be used to encrypt and decrypt data in arbitrary order. Basically, to encrypt something in CTR mode, you use the block cipher to encrypt a simple sequence of values, like (1, 2, 3, 4, 5, etc.), and concatenate the results to produce a pseudorandom bitstream, and then XOR this "keystream" with the data you want to encrypt. ...


5

Congratulations you just reinvented the stream cipher. The main strength of the one-time pad is that the key space is as large as the message space. This means that any cipher-text only attacks always fail because all plaintexts are valid. This automatically means that any construct that decreases the key space (like using a seed for a PRNG) severely ...


5

If using a cryptographically-secure random number generator then the result is a stream cipher. If using actual random numbers, then it's a one-time pad. Any output you get from a random source needs to be run through a randomness extractor anyway in a 2:1 ratio (2 bits in, 1 bit out). Don't forget to provide a MAC along with the ciphertext to prevent an ...


5

As an Iranian Cryptology student in one of the most well-known Iranian Universities called Sharif University of Technology, I want to add this to the answers. There doesn't seem to be any National Standard Cipher here in Iran. But It doesn't mean that there shouldn't be any classified cipher being used by the military or the revolutionary guards. As I am ...


5

I think this would work, although whether it's practical is another matter. For large $x$ it won't be. It's basically an application of mental-poker. First, choose a secure commutative encryption algorithm that is not vulnerable to known plaintext or chosen ciphertext attacks. Everyone generates a random encryption key. Everyone but Alice uses their key ...


4

Well, for one thing, you are not using a "One Time Pad". A "One Time Pad" means, by definition, that someone generates a pad of numbers using true randomness (and not algorithmicly), and that no potential adversary has any information on what that pad may contain. Then, that pad is given to both the sender and the receiver, and then the sender uses it to ...


4

Salsa20 has strong rotational symmetry. The main point of these constant is that they're not invariant under rotations, introducing an asymmetry. The precise value isn't very important, as long as it's sufficiently asymmetric. Bernstein - Salsa20 security says: Notes on the diagonal constants Each Salsa20 column round affects each column in the ...


4

Since this is homework, I'm not going to give the answer, but will hopefully point you in the right direction. You are correct when you say for a perfect cipher, the probability should hold that $\mathbb{P}(P=m|C=c)=\mathbb{P}(P=m)$. In words, this means that given that you see the ciphertext is $c$ what is the probability of the plaintext being $m$ (note, ...


4

From what I understand from your question, you are describing a stream cipher. If the one-time pad is the perfect cipher and impossible to crack, why would the following algorithm not be one of the strongest ... You're on the right track; a one-time pad is essentially a perfect (unbreakable) stream cipher. Without going into (any) mathematical ...


4

You are actually doing the right thing, however you do not include the "_" as part of the characterset. Assuming the alphabet consists of 27 letters (A-Z and "_"), and using the appended JavaScript script (you can simply paste it into the console), returns one sentence which actually does make sense: THE_FAILURE_MAY_BE_BOTH_DELIBERATE_AND_CLANDESTINE var ...


4

The permutations in your question are given in Cauchy's two-line notation, where the upper line gives the input index to the permutation function, and the lower line gives the resulting permuted index. For example, the definition $$\sigma = {1\ 2\ 3 \choose 3\ 1\ 2}$$ means the same as $$\sigma(1) = 3,\quad \sigma(2) = 1,\quad \sigma(3) = 2.$$ Thus, if we ...


4

I'd treat your input as one 192 bit input instead of thinking about 5 separate inputs. If you don't need security, you can always reduce the number of rounds of cryptographic primitives. If you merely need statistically random output, 20% of the usual number of rounds should be fine with many hashes. A few suggestions: SipHash has good performance for ...


3

If the plaintext format is indeed as you describe, then you're out of luck: the insertion of the newlines and the consequent shifting of the plaintext records is enough to disrupt any structure in the ciphertext. If the plaintext were longer, say, 8 records, then it could work, but with just 7 records there's no way to switch the first and last record ...


3

$ROT(n)$ can be thought of as a character based stream cipher. It works because addition - the encryption method used - is commutative, i.e. $ROT(x, ROT(y, m)) = ROT(y, ROT(x, m))$. Another well known commutative function is $XOR$. It is used by the one time pad, but - more practically - also for block ciphers in streaming mode. So you can encrypt using AES ...


3

Permutation A “P-box” is a permutation of all the bits, meaning: it takes the outputs of all the S-boxes of one round, permutes the bits, and then feeds them into the S-boxes of the next round. A good P-box has the property that the output bits of any S-box are distributed to as many S-box inputs as possible. Substitution An “S-box” is usually not ...


3

Here is your algorithm in formula form, which might be easier to understand for non-objective-C-experts: Encryption: $P_1 || P_2 || \dots || P_n := P$ (split plaintext in blocks, same size as hash output, except the last one) $K := SHA256(key)$ $O_0 := IV (= K)$ $O_i := HMAC_{SHA256}(K, O_{i-1})$ for all $i \in \{ 1, \dots, n\}$ (key stream) $C_i := P_i ...


3

This is indeed a good question; let me try to make it a bit more precise. Suppose: Alice has a plaintext message of some number of bits, call it p. Alice and Bob share a crypto-strength random number generator that generates n truly random bits. Alice and Bob share a pseudo-random number generator that can take a seed of size n and produce one of 2n ...


3

standard AES disclaimer: Given the questions you've asked, you should not implement AES yourself in a real-world system because there are lots of security considerations when implementing ciphers. Think of the S-box as a function from byte $ \to $ byte. So, to look up the image of $x$ under the s-box transformation, you simply use $S_\text{box}(x)$, which ...


3

Item 2 has been answered satisfactorily, so this will focus on point 1: the s-box. The size of the s-box is not a 16x16 array unless it is viewed as such. The s-box is actually an 8-bit non linear transformation of the input, and is only viewed as a 16x16 array if you arrange it as a table of such dimensions. This array would then be a 1 to 1 representation ...


3

What is the significance of the repetition? Does it mean that a 6 character key was used and repeated across the same characters within $P_1$ and $P_2$? I'm assuming your assumption about this being an xor cipher with the pad used twice for two ciphertexts. It does not mean a 6 character key was used. A one time pad used twice could result in this ...


3

Here is a quick idea that came to mind: $n$ be the number of participants. Let $p := 0.5 / n$. Have every participant choose a number not equal to his own, and announce it publicly. After all the numbers were announced, each participant answers with no, if one of the announced numbers match their private one or if a random Bernoulli experiment with sucess ...


3

What you're looking for is that zero knowledge proof, that some public number is not equal to a couple of secret numbers. It is possible to prove that two numbers are not equal, but it is not that easy to do so, and it is mostly theoretic work. Let's consider two integers $a$ and $b$ for simplicity and prove their inequality: Consider the numbers in their ...


2

It'll be the same situation that NY City suffered some days ago: when you have little variability on your data, i.e., they have a fixed-small size, it'll always be fast to brute force. You don't say how long your number is, so I'll assume it can range from 0 - 10,000,000,000 (so, a unique number for each human being on Earth today, plus some spare). You ...



Only top voted, non community-wiki answers of a minimum length are eligible