instruction
stringlengths
15
30k
Proving if two samples hides a value?
Given two values - $r'-r \mod Q$ - $i - r \mod Q$ Where - $r',r$ sampled randomly from $Z_Q$ - while i is pick arbitrarily from $Z_Q$ and a secret Can we claim that this hides $i$? Here is my sketch: Distribution of above samples is indistinguishable to - $r'' \mod Q$ - $i - r \mod Q$ Where $r''$ is...
Given two values - $r'-r \mod Q$ - $i - r \mod Q$ Where - $r',r$ sampled randomly from $Z_Q$ - while i is pick arbitrarily from $Z_Q$ and a secret Can we claim that this hides $i$? Here is my sketch: Distribution of above samples is indistinguishable to - $r'' \mod Q$ - $i - r \mod Q$ Where $r''$ is...
Given two values - $r'-r \mod q$ - $i - r \mod q$ Where - $r',r$ sampled randomly from $Z_q$ - while i is pick arbitrarily from $Z_q$ and a secret Can we claim that this hides $i$? Here is my sketch: Distribution of above samples is indistinguishable to - $r'' \mod q$ - $i - r \mod q$ Where $r''$ is...
So I think I understand how zero knowledge protocol with 3-coloring is supposed to work. But in an attempt to increase soundness of the protocol, we allow the verifier V to challenge two edges per repetition instead of one. I'm told that this breaks the zero knowledge property, but I'm not exactly sure how to prove it....
So I think I understand how zero knowledge protocol with 3-coloring is supposed to work. But in an attempt to increase soundness of the protocol, we allow the verifier V to challenge two edges per repetition instead of one. I'm told that this breaks the zero knowledge property, but I'm not exactly sure how to prove it....
Let $X$ be a point on elliptic curve such that $X = x \cdot G$, where <mi>G</mi> is generator. Let us assume that we know $x$ is something $x = 65*t + 1$ where $t$ is an integer. Now if I know that the key exist somewhere between a given range $[A, B]$ then which algorithm would be best to apply to find the key $x$?...
I'm trying to implement encrypted firmware update functionality for an embedded device. The goal is to prevent reverse engineering of our firmware when the update files are shared with our customers. The approach that I've chosen is to encrypt the firmware using AES-128 with CTR block mode. What I'm pondering right ...
I understand that the `//` operator is used for floor division in regular arithmetic ``` result = 7 // 3 # This will result in 2 ``` but how can I adapt this to work with the specific mathematical operations involved in secp256k1? Could someone provide guidance or a code snippet illustrating how to perform flo...
Let $X$ be a point on an elliptic curve such that $X = [x]G$, where $G$ is a generator. Let us assume that we know $x$ is something $x = 65t + 1$ where $t$ is an integer. Now if I know that the key exist somewhere between a given range $[A, B]$ then which algorithm would be best to apply to find the key $x$? Will...
Since the method to determining the security of symmetric cryptographic algorithms is to evaluate their ability to resist the various attacks. My problem is that could we evaluate the minimum complexity of recoverying all key of the cipher? For example: To recovery the key used in AES-128, the time complexity is 2...
I'm working on a web app ("main") which acts as a central access hub for several other web apps ("children"). The users are supposed to authenticate in the main app, resulting in a $t_{main}$ token known to the client devices, and they are supposed to authenticate in each separate child app they want to access, resulti...
Is it secure to encrypt an authentication token using another possibly hashed authentication token?
There are several valid ways to _choose_ $d$ after choosing $e$ in RSA. All must insure that $e\,d\equiv 1\bmod\lambda(n)$, where $\lambda$ is the [Carmichael function][1]. That's the mathematically necessary and sufficient condition for $d$ to allow decryption as $m\gets c^d\bmod n$ of ciphertext $c=m^e\bmod n$ in ...
I'm looking for maximum possible security. My current scheme is xChaCha20-Poly1305-xSalsa20-Poly1305-AES-CBC-HMACSHA-512. Does combining these algorithms increase security if implemented correctly? Here's my source code for reference: ``` private const int Iterations = 32; private const double MemorySize =...
Does using multiple encryption algorithms with different keys on the same cipher text improve security?
Given a basis $\{v_1,\dots,v_k\}$ for a $q$-ary lattice $L$ in ${\mathbb Z}_q^n$, is there an efficient (deterministic/randomized) way to find a point in $L$ with all non-zero components, or decide that it does not exist?
Is there an efficient way to check if a lattice has a point with all non-zero components?
I come from the question here: https://crypto.stackexchange.com/questions/108254/safe-primes-subgroup-in-diffie-hellman-key-exchange Where the accepted answer states that there are only 4 possible outcomes for the order of a subgroup when using a safe prime in the Diffie-Hellman Key Exchange: (1, 2, q, p-1) where q ...
DHKE: Why using safe prime gives us "safe" subgroups?
According to Section 2.3 of [Full-RNS CKKS](https://eprint.iacr.org/2018/931.pdf): > More precisely, for a basis $ \left\{p_{0}, \ldots, p_{k-1}, q_{0}, \ldots, q_{\ell-1}\right\} $, let $ \mathcal{B}=\left\{p_{0}, \ldots, p_{k-1}\right\} $ and $ \mathcal{C}=\left\{q_{0}, \ldots, q_{\ell-1}\right\} $ be its subbases...
Since the practical security of a symmetric-key primitive is determined by evaluating its resistance against an almost exhaustive list of known cryptanalytic techniques. My problem is that could we evaluate the minimum complexity of key recovery of a cipher from an information theory perspective when the success pro...
Since the practical security of a symmetric-key primitive is determined by evaluating its resistance against an almost exhaustive list of known cryptanalytic techniques. My problem is that could we evaluate the minimum complexity of key recovery of a cipher from an information theory perspective when the success pro...
I saw a post named "<https://crypto.stackexchange.com/questions/102715/how-does-signing-with-fors-work-in-sphincs>" but in the post it seems like no one had explain how does the FORS works. SK: Secret Key, PRF: Pseudo-Random Function I'm how the key generation works. Just in case, I'll say what I know just to en...
How does FORS: Forest of Random Subsets work?
I saw a post named "<https://crypto.stackexchange.com/questions/102715/how-does-signing-with-fors-work-in-sphincs>" but in the post it seems like no one had explain how does the FORS works. SK: Secret Key, PRF: Pseudo-Random Function I'm how the key generation works. Just in case, I'll say what I know just to en...
I saw a post named "<https://crypto.stackexchange.com/questions/102715/how-does-signing-with-fors-work-in-sphincs>" but in the post it seems like no one had explain how does the FORS works. SK: Secret Key, PRF: Pseudo-Random Function I'm know a bit how the key generation works. Just in case, I'll say what I know...
How FORS works is fairly simple. The signer selects $k$ lists of $2^a$ values each. For each such value $x_{c, d}$ (the $d$th item from the $c$th list), he computes the 'public' value $H(x_{c,d})$ (this is public not in the sense that we always tell the verifier about this, but instead we don't mind if the adversar...
How FORS works is fairly simple. The signer selects $k$ lists of $2^a$ values each. For each such value $x_{c, d}$ (the $d$th item from the $c$th list), he computes the 'public' value $H(x_{c,d})$ (this is public not in the sense that we always tell the verifier about this, but instead we don't mind if the adversar...
Naccache-Stern cryptosystem is mainly based on Chinese Remainder Theorem. According to its [wiki](https://en.wikipedia.org/wiki/Naccache%E2%80%93Stern_cryptosystem) page and [Partially Homomorphic encryption book](https://link.springer.com/chapter/10.1007/978-3-030-87629-6_7), I generated following keys. 1- Picked a...
I've been reading up on different authentication protocols recently while I implemented the sign-in functionality for my website. Many of the suggested methods password-based authentication seem to either rely on non-quantum safe maths (eg. ECC, DH, SRP), or be really complex (eg. aPAKEs), or offer slightly reduced sec...
In the Kyber [specification][1] there is an algorithm "Parse", which receives a byte stream as input and from this the NTT representation $\hat{a} = \hat{a}_0+\hat{a}_1X + ... + \hat{a}_{n-1}X^{n-1} \in R_q$ is calculated from $a \in R_q$. For the sake of completeness, I have added the algorithm here: [![enter image...
Let, us have a public base point $G$ on the curve $E$, and let us have a public key $P$ with a related secret key $k$ with $P = [k]G$. **Discrete Logarithm** Finding $k$ given $G$ and $P$ and curve parameters is called the **Discrete Logarithm Problem** (DLP) on the curve. In general, if there is no special s...
Let, us have a public base point $G$ on the curve $E$, and let us have a public key $P$ with a related secret key $k$ with $P = [k]G$. **Discrete Logarithm** Finding $k$ given $G$ and $P$ and curve parameters is called the **Discrete Logarithm Problem** (DLP) on the curve. In general, if there is no special s...
I would like to deterministically derive two different 256-bit keys from a single passphrase -- one used as an ECDSA private key, the other as a symmetric key for AES-GCM. Would a KDF output sufficient bits of entropy, given a 256-bit input? I'm planning to use Argon2, but I'd be happy to use another KDF if necessar...
Assume we're using a security parameter of "keylength |K| is 256 bits", say for AES. You're asking two things: 1. Is it OK to use less than |K| bits of input entropy? 2. Is this still OK in a [PQC](https://en.wikipedia.org/wiki/Post-quantum_cryptography) context? The answer to (1.) of course is "no". But it'...
Assume we're using a security parameter of "keylength |K| is 256 bits", say for AES. You're asking two things: 1. Is it OK to use less than |K| bits of input entropy? 2. Is this still OK in a [PQC](https://en.wikipedia.org/wiki/Post-quantum_cryptography) context? The answer to (1.) of course is "no". But it'...
im having a problem while solving a RSA problem, so i have python script to create a RSA key and cipher, from that i have n, invp, and invq. so my question is possible to decrypt the message only with n, invp, and invq. Here's the code ``` from Crypto.PublicKey import RSA from Crypto.Cipher import PKCS1_OAEP m...
I've been reading up on different authentication protocols recently while I implemented the sign-in functionality for my website. Many of the suggested methods password-based authentication seem to either rely on non-quantum safe maths (eg. ECC, DH, SRP), or be really complex (eg. aPAKEs), or offer slightly reduced sec...
Asymetric cryptosystems like RSA-OAEP allow packing data into the asymetric primitive to cut down on overhead. For large enough messages, this can cut overhead to some number of randomisation+verification/MAC bits. Is there an efficient way to do something similar for elliptic curve based cryptosystems? One simple o...
Can the overhead of an ECDH hydrid cryptosystem be reduced by encoding data in ephemeral key?
I am designing a Hybrid Key exchange library using x25519 and Kyber, and the scheme I have in mind is as follows: Alice sending a file/message to Bob: Bob's Kyber public key + Random Data -> KEM => ciphertext, Kyber shared secret Bob's Ed25519 public key + Alice's Ed25519 Secret Key + Kyber ciphertext ->...
Is it safe to derive Ed25519 and Kyber private keys from the same seed?
Given a composite number $n=pq$ of primes $p$ and $q$, a secret random element $r$, and two random elements $x_1$ and $x_2$. An adversary is given two elements, $y_1= x_1^r \mod n$ and $y_2=x_2^r \mod n$, and its goal is to correctly match $x_1$ with $y_1$ and $x_2$ with $y_2$, with probability $\frac{1}{2}+\epsilon(n)...
May I ask that for BGV encryptions, if I want to encrypt the same plaintext with two different keys, then are these two encryptions indistinguishable? <br> I.e., $c_1$ = Enc($sk_1, m$) and $c_2$ = Enc($sk_2, m$), is $c_1$ and $c_2$ indistinguishable?<br> Furthermore, if this is, are there some papers that prove this...
When taking AES for example, the number of rounds increases as the key size increases. This is done in order to adequately diffuse key bits into the state of the cipher. Suppose you replace the AES key schedule with SHAKE (SHA-3). Would such round expansion be necessary? Since every bit of the key would influe...
Can the requirement to increase rounds with key size be bypassed?
‌Dear community, I have a technical question regarding the use of the addresses in section 4.2 of FIPS 205, the NIST standard of SPHINCS+. Taking for example the tree address, we want to copy an integer in big-endian byte type in the words 1,2 and 3 of the address (starting at 0). Hence, the lowest byte of my inte...
How to write information in the 32-byte addresses of SLH-DSA?
I'm trying to understand the hardness of problems (e.g. in cryptography) from the point of view of complexity theory. For the complexity class NP, [Wikipedia](https://en.wikipedia.org/wiki/NP_(complexity)) (11/2023) says > - NP is the set of decision problems solvable in polynomial time by a nondeterministic Turing ...
Given a composite number $n=pq$ of primes $p$ and $q$, a secret random element $r$, and two public random elements $x_1$ and $x_2$. An adversary is given two elements, $y_1= x_1^r \mod n$ and $y_2=x_2^r \mod n$, and its goal is to correctly match $x_1$ with $y_1$ and $x_2$ with $y_2$, with probability $\frac{1}{2}+\eps...
Can the overhead of an ECDH hybrid cryptosystem be reduced by encoding data in ephemeral key?
I'm trying to understand the hardness of problems (e.g. in cryptography) from the point of view of complexity theory. For the complexity class NP, [Wikipedia](https://en.wikipedia.org/wiki/NP_(complexity)) (11/2023) says > - NP is the set of decision problems *solvable* in polynomial time by a nondeterministic Turin...
> Am I right? Yes, you are. You encode the value as a 12 byte bigendian value. The fact that the upper bytes will always be zero (because tree addresses never get that large) is not important to the encoding process. In fact, one way to do this is always set the first 4 bytes to all zero, and then encode the vl...
Can someone please explain the definition of differential privacy. Here is the one which I see and am unable to understand it: [![enter image description here][1]][1] Its from this [paper][2]. I do not understand the use of $S$ here and also what does coin tosses of $\kappa$ mean here? Is it that the probability is ov...
## Motivation I have a use case that involves sending small (25-50 byte) encrypted messages over a very constrained channel. Many senders send public key encrypted messages to other receivers. Anonymity (eavesdropper can't tell which sender sent a message) is the reason for using asymmetric crypto. I'd like a cry...
Can the byte overhead of an ECDH based hybrid cryptosystem be reduced by encoding data in ephemeral key?
We learned that length padding was used in Merkle–Damgård where after padding with zeros another block is added that contains the initial length of the input. This is supposed to prevent same hash values for the different inputs $x \ne x0..0$. Then again for Keccak we learned it is possible to use simple padding (e...
> **Question**: How long shall the challenge be? If the challenge is too small, it repeats in a short amount of time. Are there any common methods that are "good-practice" in order to determine a suitable length? TL;DR: If humans aren't directly involved in the protocol, choose a random 256-bit challenge, and you sh...
**‘Provable security’ just means _there is a theorem_.** It is a [misleading term of art][koblitz-menezes2007anotherlook] that should be carefully restricted to the literature if used at all, because it gives people false confidence: a system can have ‘provable security’ in the sense that there is a theorem, and could...
I'm exploring the secp256k1 elliptic curve in the context of cryptography and encountered the concept of **Point negation.** I would appreciate clarification on what point negation means in this context. As I understand it, given a point $P = (x, y)$ on the secp256k1 curve, the negation of this point is represented ...
I have a question regarding the operations performed on an elliptic curve, specifically related to point doubling and point addition. I am trying to understand whether it is possible to determine the order in which these calculations were performed in order to obtain the x and y values of a public key. To provide so...
In the ElGamal cipher, the key generation algorithm needs to _randomly_ sample a generator g and test whether g is a safe generator or not each time. I wonder whether we can use a fixed safe generator for all users, which may reduce the time of key generation. Will this be safe?
Is ElGamal secure if we fix the generator for all users?
> I would like to know how to determine if a point $P = (x, y)$ is negated or not ? It appears you are asking: I was just given the value $(x, y)$, and I want to know if the person who gave it to make picked $(x, y)$, or whether they first picked $(x, -y)$ and then negated the $y$ value. The answer is: unless you...
In Kyber with $q=3329$, we end up with a field that das 256th roots of unity, when we apply the chinese remainder theorem (CRT) for such a field, it may look like, according to a post [here][1]: $$\mathbb{F}_{3329}[x]/(x^{256}+1)\cong\prod_{i=0}^{255}\mathbb{F}_{3329}[x]/(x^2-\zeta^{2i+1}),$$ My question is, why ...
I want to find a hash collision for Blake2 with 32 bit digest length. How would you do that? is there another option than just bruteforce?
I want to find a hash collision for Blake2 with 32 bit digest length such that i have 2 messages that produce an identical hash digest. How would you do that? is there another option than just bruteforce? I tried brute forcing but that doesn't seem to work out nicely since the hash space is already quite large with ...
I have read so many papers and posts about lattice attacks on **ECDSA** but none of them used an example of different **MSB** values for k but instead they all used fixed **MSB**. So here i am trying to understand it better, I have 3 nonce (k1,k2 and k3) with their distinct **MSB** but i do not know how to place them ...
Where do we put known bits of nonce when performing lattice attack on ECDSA?
The encryption oracle only allows you to encrypt a custom message $m$ or the secret message $m_s$. In both cases it asks you to choose a public exponent $e>16$. Of course, $n$, is not available. If I had multiple queries, the first step should be to ask the oracle to encrypt two custom messages with the same exponen...
In my previous understanding, if a RAM program requires $T$ read/write operations to memory during its execution, then the runtime of this RAM program is $T$. However, as I have read some literature, I have realized that my understanding may not be correct. For instance, there is a paper mentioning a $T$-time RAM pr...
What exactly is the RAM program runtime?
As the director of a privacy-preserving startup venturing into *Multi-Party Computation (MPC)* protocol development, we are faced with the challenge of finding the most suitable business model. Our potential clients emphasize the requirement of not sharing their data outside their network. Subscription-based pricing...
Assume that the same message is encrypted using two different keys within the [BGV encryption scheme](https://eprint.iacr.org/2011/277.pdf). Can we assume that the resulting ciphertext are indistinguishable? I.e., given $c_1 = \text{Enc}(sk_1, m)$ and $c_2 = \text{Enc}(sk_2, m)$, are $c_1$ and $c_2$ indistinguishabl...
Is BGV encryption using different secret keys indistinguishable?
**Definitions:** - In the **pre-image attack**, given a hash function $H$ and a hash value $h$, we try to find $x$ such that $h = H(x)$. The $x$ need not be the original input value used to calculate the hash $h$. - In the **second preimage attack ( weak collison)**; we are given $H,x,h$ with $h = H(x)$ and we ne...
This is a question that it is easy for you to answer with high accuracy. You did not disclose the nature of the input / output data, the computation, or chosen MPC scheme, which rather complicates matters when random internet strangers attempt to answer with high accuracy. > how can we accurately estimate th...
In my previous understanding, if a RAM program requires $T$ read/write operations to memory during its execution, then the runtime of this RAM program is $T$. However, as I have read some literature, I have realized that my understanding may not be correct. For instance, there is a [paper][1] mentioning a $T$-time R...
In 2004 paper, [Rogaway and Shrimpton gave reference][1] to Merkle's paper - 1998 : [One Way Hash Functions and DES][2] and they Merkle's definitions simply as > Contemporaneously, Merkle [10] describes notions of hash-function security: **weak collision resistance** and **strong collision resistance**, which...
Are the 64-byte curve secp256k ECDSA signatures distinguishable from random data? i.e. Given a random private key and random data, will there be patterns? Is there a proof or reasoning for this?
Are curve secp256k ECDSA signatures distinguishable from random data?
In the NTRU cryptosystem, we can use a randomly generated polynomial f that is inversible under modulo p and q to encrypt and decrypt our plaintext. While studying this system, I attempted to bruteforce the value of f given a fixed g and a known plaintext for small parameters, and found that N total values of f were ob...
Are the 64-byte curve secp256k ECDSA signatures distinguishable from random data? I.e. Given a random private key and random data, will there be patterns? Is there a proof or reasoning for this?
If I have 256 bits of handwavium "perfectly random data" and I hash these 256 bits of data with a secure hash function (possibly SHA-256). Could the resulting hash be considered "perfectly random data" as well? I am assuming the answer is "no", but don't know why. What information / keywords would I use to find o...
Why cant you use randomness to seed more randomness?
> Why cant you use randomness to seed more randomness? Obviously you can, that's what any (Cryptographically Secure) Pseudo Random Number Generator or (CS)PRNG does after all. > Could the resulting hash be considered "perfectly random data" as well? I am assuming the answer is "no", but don't know why. "Perfec...
We know that the standard encoding of points of an elliptic curve is not uniformly random since they must satisfy the curve equation. In another look, we don't have $p^2$ points. In ECDSA, the $r$ is calculated as $r = x_1 \bmod n$ where $x_1 = x([k]G)$. Therefore the $r$ is not uniform random, though finding a dist...
Reformulating slightly (mostly, replacing _given_ with _unknown_): > Are the 64-byte [ECDSA][1] signatures for curve secp256k1 distinguishable from random data, for unknown random key pair and message? **Yes**, with significant advantage. When we talk of "64-byte", that's without ASN.1 wrapping. For a valid sig...
Are the 64-byte curve secp256k1 ECDSA signatures distinguishable from random data? I.e. Given a random private key and random data, will there be patterns? Is there a proof or reasoning for this?
Are curve secp256k1 ECDSA signatures distinguishable from random data?
Reformulating slightly†: > Are the 64-byte [ECDSA][1] signatures for curve secp256k1 distinguishable from random data, for unknown random key pair and message? **Yes**, with significant advantage. When we talk of "64-byte", that's without ASN.1 wrapping. For a valid signature with private key $d$, the first 32 ...
> Why cant you use randomness to seed more randomness? Obviously you can, that's what any (Cryptographically Secure) Pseudo Random Number Generator or (CS)PRNG does after all. > Could the resulting hash be considered "perfectly random data" as well? I am assuming the answer is "no", but don't know why. "Perfec...
Reformulating slightly†: > Can we distinguish from 64-byte of random data an [ECDSA][1] signature (without [ASN.1][2] wrapping) for curve secp256k1, unknown random key pair and message? **Yes**, with significant advantage. For a valid signature with private key $d$, the first 32 bytes code (per big-endian conve...
I am trying to understand Craig Gentry's initial construction for Fully Homomorphic Encryption described in *[Fully Homomorphic Encryption Using Ideal Lattices][1]*. I'm having a hard time understanding the details of the scheme proposed is. To my aid I have have compared a pair of surveys on the topic to each other, [...
So I understand how one can use Fiat-Shamir to turn a HVZK sigma protocol into a non-interactive zk protocol in the random oracle model. My problem though is I don't understand why is this useful. If I wanted to use a NIZK in something and I choose a protocol based on Fiat-Shamir, this would mean I have to choose a ...
> Why cant you use randomness to seed more randomness? Obviously you can, that's what any (Cryptographically Secure) Pseudo Random Number Generator or (CS)PRNG does after all. > Could the resulting hash be considered "perfectly random data" as well? I am assuming the answer is "no", but don't know why. "Perfec...
I'm relatively new to this topic, and I have a question that might seem basic. I appreciate your patience. In most PSI schemes(2 party or multi party),the intersection result is always output by only one of the parties.If this party modify the final result,the scheme is obviously unsafe.I guess there is some assumpti...
How to avoid sender modify the final output in private set intersection under malicious setting?
Reformulating slightly†: > Can we distinguish from 64-byte of random data an [ECDSA][1] signature (without [ASN.1][2] wrapping) for curve secp256k1, unknown random key pair and message? **Yes**, with significant advantage. For a valid signature with private key $d$, the first 32 bytes code (per big-endian conve...