instruction
stringlengths
15
30k
The meet-in-the-middle attack on ciphers like $C=E^2_K(P)=E_{K1}(E_{K2}(P))$ works as follows. Let's assume you're given a known-plaintext pair $(P_1,C_1)$ and a known-plaintext pair $(P_2,C_2)$<br> You now build a list (by brute-force) containing the pairs $(I,K1)$ for every possible value of $K1$ ($2^{56}$ for DE...
The meet-in-the-middle attack on ciphers like $C=E^2_K(P)=E_{K1}(E_{K2}(P))$ works as follows. Let's assume you're given a known-plaintext pair $(P_1,C_1)$ and a known-plaintext pair $(P_2,C_2)$<br> You now build a list (by brute-force) containing the pairs $(I,K1)$ for every possible value of $K1$ ($2^{56}$ for DE...
I am considering attacks on Two-Key Triple-DES Encryption assuming $2^{32}$ known plaintext/ciphertext pairs (that's a mere 32 Giga Bytes of ciphertext) by the method devised by [Paul C. van Oorschot and Michael J. Wiener][1], or another published method not requiring significantly more DES computations. As a synthe...
I would be very grateful for any help. I cant figure out why (probabilistic) public key encryption schemes can never provide perfect secrecy? Any Ideas?
Why cant Public Key Encryption be perfectly secure?
I would be very grateful for any help. I cant figure out why (probabilistic) public key encryption schemes can never provide perfect secrecy? Any Ideas? **Excerpt:** *In contrast to the private-key setting, perfectly-secret public-key encryption does not exist. (We stress that this holds regardless of how long the ...
I would be very grateful for any help. I cant figure out why (probabilistic) public key encryption schemes can never provide perfect secrecy? Any Ideas? **Excerpt:** *In contrast to the private-key setting, perfectly-secret public-key encryption does not exist. (We stress that this holds regardless of how long the ...
I am trying to create a secure Bluetooth Low Energy connection. The peripheral server (the main device other people would connect to) would need to service many clients (users) and due to hardware limitations, I would not be able to let the hardware manage security (essentially, it has a limit of 4 keys, i.e., 4 users)...
I have read many pages about encryption but I am really stuck on this. For access control to a building I want to print a 10 character ASCII code on a ticket (as a barcode). The barcode reader (controlled by an Arduino or mini PC) is not connected to the PC which creates and prints the barcodes. When both serve...
First, some notes on your choices of primitives: - AES-256: You don't need to use AES-256 unless the data you want to protect needs to remain confidential for more than 30 years - SHA-256 for authentication. Don't use plain SHA-256. Either use HMAC-SHA-256 using an encrypt-then-authenticate approach or (even bett...
I am trying to create a secure Bluetooth Low Energy connection. The peripheral server (the main device other people would connect to) would need to service many clients (users) and due to hardware limitations, I would not be able to let the hardware manage security (essentially, it has a limit of 4 keys, i.e., 4 users)...
Apologies for the obviously ridiculous question but I need to know where I'm going wrong here. For RSA, we compute $n=pq$ for primes $p$ and $q$. We then choose an $e$ such that $gcd(e, \psi(n))=1$ and compute $d$ such that $ed = 1 \mod \psi(n)$. The public key is $(n, e)$ and private key is $(\psi(n), d)$. I see ho...
Why doesn't this defeat RSA?
Apologies for the obviously ridiculous question but I need to know where I'm going wrong here. For RSA, we compute $n=pq$ for primes $p$ and $q$. We then choose an $e$ such that $gcd(e, \psi(n))=1$ and compute $d$ such that $ed = 1 \mod \psi(n)$. The public key is $(n, e)$ and private key is $(\psi(n), d)$. I see ho...
I have such problem: party $X$ has an amount of money $M$, which it needs to share with $n$ other parties. Every week the amount of money is different. Let say not, that I am a party A, which is one of those $n$ parties which are waiting for their money from $X$. Do you maybe know any protocol or commitment schema, w...
Apologies for the obviously ridiculous question but I need to know where I'm going wrong here. For RSA, we compute $n=pq$ for primes $p$ and $q$. We then choose an $e$ such that $gcd(e, \varphi(n))=1$ and compute $d$ such that $ed = 1 \mod \varphi(n)$. The public key is $(n, e)$ and private key is $(\varphi(n), d)$....
How can I apply the Meet-in-the-Middle attack to the 3DES algorithm, and why does the literature say that 3DES is more secure than DES?
According to rfc documents http://tools.ietf.org/html/rfc2412#appendix-E.2 & http://tools.ietf.org/html/rfc3526#section-3, it has defined the `prime` and the `generator`, but have no recommended length of param random number `x`. What is recommended length of random number `x`? In my case, I set length of `x` is 160...
I have elliptic curve of equation `y^2 = x^3 - x`. And the coordinate of points **Q** and **P**. I want to solve **Q=k*P** (where k is the unknown) by testing all possible k. Is this the right approach to solve this problem?
I am considering attacks on Two-Key Triple-DES Encryption assuming $2^{32}$ known plaintext/ciphertext pairs (that's a mere 32 Giga Bytes of ciphertext) by the method devised by [Paul C. van Oorschot and Michael J. Wiener][1], or another published method not requiring significantly more DES computations. As a synthe...
The [original article][1] rightfully neglects the cost of DES computations (there are less than $2^{90}$) and everything except memory accesses to its _Table 1_ and _Table 2_. I go one step further: considering that _Table 1_ is initialized only once and then read-only, it could be in ROM, and I neglect all except the ...
The [original article][1] rightfully neglects the cost of DES computations (there are less than $2^{90}$) and everything except memory accesses to its _Table 1_ and _Table 2_. I go one step further: considering that _Table 1_ is initialized only once and then read-only, it could be in ROM, and I neglect all except the ...
I've been playing around with the Matasano crypto challenges (cryptopals.com). I had a couple false-starts on the challenge that has you creating a program to calculate the key size of a XOR encrypted file using Hamming Distance of the bits (Index of Coincidence). After some head banging and pen and paper work on graph...
I have such problem: party $X$ has an amount of money $M$, which it needs to share with $n$ other parties. Every week the amount of money is different. Let say not, that I am a party A, which is one of those $n$ parties which are waiting for their money from $X$. Do you maybe know any protocol or commitment schema, w...
The specifications for RSA state: $P^{\phi(N)} \equiv 1 ~mod~N$ if and only if $P$ and $N$ are coprime. Here $P$ is the plaintext and $N$ is the product of two suitable primes $x_1, x_2$. My question is how do we guarantee that $P$, the plaintext will be coprime to $N$? Thank you in advance!
How do we guarantee plaintext is coprime in RSA?
If you can efficiently find a $P$ that is not coprime to $N$, then you can easily factor $N$ (use GCD). If you know the factorization of $N$ (say $N=pq$), you can easily find a $P$ that is not coprime to $N$ ($kp$ for some constant $k$). This established the fact that finding $P$ not coprime to $N$ and factoring are...
If you can efficiently find a $P$ that is not coprime to $N$, then you can easily factor $N$ (use GCD). If you know the factorization of $N$ (say $N=pq$), you can easily find a $P$ that is not coprime to $N$ ($kp$ for some constant $k$). This established the fact that finding $P$ not coprime to $N$ and factoring are...
I'd like forward secrecy in a case where the two sides have a shared long-term symmetric key. I intend to use AES in GCM. It looks like ephemeral Diffie-Hellman is the best way to generate the session keys. My question is, is it sufficient to just encrypt the key exchange using the long-term key, or should that be also...
Your scheme is not a good approach -- it is not safe. Your scheme is vulnerable to rollback attacks. Ideally, the security property we'd like is that this will select the best (highest) version that both client and server support. However, that security property is not achieved. A man-in-the-middle can force bo...
I have read many pages about encryption but I am really stuck on this. For access control to a building I want to print a 10 character ASCII code on a ticket (as a barcode). The barcode reader (controlled by an Arduino or mini PC) is not connected to the PC which creates and prints the barcodes. When both serve...
There were fifteen candidates in the AES selection and I suppose that Rijndael wasn't the single good algorithm. I know that Camellia is an evolution of E2 candidate and can be used as symetric cryptographic routines in TLS. Which others ex-candidates have today a "serious" implementation and a real usage ?
I have a short message that’s exactly 128 bits of length. The message serves as a time-limited authorization token for a database. It contains a permission profile ID (64 bits) and an issue timestamp (64 bit double). The key is known only to the issuing server, but the content may actually be given to the user in plain...
Authenticate a short message with redundant encryption instead of using a MAC?
I have a short message that’s exactly 128 bits of length. The message serves as a time-limited authorization token for a database. It contains a permission profile ID (64 bits) and an issue timestamp (64 bit double). The key is known only to the issuing server, but the content may actually be given to the user in plain...
In polyalphabetic substitution cipher, if we have a key $k$ (a string of letters) of length $n$ does the plaintext $m$ (also a string of letters) have to satisfy $|m| \geq n$?
In polyalphabetic substitution cipher, if we have a key $k$ (a string of letters) of length $n$ does the plaintext $m$ (also a string of letters) have to satisfy $|m| \geq n$? Also, side question, do we have to include a requirement that at least one letter in the key is different from the others? Because otherwise...
I have a short message that’s exactly 128 bits of length. The message serves as a time-limited authorization token for a database. It contains a permission profile ID (64 bits) and an issue timestamp (64 bit double). The key is known only to the issuing server, but the content may actually be given to the user in plain...
Is $\frac{1}{n!}$ a negligible function where $n$ is a security parameter? Application: I have a vector of n>100 elements. I permute it and give it to an adversary. The adversary can break it if it can find the original oder of vector. Its probability to succeed is: $\frac{1}{n!}$. Thus, I need to know whether this ...
See http://TrueTimeStamp.org - Free. - Easy to manually time stamp files or a file's SHA256 hash. - Easy API for automated time-stamping by calling - http://truetimestamp.org/submit.php?hash=YOUR_SHA256_IN_HEXADECIMAL_HERE - Easy verification of time-stamps on the website by supplying the file or its hash. -...
Practical Uses for Timing Attacks on Hash Comparisons (e.g. MD5)?
I want to encrypt data that is stored on the harddisk using a user-entered password. For this I look into the [sodium docs](http://doc.libsodium.org/) and all I can find for symmetric encrypten is [authenticated encryption](http://doc.libsodium.org/secret-key_cryptography/authenticated_encryption.html). This method ...
I dont want to ask for help without showing how far I came by myself, so this is what I have so far: The file of interest is an encrypted/obfuscated .bin script, which cotains information on certain weaponstats eg. damage or accuracy. It is part of an older computergame. The raw file containts **only hexvalues**, wh...
I dont want to ask for help without showing how far I came by myself, so this is what I have so far: The file of interest is an encrypted/obfuscated .bin script, which cotains information on certain weaponstats eg. damage or accuracy. It is part of an older computergame. The raw file containts **only hexvalues**, wh...
Suppose we have some one-way function $h$. Without further specification of $h$, how can we be sure that we can define another function $g(n) = h(h(n))$? That is, how do we know the range of $h$ is a subset of the domain of $h$?
How do we know one-way functions can be recursively called?
Suppose we have some one-way function $h$. Without further specification of $h$, how can we be sure that we can define another function $g(n) = h(h(n))$? That is, how do we know the range of $h$ is a subset of the domain of $h$? **Relevance to Cryptography**: One-way functions are *minimal assumptions* for the co...
I have read many pages about encryption but I am really stuck on this. For access control to a building I want to print a 10 character ASCII code on a ticket (as a barcode). The barcode reader (controlled by an Arduino or mini PC) is not connected to the PC which creates and prints the barcodes. When both serve...
I have a short message that’s exactly 128 bits of length. The message serves as a time-limited authorization token for a database. It contains a permission profile ID (64 bits) and an issue timestamp (64 bit double). The key is known only to the issuing server, but the content may actually be given to the user in plain...
I have a short message that’s exactly 128 bits of length. The message serves as a time-limited authorization token for a database. It contains a permission profile ID (64 bits) and an issue timestamp (64 bit double). The key is known only to the issuing server, but the content may actually be given to the user in plain...
I have a short message that’s exactly 128 bits of length. The message serves as a time-limited authorization token for a database. It contains a permission profile ID (64 bits) and an issue timestamp (64 bit double). The key is known only to the issuing server, but the content may actually be given to the user in plain...
I have a short message that’s exactly 128 bits of length. The message serves as a time-limited authorization token for a database. It contains a permission profile ID (64 bits) and an issue timestamp (64 bit double). The key is known only to the issuing server, but the content may actually be given to the user in plain...
I have a short message that’s exactly 128 bits of length. The message serves as a time-limited authorization token for a database. It contains a permission profile ID (64 bits) and an issue timestamp (64 bit double). The key is known only to the issuing server, but the content may actually be given to the user in plain...
I have read many pages about encryption but I am really stuck on this. For access control to a building I want to print a 10 character ASCII code on a ticket (as a barcode). The barcode reader (controlled by an Arduino or mini PC) is not connected to the PC which creates and prints the barcodes. When both serve...
I have elliptic curve of equation `y^2 = x^3 - x`. And the coordinate of points **Q** and **P**. I want to solve **Q=k*P** (where k is the unknown) by testing all possible k. Is this the right approach to solve this problem? Edit ---- I understand from comments that this is known as **Discrete algorithm problem...
I have elliptic curve of equation `y^2 = x^3 - x`. And the coordinate of points **Q** and **P**. I want to solve **Q=k*P** (where k is the unknown) by testing all possible k. Is this the right approach to solve this problem? Edit ---- I understand from comments that this is known as **Discrete algorithm problem...
Let $F : \{0,1\}^n \times \{0,1\}^n \rightarrow \{0,1\}^n $ be a PRF. And let the encryption function be $Enc{_k}(m) = r || (F{_k}(m) \bigoplus r \bigoplus 0^n)$ , where r's value is random. Is this system CCA secure? I am having trouble deciding this. Since r's length is m(otherwise I wouldn't be able to XOR it wit...
CCA secure or not?
I have elliptic curve of equation `y^2 = x^3 - x`. And the coordinate of points **Q** and **P**. I want to solve **Q=k*P** (where k is the unknown) by testing all possible k. Is this the right approach to solve this problem? Edit ---- I understand from comments that this is known as **Discrete logarithm problem...
I have elliptic curve of equation `y^2 = x^3 - x`. And the coordinate of points **Q** and **P**. I want to solve **Q=k*P** (where k is the unknown) by testing all possible k. Is this the right approach to solve this problem? Edit ---- I understand from comments that this is known as **Discrete logarithm problem...
I have elliptic curve of equation `y^2 = x^3 - x`. And the coordinate of points **Q** and **P**. I want to solve **Q=k*P** (where k is the unknown) by testing all possible k. Is this the right approach to solve this problem? Edit ---- I understand from comments that this is known as **Discrete logarithm problem...
I have elliptic curve of equation $y^2 \equiv x^3 -x \pmod p$, with $p$ as a 71-bit prime. And the coordinate of points $Q$ and $P$. I want to solve $Q=[k]P$ (where $k$ is the unknown) by testing all possible $k$. Is this the right approach to solve this problem? Edit ---- I understand from comments that this i...
I have elliptic curve of equation $y^2 \equiv x^3 -x \pmod p$, with $p$ as a 71-bit prime. And the coordinate of points $Q$ and $P$. I want to solve $Q=[k]P$ (where $k$ is the unknown) by testing all possible $k$. Is this the right approach to solve this problem? Edit ---- I understand from comments that this i...
I've been searching around the web for best practice how-to on secure password reset system (email with reset url), and the idea to hash the token in the database, which I did not implement at first, seems to be the the most secure way to store the token. Im currently following [this][1] guide, and he does not menti...
How do I verify a reset token if the token is hashed in DB?
If we're considering Chosen-Plaintext Attack setting, then the adversary has access to the Encryption Oracle right, and we know that OTP is only considered secure if we use the key only once. How would we ensure that the adversary uses the key only once? Or would it not matter how the adversary uses the encryption o...
Is One Time Pad considered Chosen-Plaintext Attack Secure?
A nonce ensures that the same plaintext will always be mapped to different ciphertexts using the same key. Schemes requiring a nonce should **always** get a nonce, even for file-encryption you can't guarantee that your users won't encrypt the very same file twice, for reasons only known to them. Now to answer your q...
The [HMAC Construction](https://en.wikipedia.org/wiki/Hash-based_message_authentication_code#Design_principles) is defined as: Hash( (Key XOR opad) || Hash((Key XOR ipad) || Message) ) This was designed because a simpler construction such as: Hash(Key || Message) Is vulnerable to a [length extension...
Is the HMAC construction really neccessary for a fixed length message?
The meet-in-the-middle attack on ciphers like $C=E^2_K(P)=E_{K1}(E_{K2}(P))$ works as follows. Let's assume you're given a known-plaintext pair $(P_1,C_1)$ and a known-plaintext pair $(P_2,C_2)$<br> You now build a list (by brute-force) containing the pairs $(I,K1)$ for every possible value of $K1$ ($2^{56}$ for DE...
**How do I safely encrypt a file?** or formulated differentely: **How do I safely store the data of my application in a file?**
How to securely store data? / How to securely encrypt a file?
1. Ask yourself **if you even can** securely store the user's data.<br> This includes to check that the user won't get sniffed by the root / admin user.<br>Also make sure that your implementation is secure.<br>Employ standard code review mechanisms, make sure that your implementation has countermeasures against...
Let (S,V) be a secure MAC defined over $(K,M,T)$ where $M = {0,1}^n$ and $T ={0,1}^{128}$. Which of the following is a secure MAC: 1. $S'(k,m) = S(k,m)[0,\ldots,126]\quad and \quad V'(k,m,t) = \big[V(k,\ m,\ t\big\|0) \ \text{ or }\ V(k,\ m,\ t\big\|1)\ \big] $ 2. $S'(k,m) = S(k,m)\quad and \quad V'(k,m,t) ...
Which of these is a secure MAC?
Let $H: M \to T\ $ be a collision resistant hash function. Which of the following is collision resistant: $ 1.H'(m) = H(m \big\| m)$ $2.H'(m) = H(m) \big\| H(0)$ $3.H'(m) = H(m) \oplus H(m)$ $4.H'(m) = H(H(m))$ $5.H'(m) = H(0)$ $6.H'(m) = H(|m|)$ $7.H'(m) = H(m)[0,\ldots,31] $ (i.e. output the firs...
Which of the following hash functions is collision resistant?
Let (S,V) be a secure MAC defined over $(K,M,T)$ where $M = \{0,1\}^n$ and $T =\{0,1\}^{128}$. Which of the following is a secure MAC: 1. $S'(k,m) = S(k,m)[0,\ldots,126]\quad and \quad V'(k,m,t) = \big[V(k,\ m,\ t\big\|0) \ \text{ or }\ V(k,\ m,\ t\big\|1)\ \big] $ 2. $S'(k,m) = S(k,m)\quad and \quad V'(k,m...
Let F be a block cipher with 128-bit block length. Consider the following encryption scheme for 256-bit messages: to encrypt message M=m1∥m2 using key k (where |m1|=|m2|=128), choose random 128-bit r and compute the ciphertext r∥Fk(r)⊕m1∥Fk(m1)⊕m2. Is there any strategy that leads to a valid chosen-plaintext attack?
The [HMAC Construction](https://en.wikipedia.org/wiki/Hash-based_message_authentication_code#Design_principles) is defined as: Hash( (Key XOR opad) || Hash((Key XOR ipad) || Message) ) This was designed because a simpler construction such as: Hash(Key || Message) Is vulnerable to a [length extension...
The [HMAC Construction](https://en.wikipedia.org/wiki/Hash-based_message_authentication_code#Design_principles) is defined as: Hash( (Key XOR opad) || Hash((Key XOR ipad) || Message) ) This was designed because a simpler construction such as: Hash(Key || Message) Is vulnerable to a [length extension...
Let F be a block cipher with 128-bit block length. Consider the following encryption scheme for 256-bit messages: to encrypt message $M=m_1∥m_2$ using key $k$ (where $|m_1|=|m_2|=128$), choose random 128-bit $r$ and compute the ciphertext $r∥F_k(r)\oplus m_1∥F_k(m_1)\oplus m_2$. Is there any strategy that leads to a va...
**No.** <br>This isn't secure by itself against chosen-plaintext attacks. But also note that most other standard modes (CBC, CFB, CTR, OFB) are vulnerable to chosen plaintext attacks as well. This mode is known as plaintext-feedback mode (PFB) and referenced for example in [here][1].<br> The next point is this...
**No.** <br>This isn't secure by itself against chosen-plaintext attacks. But also note that most other standard modes (CBC, CFB, CTR, OFB) are vulnerable to chosen plaintext attacks as well. This mode is known as plaintext-feedback mode (PFB) and referenced for example in [here][1].<br> The next point is this...
1. Ask yourself **if you even can** securely store the user's data.<br> This includes to check that the user won't get sniffed by the root / admin user.<br>Also make sure that your implementation is secure.<br>Employ standard code review mechanisms, make sure that your implementation has countermeasures against...
Is there something like a perfect asymmetric crypto-algo? Is there proof that there must be one or not. From a logical point of view it seems to be possible to design such algorithm if your keysize is high enough. And please a mathematical solution and not some quantum-cryptography. Thanks in advance
Is there an asymmetric One-Time-Pad?
**No.** <br>This isn't secure by itself against chosen-plaintext attacks. This mode is known as plaintext-feedback mode (PFB) and referenced for example in [here][1].<br> The next point is this mode hasn't received much attention in the cryptographic literature, whereas other modes (CFB, OFB, CBC, CTR) have. T...
If we composed (as in function composition) multiple CPA-secure E. S. would the result also be CPA-secure?
Composition of CPA-secure encryption schemes also CPA-secure?
If we composed (as in function composition) multiple CPA-secure encryption schemes would the result also be CPA-secure?
Suppose we have an encryption scheme that fails the _indistinguishability of encryptions_ test. That is, given messages $m_0, m_1$ and a ciphertext $c_b = Enc_k(m_b)$, where $b \in \{0, 1\}$, the distinguisher $D$ can extrapolate which message was encrypted. Here $D$ has the advantage of knowledge of what the messages ...
Does failure of _indistinguishability of encryptions_ imply lack of CPA-security?
Does failure of indistinguishability of encryptions imply lack of CPA-security?
What is the difference between online and offline brute force attacks?
Ah, cryptographically secure tinder If Alice and Bob also broadcast messages to many other with non-yes answers then the other party wouldn't be able to tell the difference between a "no" and a "did not choose" In this case, the "yes" does get a "no" (atleast, "not interested") from the other party, but the "no" ...
I want to encrypt data that is stored on the hard disk using a user-entered password. For this I look into the [sodium docs](http://doc.libsodium.org/) and all I can find for symmetric encryption is [authenticated encryption](http://doc.libsodium.org/secret-key_cryptography/authenticated_encryption.html). This metho...
The Wikipedia page for [Montgomery curves][1] shows how to convert points on a twisted Edwards curve to and from points on an equivalent Montgomery curve. However, their description and the [original twisted Edwards curve paper][2] use affine coordinates for the conversion. Is it possible to convert directly from pr...
Could this alternative hash based MAC construction be as, or even more secure than an HMAC?