instruction
stringlengths
15
30k
> Will this scheme have the same security of One-Time Pad? Not in theory, facing arbitrary powerful adversaries. E.g. it's overwhelmingly probable that such an adversaries could distinguish among two ciphertexts which one is for input that consists of zeroes, when the other is for input that consists of ones. They ...
> If I hash different seeds with same size of hash output and XOR on plaintext, is it secure as One-time pad? Ignoring the 256-bit blocks specified in question body, the answer to the question in the title depends on the hash length. Consider block size of 1 byte. A hash function with 8-bit output will map each b...
I have a decentralized coin system that I am trying to develop. Each coin can be split up into 1,000,000 units. I've been looking for a **quantum-safe** and practical (efficient) algorithm to send fractions of a coin between peers, so that other than the two peers that participate in the transaction, nobody could...
With the standard definition of public key encryption (or signature), it's not possible to make the _public_ key arbitrary. If it was, the method to find a matching private key from public key would allow decryption (or signature). It's possible, and common, that the _private_ key is arbitrary (in some interval, whi...
I need some help for the following simple game: An adversary is given a multiplicative group $\mathbb{G}$ and the 4-tuple $(g_1, g_2, g_3, g_1^a \cdot g_2^b \cdot g_3^c)$ where $g_1$, $g_2$ and $g_3$ are random elements from $\mathbb{G}$, and $a$, $b$ $c$ are hidden. During the challenge phase, the adversary eith...
The Pedersen hash is a low constraints friendly hash for Zk-Snarks. Unlike many algorithms, the Pedersen hash returns a point `P = (x,y)` on a curve as a hash. **Depending on the selected curve**, there can exist a fast deterministic way to compute a different input that yields `−P=(x,−y)` using the Weierstrass form...
With the standard definition of public key encryption (or signature), it's not possible to make the _public_ key arbitrary†. If it was, the method to find a matching private key from public key would allow decryption (or signature). It's possible, and common, that the _private_ key is arbitrary (in some interval, w...
I'm having some trouble understanding the idea behind C_InitToken. I can tell what it does from the standard, but not its purpose. One of the things it does is to provide authentication of the user as the SO, or initialize the SO's PIN if the token comes from factory. The second half I understand, but the first one ...
PKCS#11 - Does a token need to be initialized in every client application to log in as the normal user with it?
Let's suppose I encrypt an 1MiB plaintext with AES-256 in ECB mode but using different keys for each 16-byte block (I know this is weird but it's just an example). Remembering that a different 256-bit key will be used for each 128-bit block, so if the adversary wants to break a block, a brute-force in the key space ...
If I encrypt a plaintext with different keys for each block, will I have the same security as a one-time pad?
I am trying to find out how to write a security proof for a two-party computation problem. I have also read some examples to write simulators like $x_1 ∧ x_2$ problem. But I am still unsure about my understanding. I have also seen [the paper][1] which uses the game-based approach for its security analysis. I have a...
I am trying to find out how to write a security proof for a two-party computation problem. I have read some examples to write simulators like $x_1 ∧ x_2$ problem and the example in Goldrich's book. I have also read some parts of [Linell's toturial][1] . But I am still unsure about my understanding. I have also seen ...
Is it possible to craft a valid AES-CBC cipher-text that will decrypt (to random) with any possible key?
The Pedersen hash is a low constraints friendly hash for Zk-Snarks. Unlike many algorithms, the Pedersen hash returns a point `P = (x,y)` on a curve as a hash. **Depending on the selected curve**, there can exist a fast deterministic way to compute a different input that yields `−P=(x,−y)` using the Weierstrass form...
**Update: I believe this does not degrade security** Summary: For reasonable choice of basis for the Pedersen hash $\mathsf{PH}$, it is the case that $$ \mathsf{xcoord}(\mathsf{PH}(\mathbf a)) = \mathsf{xcoord}(\mathsf{PH}(\mathbf a')) \implies \mathsf{PH}(\mathbf a) = \mathsf{PH}(\mathbf a'). $$ In other wor...
I have been investigating libraries that implement operations and protocols involving BLS12-381 curves. I have noticed an absence of libraries that support encryption over (either of) the groups G1 and G2 that are defined by the BLS12-381 curves. Is there some cryptographic reason that encryption (say, ElGamal encr...
> If I hash different seeds with the same size of hash output and XOR on plaintext, is it secure as a One-time pad? Ignoring the 256-bit blocks specified in the question body, the answer to the question in the title depends on the hash length. Consider a block size of 1 byte. A hash function with 8-bit output wil...
> Will this scheme have the same security of One-Time Pad? Not in theory, facing arbitrary powerful adversaries. E.g. it's overwhelmingly probable that such adversaries could distinguish among two ciphertexts which one is for input that consists of zeroes, when the other is for input that consists of ones. They can...
**Update: I believe this does not degrade security** Summary: For reasonable choice of basis for the Pedersen hash $\mathsf{PH}$, it is the case that $$ \mathsf{xcoord}(\mathsf{PH}(\mathbf a)) = \mathsf{xcoord}(\mathsf{PH}(\mathbf a')) \implies \mathsf{PH}(\mathbf a) = \mathsf{PH}(\mathbf a'). $$ In other wor...
I am recently reading about multi party computation and its various existing protocols. From what I understand, all the arithmetic operations are performed over a field or a ring such that when two secret values, a and b, are used to perform secure computation c = f(a,b), the output of the MPC protocol is c mod P (for ...
Representing integers as field elements is something that comes up a lot in MPC and zero knowledge proofs. For example, zcash transactions have to show that the output amount doesn't exceed the input amount(s): $$ \mathsf{in}_1 + \ldots + \mathsf{in}_k \geq \mathsf{out} $$ where all the values are mod $p$ for some...
I am trying to find out how to write a security proof for a two-party computation problem. I have read some examples to write simulators like $x_1 ∧ x_2$ problem and the example in Goldreich's book. I have also read some parts of [Lindell's toturial][1] . But I am still unsure about my understanding. I have also see...
While XOR is used as simple symmetric encryption with arbitrary custom key, what is a simple asymmetric encryption that use arbitrary custom key? That means I want to be able to set custom private key or public key (in ASCII format). Expectation: ``` pub = "mypubkey" pri = "myprivkey" msg = "hello world" e...
What is simple asymmetric encryption that use arbitrary key?
Why schnorr signatures uses H(R||m) instead of H(m)?
In your second scheme, the signature $(R,s)$ is verified as $R\overset{?}{=} sG-cX$. If $c$ does not involve $R$, then you could forge a signature by picking a random $s$ value and calculating $R=sG+cX$, where $c=H(m)$. Therefore, it does matter that $c$ is calculated as $c=H(R\mathbin\| m)$. With ECDSA, the x-co...
In your second scheme, the signature $(R,s)$ is verified as $R\overset{?}{=} sG-cX$. If $c$ does not involve $R$, then you could forge a signature by picking a random $s$ value and calculating $R=sG+cX$, where $c=H(m)$. Therefore, it does matter that $c$ is calculated as $c=H(R\mathbin\| m)$. With ECDSA, the x-co...
In your second scheme, the signature $(R,s)$ is verified as $R\overset{?}{=} sG-cX$. If $c$ does not involve $R$, then you could forge a signature by picking a random $s$ value and calculating $R=sG+cX$, where $c=H(m)$. Therefore, it does matter that $c$ is calculated as $c=H(R\mathbin\| m)$. With ECDSA, the x-co...
In theory this is what I have : - Around 10 000 offline machines - Each machine will generate around 10 000 ids - I can program the machine in any way I want, but I prefer a low memory and low cpu - They all will be generated in a short timeframe (1 day) - It should not have id collision - It should not be...
Suppose that there are $n+1$ parties - $B,A_1,A_2,...,A_n$ that want to share a secret key The protocol of exchanging is roughly the same as Diffe-Hellman Chose a group $G$ with an order of $p$ - a prime number and a generator element $g$ - Each $A_i$ generates a random number $a_i \in \{1,...,q\}$ and send...
Let's say I encrypt a message with some secret and store it in a database. Later, I want to securely share that secret with someone, so that they can read the message as well. Even later, I want to further expand the group of people who know the secret by adding another person. Basically, I want end-to-end encryptio...
Is it possible to have a shared secret between an unlimited number of parties asynchronously?
Suppose that there are $n+1$ parties - $B,A_1,A_2,...,A_n$ that want to share a secret key The protocol of exchanging is roughly the same as Diffe-Hellman Chose a group $G$ with an order of $p$ - a prime number and a generator element $g$ - Each $A_i$ generates a random number $a_i \in \{1,...,p\}$ and send...
In your opinion, is the correlation between the length of the ciphertext and the decrypted text (even if it is approximate) a cipher vulnerability? Or is there a solution to this problem outside of it? After all, if the attacker knows the approximate size of the message, he has some information about what type of infor...
> In your opinion, is the correlation between the length of the ciphertext and the decrypted text (even if it is approximate) a cipher vulnerability? Or is there a solution to this problem outside of it? It may be a weakness; however the solution is often too expensive to use, so we often live with this weakness. ...
Assume we have a central issuing authority that sends each participant a share that reconstructs in key "P_k". I.e. Shamir Secret Share with 2 of N format where. N>3. This central authority also broadcasts it's public address "P_a". Is it possible to generate such a proof, that participants can be sure that share...
Is it posible to generate SNARK of MPC share validity?
Assume we have a central issuing authority that sends each participant a share that reconstructs in key "P_k". I.e. Shamir Secret Share with 2 of N format where. N>3. This central authority also broadcasts public address "P_a" so every participant guaranteed to receive same P_a. Is it possible to generate such a ...
Assume we have a central issuing authority that sends each participant a share that reconstructs in key "P_k". I.e. Shamir Secret Share with 2 of N format where. N>3. This central authority also broadcasts public key "P_a" so every participant guaranteed to receive same P_a. Is it possible to generate such a proo...
They say the security of Diffie-Hellman depends on the factorization of (N-1), where N is the big prime number you feed it. More specifically, (N-1) itself has to have a big prime factor, such as (N-1)/2 also being prime. My question isn't about why that's the case or how to tell if it has a big prime factor or ...
In AES, the MixColumns operation involves a linear transformation from GF(2^8)^4 to GF(2^8)^4. The branching factor for this transformation in the original AES is 4, and it is considered secure against differential cryptanalysis with 4 rounds, where the differential probability falls below 2^(-128). If we replace th...
Assuming we have single-key Even-Mansour with single 2n-bit permutation in wide-pipe Merkle-Damgård specifically with Matyas-Meyer-Oseas mode outputing n-bit hash. What security can I expect against collisions and pre-images? Am I wrong to expect 2^n/2 for both?
Assuming we have single-key Even-Mansour with single 2n-bit permutation in wide-pipe Merkle-Damgård specifically with Matyas-Meyer-Oseas mode outputing n-bit hash. What security can I expect against collisions and pre-images? Am I wrong to expect 2^(n/2) for both?
Suppose the circuit is a hash function with the input being the pre-image (private) and the output being the digest (public). If one knows of a collision can they create 2 different proofs that are equal bit-for-bit by inputting the 2 different pre-images that give the collision? It seems such a SNARK does not exist...
Is there a SNARK system that will give the same proof bytes for different witnesses?
Suppose the circuit is a hash function with the input being the pre-image (private) and the output being the digest (public). If one knows of a collision can they create 2 different proofs that are equal bit-for-bit by inputting the 2 different pre-images that give the collision? It seems such a SNARK does not exist...
*This question is relevant for both [crypto stack exchange](https://crypto.stackexchange.com/) and [infosec stack exchange](https://security.stackexchange.com/). I thought I'd ask here to get answers from a cryptography perspective.* If two systems use the same public key signature system, is it reasonable to re-use...
Is it reasonable to re-use a keypair across multiple systems that support the same public key signature system?
In evp.h, `BytesToKey()` generates the key from the passhphrase, IV and SHA256 digest in order to decrypt information used by the public/private keypair generation using AES-256-CBC. I am trying to isolate all the EVP_* functions into a standalone implementation from start to finish. That is, I have the IV of the priva...
Assume we have a central issuing authority that sends each participant a share that reconstructs in key $P_k$. I.e. Shamir Secret Share with $2$ out of $N$ format where $N>3$. This central authority also broadcasts public key $P_a$ so every participant guaranteed to receive same $P_a$. Is it possible to generate ...
Assume we have a central issuing authority that sends each participant a share that reconstructs in key $P_k$. I.e. Shamir Secret Share with $2$ out of $N$ format where $N>3$. This central authority also broadcasts public key $P_a$ so every participant guaranteed to receive same $P_a$. Is it possible to generate ...
I'm using ECDH for generating shared key for STM32 MCU. Which encryption/decryption algorithm should I use? I looked at RSA and AES project samples provided by STM32 but where do I provide shared key with message to encrypt? With the current implementation my key is only 64 bits long.
Which encryption/decryption to use with ECC?
I'm using ECDH for generating shared key for STM32 MCU. Which encryption/decryption algorithm should I use? I looked at RSA and AES project samples provided by STM32 but where do I provide shared key with message to encrypt? With the current implementation shared key size is 64 bits.
I create this question from [here][1]. I am working on a project with C# backend and mobile apps using Java and Swift. I found this documentation to use [RSACryptoServiceProvider.SignData][2] method to sign using private key. But I don't have idea on how to verify and decrypt it on Java and Swift. From my understan...
According to a Lecture from Lecture notes of a Professor of Purdue University "Diffusion means that a change in any plaintext bit must propagate out to as many ciphertext bits as possible." I can't clearly understand how S-box introduces this diffusion in DES. Can anyone explain with an example? Is it because a change ...
How Does S box introduce diffusion in DES?
The prover has $n$ group elements $g_1, ..., g_n$ and wishes to demonstrate the knowledge of the discrete logarithm to base $g$ for each of them, i.e, for each $i \in [1,n]$ she knows some $e_i$ s.t. $g_i = g^{e_i}$. We know that by applying Fiat-Shamir to the Schnorr's protocol, we can get $n$ non-interactive proofs i...
Andres Antonopoulos effectively states: an input of 256bits of entropy into PBKDF2-HMAC-SHA512 will ONLY output a 64 byte hash containing ~128 bits of entropy. He states the algorithm essentially ignores the extra entropy going in, and it is "wasted" entropy. IS THIS TRUE? Can anyone explain why? Source: (starts...
Does PBKDF2 HMAC 512 really only produce a maximum of ~128 bits of entropy? Regardless of input?
Andreas Antonopoulos effectively states: an input of 256bits of entropy into PBKDF2-HMAC-SHA512 will ONLY output a 64 byte hash containing ~128 bits of entropy. He states the algorithm essentially ignores the extra entropy going in, and it is "wasted" entropy. IS THIS TRUE? Can anyone explain why? Source: (start...
One way to answer your question is to check if the following proof system is sound: - Prover sends $R_1,\dots,R_n$ - Verifier sends challenge $c$ - Prover responds with $s_1,\dots,s_n$ - Verifier checks for each $i$ that $(R_i,c,s_i)$ is an accepting transcript of the Schnorr protocol Note that this proves a di...
In evp.h, `BytesToKey()` generates the key from the passhphrase, IV and SHA256 digest in order to decrypt information used by the public/private keypair generation using AES-256-CBC. I am trying to isolate all the EVP_* functions into a standalone implementation from start to finish. That is, I have the IV of the priva...
In evp.h, `BytesToKey()` generates the key from the passhphrase, IV and the MD5 digest in order to decrypt information used by the public/private keypair generation using AES-256-CBC. I am trying to isolate all the EVP_* functions into a standalone implementation from start to finish. That is, I have the IV of the priv...
In evp.h, `BytesToKey()` generates the key from the passhphrase, IV and the MD5 digest in order to decrypt information used by the public/private keypair generation using AES-256-CBC. I am trying to isolate all the EVP_* functions into a standalone implementation for an embedded system. Does anyone have the actual func...
Given `y = g ^ x` is discrete log hard on some finite field, is `y = g ^ (kx)` also equally secure if the value `k` is a publicly known value which was randomly selected from a uniform distribution ?
Given `y = g ^ x` is discrete log hard on some finite field, is `y = g ^ (kx)` also equally secure if the value `k` is a publicly known value which was randomly selected from a uniform distribution ? If k and x are independent and chosen randomly, then the security of the discrete logarithm problem is not significa...
Given `y = g ^ x` is discrete log hard on some finite field, is `y = g ^ (kx)` also equally secure if the value `k` is a publicly known value which was randomly selected from a uniform distribution ? To my understanding, if k and x are independent and chosen randomly, then the security of the discrete logarithm pro...
> is $y = g ^ {kx}$ also equally secure if the value $k$ is a publicly known value which was randomly selected from a uniform distribution ? Here is a clearer way to look at it: suppose we have an oracle that, given $k, y=g^{kx}$, is able to recover $x$. Then, given $g^x$, we can randomly select $k$, compute $(g^...
> is $y = g ^ {kx}$ also equally secure if the value $k$ is a publicly known value which was randomly selected from a uniform distribution ? Here is a clearer way to look at it: suppose we have an oracle that, given $k, y=g^{kx}$, is able to recover $x$. Then, given $g^x$, we can randomly select $k$, compute $(g^...
In a cryptocurrency with privacy e.g., zcash, where does proof generation take place? Can it happen in the client's device every time a transaction is performed? If it happens in client's device, are there possibilities of malware compromising the privacy?
What would be recommended way to make deterministic file encryption? I can use SIV mode, but HKDF takes salt for which I could use SIV tag, but I cannot make it because I need key first. I could use hash of file as salt, but that would make it 3-pass. Another alternative would be to use some other single pass mod...
What would be recommended way to make deterministic file encryption? I can use SIV mode, but HKDF takes salt for which I could use SIV tag, but I cannot make it because I need key first. I could use hash of file as salt, but that would make it 3-pass. Another alternative would be to use hash of file as salt and s...
The Pedersen hash is a low constraints friendly hash for Zk-Snarks. Unlike many algorithms, the Pedersen hash returns a point `P = (x,y)` on a curve as a hash. **Depending on the selected curve**, there can exist a fast deterministic way to compute a different input that yields `−P=(x,−y)` using the Weierstrass form...
In Rabin-Miller primality test, let **N** be the number you're checking for primality. Here **N = 78007**. Let **m** be the number you get after dividing **N** by 2 several times until you can no longer do so. In this case, **m = 39003**. The next step is to pick an **A**, here we pick **A = 3**. Now we calculate...
In Rabin-Miller primality test, let **N** be the number you're checking for primality. Here **N = 78007**. Let **m** be the number you get after dividing **(N - 1)** by 2 several times until you can no longer do so. In this case, **m = 39003**. The next step is to pick an **A**, here we pick **A = 3**. Now we cal...
> What exactly is the purpose of those $b_i$ terms? $b_i = A^{2^i m} \bmod N$ If $\lambda$ is the number of times you divided by 2 in the first step, then $2^\lambda m = N-1$. Hence, by Fermat's little theorem, if $b_\lambda \ne 1$, then we know $N$ is not prime (because $A^{N-1} = 1 \pmod N$ for any prime $N...
I'm reading through a paper called Unconditionally Secure Signatures (https://eprint.iacr.org/2016/739) and to generate keys, the authors select $\epsilon-ASU_2$ functions, such that: 1. For any $m \in M, t \in T, \vert \lbrace f \in F : f(m)=t \rbrace \vert = \vert F \vert / \vert T \vert$ 2. For any $m_1, m_2 \in...
I'm following the discussion in the [question][1] about RSA and what if we set $p<q$. So, what if we mistakenly let $p<q$ and proceed with the private keys creations; that is, we pick up $p, q, e$ and derive from them: $dP,dQ, qInv$ (I'm using the CRT key structure in [PKCS#1][2]). So, by trying to create those ...
In RSA, what if we get pInv instead of qInv?
> I'm following the discussion in the question about RSA and what if we set $p<q$ Nothing bad will happen - the CRT algorithm we use doesn't actually depend on $p > q$ - it'll work both ways. The standard algorithm to perform the final CRT step is: $$m = m_q + q \cdot ((m_p - m_q) \cdot qinv \bmod p)$$ (whe...
> I'm following the discussion in the question about RSA and what if we set $p<q$ Nothing bad will happen - the CRT algorithm we use doesn't actually depend on $p > q$ - it'll work both ways. The standard algorithm to perform the final CRT step is: $$m = m_q + q \cdot ((m_p - m_q) \cdot qinv \bmod p)$$ (whe...
I'm following the discussion in the [question][1] about RSA and what if we set $p<q$. So, what if we mistakenly let $p<q$ and proceed with the private keys creations; that is, we pick up $p, q, e$ and derive from them: $dP,dQ, qInv$ (I'm using the CRT key structure in [PKCS#1][2]). So, by trying to create those ...
The Pedersen hash is a low constraints friendly hash for Zk-Snarks. Unlike many algorithms, the Pedersen hash returns a point `P = (x,y)` on a curve as a hash. **Depending on the selected curve**, there can exist a fast deterministic way to compute a different input that yields `−P=(x,−y)` using the Weierstrass form...
The Pedersen hash is a low constraints friendly hash for Zk-Snarks. Unlike many algorithms, the Pedersen hash returns a point `P = (x,y)` on a curve as a hash. **Depending on the selected curve**, there can exist a fast deterministic way to compute a different input that yields `−P=(x,−y)` using the Weierstrass form...
In https://crypto.stackexchange.com/a/27828/79037, it's indicated that one can "save space" by using something *globally-unique*, like an application-wide "pepper", together with something *locally-unique* (e.g, a user-id field, *unique* per-user). In other words, by simply "deriving" a salt (from some other fields/val...
How many bits should change in a password salt?
In https://crypto.stackexchange.com/a/27828/79037, it's indicated that one can "save space" by using something *globally-unique*, like an application-wide "pepper", together with something *locally-unique* (e.g, a user-id field, *unique* per-user). In other words, by simply "deriving" a salt (from some other fields/val...
In https://crypto.stackexchange.com/a/27828/79037, it's indicated that one can "save space" by using something *globally-unique*, like an application-wide "pepper", together with something *locally-unique* (e.g, a user-id field, *unique* per-user). In other words, by simply "deriving" a salt (from some other fields/val...
> _pepper_ is a globally-unique, application-wide constant That's a possible definition. Some make _pepper_ public (e.g. server name). Others make _pepper_ a secret decided at installation, and that can help security if it's is not stored and backed up along the hashed passwords (but loss of pepper is a major availa...
> _pepper_ is a globally-unique, application-wide constant That's a possible definition. Some make _pepper_ public (e.g. server name). Others make _pepper_ a secret decided at installation, and that can help security if it's is not stored and backed up along the hashed passwords (but loss of pepper is a major availa...
In Regev's publication "[The Learning with Errors Problem][1]", a naive algorithm is given on page 3 that can be used to tackle the LWE problem. This is the statement: Another, even more naive algorithm is the following: keep asking for LWE samples until seeing $poly(n)$ equations of the form $s_1 \approx . . . $ (i...
In https://crypto.stackexchange.com/a/27828/79037, it's indicated that one can "save space" by using something *globally-unique*, like an application-wide "pepper", together with something *locally-unique* (e.g, a user-id field, *unique* per-user). In other words, by simply "deriving" a salt (from some other fields/val...
Is there any study that has looked into what is the minimum number of ciphertext characters one needs to have to do a reliable frequency analysis? It would be nice to know the evolution of the accuracy of the analysis as the number of characters considered increases, but I haven't found any well done study.
How many characters to do frequency analysis?
I'm reading Rivest et al.'s "How to leak a secret", but I'm having a hard time understanding step 4 of the generation procedure. This could be because of my own lack of knowledge regarding operations on ring but the following: [![enter image description here][1]][1] makes very little sense to me. How am I supposed t...
I'm reading Rivest et al.'s "How to leak a secret", but I'm having a hard time understanding step 4 of the generation procedure. This could be because of my own lack of knowledge regarding operations on ring but the following: [![enter image description here][1]][1] makes very little sense to me. How am I supposed t...
I'm reading Rivest et al.'s "How to leak a secret", but I'm having a hard time understanding step 4 of the generation procedure. This could be because of my own lack of knowledge regarding operations on ring but the following: [![enter image description here][1]][1] makes very little sense to me. How am I supposed t...
I'm reading Rivest et al.'s "How to leak a secret", but I'm having a hard time understanding step 4 of the generation procedure. This could be because of my own lack of knowledge regarding operations on ring but the following: [![enter image description here][1]][1] makes very little sense to me. How am I supposed t...