instruction
stringlengths
15
30k
There are a number of small mistakes in the question. Let's clean up that first. $\gcd(e,n)=1$ is likely, but neither necessary nor sufficient for RSA to work; the right condition is $\gcd(e,p-1)=\gcd(e,q-1)=1$. Notice this implies $e$ odd for any non-trivial choice of $p$ and $q$. Even in textbook RSA, the right...
There are a number of small mistakes in the question. Let's clean up that first. $\gcd(e,n)=1$ is likely, but neither necessary nor sufficient for RSA to work; the right condition is $\gcd(e,p-1)=\gcd(e,q-1)=1$. Notice this implies $e$ odd for any non-trivial choice of $p$ and $q$. Even in textbook RSA, the right...
There are a number of small mistakes in the question. Let's clean up that first. $\gcd(e,n)=1$ is likely, but neither necessary nor sufficient for RSA to work; the right condition is $\gcd(e,p-1)=\gcd(e,q-1)=1$. Notice this implies $e$ odd for any non-trivial choice of $p$ and $q$. Even in textbook RSA, the right...
There are a number of small mistakes in the question. Let's clean up that first. $\gcd(e,n)=1$ is likely, but neither necessary nor sufficient for RSA to work; the right condition is $\gcd(e,p-1)=\gcd(e,q-1)=1$. Notice this implies $e$ odd for any non-trivial choice of $p$ and $q$. Even in textbook RSA, the right...
There are a number of small mistakes in the question. Let's clean up that first. $\gcd(e,n)=1$ is likely, but neither necessary nor sufficient for RSA to work; the right condition is $\gcd(e,p-1)=\gcd(e,q-1)=1$. Notice this implies $e$ odd for any non-trivial choice of $p$ and $q$. Even in textbook RSA, the right...
There are a number of small mistakes in the question. Let's clean up that first. $\gcd(e,n)=1$ is likely, but neither necessary nor sufficient for RSA to work; the right condition is $\gcd(e,p-1)=\gcd(e,q-1)=1$. Notice this implies $e$ odd for any non-trivial choice of $p$ and $q$. Even in textbook RSA, the right...
It is conjectured that SHA-1 has been broken from the "research" perspective but no in real world. That is that there is an algebraic attack that explores weaknesses on its algrebraic construction. The same happens for MD5 but MD5 has been practically broken by finding collisions in real world. Can we still use HMAC wi...
If i sign word "HELLO" , mechanizm = "NONEwithRSA" with the same private key, do I always will have the same signature? java example always return different byte array : PKCS11Provider provider = new PKCS11Provider(this); List<PKCS11Slot> slots = PKCS11Slot.enumerateSlots(provider); PKCS11Sessi...
Are RSA signatures unique?
Some signature algorithms are deterministic (you always get the same signature for the same private key and input), others are not. In the case of RSA, as specified by [PKCS#1][1], the "old-style" (aka "v1.5") signatures are deterministic, while the "new-style" ("PSS") signatures are not (padding includes some random b...
Is SHA-1 collision free on data up to 20 bytes long (lenght of hash / internal state)? That means that every input produce unique output, but you surely know that, i just write it in order my question to be accepted by the site :) If yes - which other hash functions does it apply to and what is the corresponding max...
Is SHA-1 collision free on data up to 20 bytes long?
Is there an efficient way (algorihtm) to compute the solutions of the congruence $x^n\equiv a \mod p$? - $n\in \mathbb{N}$ - $a\in\mathbb{Z}_p$ - p is a large prime number **Note that:** - By efficient I mean computationally efficient even when the given prime $p$ is appropriate for use in cry...
Can SRP be used with Elliptic Curves?
What is the difference between MAC and HMAC?
In reference to [this question][1], what are the "stronger security properties" that HMAC provides over MAC. I got that MAC requires an IV whereas HMAC doesn't. I also understood that MAC may reveal information about plaintext in contrast to HMAC. However, i want the list of all the security properties. Can anyone prev...
In reference to [this question][1], what are the "stronger security properties" that HMAC provides over MAC. I got that MAC requires an IV whereas HMAC doesn't. I also understood that MAC may reveal information about plaintext in contrast to HMAC. However, i want the list of all the security properties. Can anyone proi...
In reference to [this question][1], what are the "stronger security properties" that HMAC provides over MAC. I got that MAC requires an IV whereas HMAC doesn't. I also understood that MAC may reveal information about plaintext in contrast to HMAC. However, I want the list of all the security properties. Can anyone proi...
I'm currently working on Ciphertext Policy Attribute Based Encryption (CP-ABE). So far I'm only using it with a basic understanding how it actually works. Now I want to understand it a bit better, but I've never learned anything about bilinear groups or pairing based cryptography. For the beginning I would like to cal...
Ever since the SHA-3 competition, I've been wondering if it is possible to create a hash algorithm that is easier to parallelize. The current algorithms all seem to require building a tree of hashes. This has however rather serious drawbacks: 1. as they requires a tree with certain parameters (such as the size of no...
I'm currently working on Ciphertext Policy Attribute Based Encryption (CP-ABE). So far I'm only using it with a basic understanding how it actually works. Now I want to understand it a bit better, but I've never learned anything about bilinear groups or pairing based cryptography. For the beginning I would like to cal...
I know I'm treading in dangerous waters asking this - my comprehension of cryptography math is sorely lacking. On the flip side it gives me massive admiration for what many of you are able to do. From my understanding of crypto functions, a password is typically used to create a xxx-bit secret key. This could be 12...
Is there a practical security difference between XXX-bit encryption?
I know I'm treading in dangerous waters asking this - my comprehension of cryptography math is sorely lacking. On the flip side it gives me massive admiration for what many of you are able to do. From my understanding of crypto functions, a password is typically used to create a xxx-bit secret key. This could be 12...
When nowadays I point my browser to https sites, the cipher that is on most occasions used is camellia. My browser (chrome and firefox) seems to prefer it, even when AES is available. My question is: Is that not kind of dangerous? Camellia did not receive so much scrutiny as did e.g. AES, so we know actually less abou...
Why is CAMELLIA suddenly so widely used?
I have 320 bits of seed data (actually 512 bits of data with 320 bits of entropy, derived from a Diffie-Hellman shared secret and nonces). The PRNG I am using at the moment is the android version of SHA1PRNG. As far as I can tell, it has 160 bits of internal state, and so any entropy over 160 bits would be wasted. Coul...
Can I combine two PRNGs to make use of more seed data?
This is a revisited but still **partial** attempt at an explicit solution. We can use that since $p$ is prime: $$\forall z\in\mathbb{Z}_p, z^p\equiv z\pmod p$$ $$\forall z\in\mathbb{Z}_p^*, z^{p-1}\equiv1\pmod p$$. We first rule out $n=0$, $a\bmod p=0$, as making our equation $x^n\equiv a\pmod p$ without well-d...
Is there an efficient way (algorihtm) to compute the solutions of the congruence $x^n\equiv a \pmod p$? - $n\in \mathbb{N}$ - $a\in\mathbb{Z}_p$ - $p$ is a large prime number **Note that:** - By efficient I mean computationally efficient even when the given prime $p$ is appropriate for use in ...
I'm currently working on [Ciphertext Policy Attribute-Based Encryption][1] (CP-ABE). So far I'm only using it with a basic understanding how it actually works. Now I want to understand it a bit better, but I've never learned anything about bilinear groups or pairing-based cryptography. To start with I would like to ...
If I sign the word `HELLO` with the mechanism "NONEwithRSA" with the same private key, do I always will have the same signature? A Java example always return different byte array : PKCS11Provider provider = new PKCS11Provider(this); List<PKCS11Slot> slots = PKCS11Slot.enumerateSlots(provider); PKCS...
Are RSA signatures deterministic?
I am implementing the encryption layer for a communication protocol. The bulk encryption method used is either AES-CCM or AES-GCM. Due to implementation details, encryption of packets is usually, but not necessarily, performed by the sender in the same order the packets are sent over the network. This means two things:...
Is it possible to create a Bilinear Function with Already Assigned "Multiplicative" Input Groups?
I've been tasked with reverse engineering an unknown crypto function. a=380951 I noticed that this is a prime number b=3182 I noted that this is a prime number +1 The math function applied is as follows: result=((value mod a) * b) mod a The value is a 24 bit number as is the result (obviously). The result ...
How to solve the reverse of an equation that uses MOD?
1. I want to generate a random elliptic curve over a prime field. What are the conditions I should satisfy? 2. For NIST 2^224-2^96+1 curve, reduction technique is there (448 bit into 224 bit reduction using prime, ((z1+z2+z3-z4-z5) mod prime )), what is the logic behind in this one?
As known, a^x % N takes O(num_bits(x) + num_1_bits(x)) multiplications modulo N. Can the number of bits set to 1 be derived from the run time and can it somehow speed up finding of **x** if **a** and **N** are is known?
Just to follow up here, because there were some unanswered questions from the last posts and I was wondering myself how this could actually work. As it happened, I was at the RSA Security 2013 conference this week where Ciphercloud happened to be exhibiting. In between sessions I had time to visit their booth to learn ...
I've been tasked with reverse engineering an unknown crypto function. The function uses the following constants: * $a=380951$: I noticed that this is a prime number * $b=3182$: I noted that this is a prime number + 1 The math function applied is as follows: $\mathrm{result}=((\mathrm{value} \bmod a) \cdot b)...
ChaCha8 takes a 8 byte nonce (or IV) that should not be the same twice for the same key. Generating this nonce randomly makes me very very nervous for collisions. Is it safe to generate this nonce deterministically? For example the first 6 bytes could be the number of milliseconds since the Unix epoch, with the l...
Is it safe for the ChaCha8 nonce to be deterministic?
I haven't posted in a while, so long in fact that the email tied to my Stack Exchange account is no more, I forgot my StackEx password, and I had to create a new account. (I'll leave it to the reader to decide if this is the real me.) But I did want to just to follow up here, because there were some unanswered quest...
This is a revisited but still **partial** attempt at an explicit solution. We can use that since $p$ is prime: $$\forall z\in\mathbb{Z}_p, z^p\equiv z\pmod p$$ $$\forall z\in\mathbb{Z}_p^*, z^{p-1}\equiv1\pmod p$$. We first rule out $n=0$, $a\bmod p=0$, as making our equation $x^n\equiv a\pmod p$ without well-d...
The reason why you see that is because Camellia is the highest-preference cipher in NSS (Chrome and Firefox). Servers that support Camellia and use the client-preferred cipher suite will use Camellia. The reason for NSS's ordering is: "National ciphers such as Camellia are listed before international ciphers suc...
Assume that we have a linear equation like this: $$ax=b \pmod n$$ when $x$ is the unknown, and $a$ is not an invertible element in $n$. is finding $x$ a hard problem?
Is solving a modular linear equation a hard problem when the coefficient is not an invertible element?
See [this question](http://crypto.stackexchange.com/questions/2303/in-rsa-rationale-for-prime-p-with-p-1-having-prime-factor-u-with-u-1-ha). The comment by Brett Hale stated: > On the other hand, ensuring $(p - 1)$ has a large prime factor requires very little extra effort. What's actually the 'little extra effor...
In RSA, how to make sure that $p-1$ and $q-1$ are still hard to factorize?
The [RFC](https://tools.ietf.org/html/rfc5869) states the following: > 3.2. The 'info' Input to HKDF > > While the 'info' value is optional in the definition of HKDF, it is often of great importance in applications. Its main objective is to bind the derived key material to application- and context-specific ...
What information to include is the 'info' input for HKDF?
I am looking into implementing [Pohlig-Hellman exponentation cipher][1] and I would like to know how secure that algorithm is? I am guessing it's security relates greatly to the prime number used in it. Does anyone have some reference that might be helpful in determining the minimal prime number one should use in order...
Security of Pohlig-Hellman exponentation cipher?
The reason why you see that is because Camellia is the highest-preference cipher in NSS (Chrome and Firefox). Servers that support Camellia and use the client-preferred cipher suite will use Camellia. NSS's rationale for this ordering is: "National ciphers such as Camellia are listed before international ciphers...
Why are you afraid of "overseeding" the PRNG? The Java `SecureRandom` class specifies the [`setSeed`](http://docs.oracle.com/javase/7/docs/api/java/security/SecureRandom.html#setSeed(byte[])) function as: public void setSeed(byte[] seed) So just feed the 320 bits (40 bytes) data to the `setSeed` function and ...
Why are you afraid of "overseeding" the PRNG? The Java `SecureRandom` class specifies the [`setSeed`](http://docs.oracle.com/javase/7/docs/api/java/security/SecureRandom.html#setSeed(byte[])) function as: public void setSeed(byte[] seed) So just feed the 320 bits (40 bytes) data to the `setSeed` function and ...
I've been tasked with reverse engineering an unknown crypto function. The function uses the following constants: * $a=380951$: I noticed that this is a prime number * $b=3182$: I noted that this is a prime number + 1 The math function applied is as follows: $\mathrm{result}=((\mathrm{value} \bmod a) \cdot b)...
I've been tasked with reverse engineering an unknown crypto function. The function uses the following constants: * $a=380951$: I noticed that this is a prime number * $b=3182$: I noted that this is a prime number + 1 The math function applied is as follows: $\mathrm{result}=((\mathrm{value} \bmod a) \cdot b)...
Homomorphic encryption mainly aims to enhance the security of cloud computing. We should be able to encrypt data and send it to the cloud. After it is send, we should be able to make computation on the encrypted data and the result of this computation is an encrypted data too. If we decrypt the result of our computatio...
What does homomorphic encryption is aims to solve?
I am trying to understand why is bcrypt called a Key Derivation Function? I looked up the details of Ekfblowfish on Usenix article here: http://static.usenix.org/event/usenix99/provos/provos_html/node4.html#SECTION00040000000000000000 After reading it, I understood that: 1. the password is the encryption ke...
Why is Bcrypt called a Key Derivation Function?
1. I want to generate a random elliptic curve over a prime field. What are the conditions I should satisfy? 2. For the NIST recommended standard ECC-224 bit curve with prime $p=2^{224}-2^{96}+1$, a reduction technique is given by $(z_1+z_2+z_3-z_4-z_5) \bmod{p}$, what is the logic behind in this?
While reading about a few cryptographic systems, I noticed that we always assume the communication channel is not secured. Why is this assumption made? And, why the effort is being put into designing cryptographic systems rather than working on making these communication channels more secure? I know the question is ba...
You need a large random prime modulus where the discrete log is hard. Read about how to choose a prime so the discrete log is hard. Also, you want $p-1$ to have as few small factors as possible. Therefore, the short version is, I suggest you choose a large random 2048-bit prime $p$ such that $(p-1)/2$ is prime. H...
I would like to ask you about your opinion on the following scheme of combining a master key and a nonce and stretching the result to the full 256-bytes RC4 key. - master key Km is a pre-shared secret of length M bytes - nonce Kn is sent unencrypted and is of length N bytes - both Km and Kn are chosen to be high-e...
I would like to ask you about your opinion on the following scheme of combining a master key and a nonce and stretching the result to the full 256-bytes RC4 key. - Master key $K_m$ is a pre-shared secret of length $M$ bytes - nonce $K_n$ is sent unencrypted and is of length $N$ bytes - both $K_m$ and $K_n$ are cho...
I am familiar with the RC4 related key attacks; I can say that if you publish the nonce, and use any of the first 256 bytes of the RC4 keystream, that you are vulnerable to those attacks. These attacks exploit a correlation between specific bytes of the RC4 key, and the initial output values; with your approach, the...
As I understand from this [article about homomorphic encryption][1], it mainly aims to enhance the security of cloud computing. We should be able to encrypt data and send it to the cloud. After it is send, we should be able to make computation on the encrypted data and the result of this computation is an encrypted da...
What goals is homomorphic encryption aiming to solve?
[This answer][1] lists two commutative cipher algorithms - Pohlig-Hellman and SRA. However, they don't appear to be [too secure][2]. My question is, here there any commutative ciphers out there that are secure enough for sensitive data encryption / decryption (money is involved) and at the same time not burdening en...
Are there any secure commutative ciphers?
The reason why you see that is because Camellia is the highest-preference cipher in NSS (Chrome and Firefox). Servers that support Camellia and use the client-preferred cipher suite will use Camellia. [NSS's rationale for this ordering][1] is: > National ciphers such as Camellia are listed before international ...
When nowadays I point my browser to https sites, the cipher that is on most occasions used is [Camellia][1]. My browsers (Chrome and Firefox) seem to prefer it, even when AES is available. Is that not kind of dangerous? Camellia did not receive so much scrutiny as did e.g. AES, so we know actually less about its sec...
I would like to implement a [mental poker][1] protocol in a secure fashion. How should I go about that without infringing on the [Mental Poker Framework patent][2]? [1]: http://en.wikipedia.org/wiki/Mental_poker [2]: http://crypto.stackexchange.com/a/4001/843
How to secure a mental poker protocol?
I would like to implement a [mental poker][1] protocol in a secure fashion. How should I go about that without (preferably) infringing on the [Mental Poker Framework patent][2]? [1]: http://en.wikipedia.org/wiki/Mental_poker [2]: http://crypto.stackexchange.com/a/4001/843
Assume that we have a linear equation like this: $$ax=b \pmod n$$ when $x$ is the unknown, and $a$ is not an invertible element in $n$. is finding $x$ a hard problem? (by solving I mean finding an $x$ that satisfies the equation)
Homomorphic encryption in and of itself solves the problem of computation on encrypted data. For example, if I give you only the encryptions of $a$ and $b$ ($E(a),E(b)$) can you compute $E(ab)$ and $E(a+b)$. That is the problem that fully homomorphic encryption (FHE) solves. There are also partially homomorphic encrypt...
It is known that computing $a^x \bmod N$ takes $O(|x| + \mathrm{pop}(x))$ multiplications modulo $N$, where $|x|$ is the number of bits of $x$ and $\mathrm{pop}(x)$ is the number of $1$ bits (Hamming weight). This suggests a side channel attack by measuring the run time of the exponentiation. Can the number of $1$ bits...
In the Paillier cryptosystem [1] the encryption of $m \in \mathbb{Z}_N$ with randomness $r \in \mathbb{Z}_n^*$ is $c = g^m r^n \bmod{n^2}$. The additive-homomorphic property of the system shows that $g^{m_1} r_1^n \cdot g^{m_2} r_2^n = g^{m_1+m_2} (r_1r_2)^n = g^{m_1+m_2} r'^n\mod n^2 = m_1 + m_2 \mod n$ so the...
In reference to [this question][1], what are the "stronger security properties" that HMAC provides over MAC. I got that MAC requires an IV whereas HMAC doesn't. I also understood that MAC may reveal information about plaintext in contrast to HMAC. Is my understanding right? What are other security properties of MAC ...
I have to license a java application and want to code a quick implementation, the scheme I came up with is: 1) The Application calculates a string X which we assume to be the md5 sum of the computer's mac address, the current date and some other information. 2) the application returns a string Y equal to the last...
What is the main difference of the three? Can I use only one of them for everything (e.g. GPG for SSH authentication) If I encrypt my private key with a pass-phrase, is it strong enough so that if someone steals my laptop or private key, I'm safe? If not, what about encrypting my private key with the scrypt algo...
> What is the main difference of the three? Can I use only one of them for everything (e.g. GPG for SSH authentication) - **GnuPG** is an free and open-source implementation of the OpenPGP standard. - Symantec **PGP** is a proprietary implementation of the OpenPGP standard. - The **OpenPGP** standard defines ways ...
It is known that computing $a^x \bmod N$ takes $O(|x| + \mathrm{pop}(x))$ multiplications modulo $N$, where $|x|$ is the number of bits of $x$ and $\mathrm{pop}(x)$ is the number of $1$ bits (Hamming weight). This suggests a side channel attack by measuring the run time of the exponentiation. Can the number of $1$ ...
Below is my implementation of the RSA algorithm. Actually I'm choosing the private key (d) instead of public key (e) and computing the public key.It is working fine but I want to know if this is a safe implementation? and also Is any part in the code could lead to factorization of the modulus (n), thereby breaking t...
No, this is not a safe implementation; from the modulus and the public exponent, it would be possible to factor the modulus. The reason is that you pick the private exponent to be small; one-fifth the size as the modulus. It's [known][1] that knowledge of a public exponent corresponding to that is sufficient to fac...
I plan to build my own crypto library. The project will be primarily for me to learn (and if useful for no other purpose, that is fine). In the past I have implemented a few hashes, and AES quite a few times while learning about it, but those projects were solely for me to learn, not for any field use. With this one I'...
What should I be aware of when implementing algorithms myself?
What data is saved in RSA private key in openssl? How to view it?
What data is saved in RSA private key?
I have a homework problem: *Explain how to find $m_{0}$ and $c$ such that $P[c=c': k \leftarrow K, c' \leftarrow E(k, m_{0})] > 0$* where P is probability and k is chosen uniformly. I do not know if I understand the question correctly. The notation should imply that what is the probability of the condition $c...
I've played a lot with VIC and enjoy its complexity and effectiveness as a field cipher . However RC4 has caught my attention lately and I've read there is a RC4-52 variant that can be done by hand. Can anybody describe the rc4-52 algorithm? Is it with a deck of cards, and is it just a swap of the values or must t...
RC4 by hand / pen-and-paper?
How are Elliptic Curve Cryptography and Pairing Based Cryptography related?
What data is saved in RSA private key in openssl (which variables)? How to view it?
Should the secret message of Shamir's algorithm be interpreted and processed byte by byte? Interpreting it byte by byte makes it easier to process, but in case one of the shareholders decides to tamper with some of the bytes in his possession, this will affect the secret reconstruction. This is a serious risk, and I...
Should the secret key of Shamir's algorithm be interpreted byte by byte?