instruction
stringlengths
15
30k
Just to add some further detail to [kodlu's excellent answer](https://crypto.stackexchange.com/a/100367): To share some secret data using [Shamir's secret sharing](https://en.wikipedia.org/wiki/Shamir%27s_Secret_Sharing) over the finite field $\mathrm{GF}(k)$, you first need to encode that data as $m ≥ 1$ elements o...
Generally, in cryptography, the security of a scheme/protocol $\Pi$ relying on a hard problem $P$ is demonstrated by constructing a reduction $\mathcal{B}$ that takes as input an instance of the problem $P$ and then interacts in a black-box manner with an adversary $\mathcal{A}$ that can "break" the security of $\Pi$ t...
Can the runtime of a reduction help an adversary distinguish the reduction from the adversary's challenger?
Let $f(x)\in\mathbb{Z}$, let $N$ be an integer with known factorization into prime elements. I want to know why it is easy to solve efficiently the equation $f(x)=0\ mod\ N$.???
Solving modular polynomial equation modulo known factorization of a modulus is easy?
Let $f(x)\in\mathbb{Z}[x]$, let $N$ be an integer with known factorization into prime elements. I want to know why it is easy to solve efficiently the equation $f(x)=0\ mod\ N$.???
I want to encrypt numeric identifiers into ciphertexts that are deterministic and not too long. I am considering AES-128 in ECB mode to encrypt 64-bit integers. How should I pad the 64-bit integers, and specifically, how should I verify the padding? When encrypting, I could encrypt a block where the first 64 bits ar...
I've got a question regarding the signing algorithm on elliptic curves (EdDSA). In ed25519 signature scheme there is no nonce $k$, instead every message has its own different hash. From what I know the $s$ value of the signature is computed as following: $$s = r_\mathrm{val} + h(r_\mathrm{val} * G \mathbin\| \mathrm...
> I want to encrypt numeric identifiers into ciphertexts that are deterministic and not too long. I am considering AES-128 in ECB mode to encrypt 64-bit integers. You are not considering ECB mode as you are only encrypting one block. You are considering using the block cipher directly. This is important as a block c...
> I want to encrypt numeric identifiers into ciphertexts that are deterministic and not too long. I am considering AES-128 in ECB mode to encrypt 64-bit integers. You are not considering ECB mode as you are only encrypting one block. You are considering using the block cipher directly. This is important as a block c...
> I want to encrypt numeric identifiers into ciphertexts that are deterministic and not too long. I am considering AES-128 in ECB mode to encrypt 64-bit integers. You are not considering ECB mode as you are only encrypting one block. You are considering using the block cipher directly. This is important as a block c...
> Is there any LMS security proof besides the one mentioned in RFC 8554? The RFC actually references several articles. A relevant one is Jonathan Katz's [_Analysis of a Proposed Hash-Based Signature Standard_][1], in [proceedings of SSR 2016][2]. But the standard proposal has then changed and it's necessary ...
> Is there any LMS security proof besides the one mentioned in RFC 8554? The RFC actually references several articles. A relevant one is Jonathan Katz's [_Analysis of a Proposed Hash-Based Signature Standard_][1], in [proceedings of SSR 2016][2]. But the standard proposal has then changed and it's necessary ...
The Schnorr signature scheme is a randomized signature scheme with appendix. The signature is $3t$-bit for conjectured $t$-bit security in a chosen-messages setup, with at most $2^{t/2}$ queries to a signer; a description faithful to the reference paper is later in the question. It is simple, and 25% more compact th...
There is an algorithm called EIG (Extra Information Gathering) protocol for Byzantine agreement of a bit over $n$ parties. The protocol has $t+1$ rounds. Can anyone help me understand how the time complexity of the algorithm is $\mathcal{O}(n^{t+1})$?
RSA signatures are implemented by encrypting the padded hash with the private key. Why not take the approach RSA-KEM is using by removing the padding entirely and replacing the hash with a XOF that would produce the m value in range [1, n-1]. XOF is just a hash with arbitrary output length. Exactly what's need to...
RSA signatures are implemented by encrypting the padded hash with the private key. Why not take the approach RSA-KEM is using by removing the padding entirely and replacing the hash with a XOF that would produce the m value in range [1, n-1]. XOF is just a hash with arbitrary output length. Exactly what's needed ...
RSA signatures are implemented by encrypting the padded hash with the private key. Why not take the approach RSA-KEM is using by removing the padding entirely and replacing the hash with a XOF that would produce the m value in range [1, n-1]. XOF is just a hash with arbitrary output length. Why hasn't it been ...
> Why hasn't it been done this way? It has been done but is sadly not a widely deployed scheme. This scheme is sometimes called [RSA-FDH][1]: RSA full domain hash. It's a general construction that works with any trapdoor one-way permutation, but so far, we don't have anything as practical as RSA). Here's [an exam...
Two remarks on the question's > RSA signatures are implemented by encrypting the padded hash with the private key - Proper terminology is not "encrypt with the private key", it's "apply the private-key textbook RSA permutation". Public key _encryption_ is always with the _public_ key, because the goal of encryption...
Two remarks on the question's > RSA signatures are implemented by encrypting the padded hash with the private key - Proper terminology is not "encrypt with the private key", it's "apply the private-key textbook RSA permutation". Public key _encryption_ is always with the _public_ key, because the goal of encryption...
> Why hasn't it been done this way? It has been "done" but is sadly not a widely deployed scheme. This scheme is sometimes called [RSA-FDH][1]: RSA full domain hash. It's a general construction that works with any trapdoor one-way permutation, but so far, we don't have anything as practical as RSA). Here's [an ex...
Two preliminary remarks on the question's > RSA signatures are implemented by encrypting the padded hash with the private key - The terminology "encrypt with the private key" is improper. That could be e.g. "apply the private-key textbook RSA permutation". At issue is that public key _encryption_ is always with the...
Let's suppose that $(G,D,E)$ is a secure encryption scheme, that is, for any polynomial $p(n)$ and any sequence of messages $\{a_{n}\},\;\{b_{n}\}$ of length $p(n)$ $E(k,a_{n})$ and $E(k,b_{n})$ are computationally indistinguishable. Is $E'(k,m) = E(k,m)\oplus m$ also a secure "encryption algorithm"? Sure, in some c...
Does XOR of message $m$ with $\mathrm{Enc}$ leak any information?
Consider the problem of finding two keys K1 and K2, such that for two distinct plaintexts P1 and P2, AES-CMAC(K1, P1) = AES-CMAC(K2, P2). Is this problem any easier than brute-forcing? If so, how much easier?
> If so, how much easier? Much easier. If you know the key, it is trivial to craft a message that CMACs to any specific value. Here's one approach: the output of CMAC (assuming that the last block $M$ is full) is: $$AES_k( PrevState \oplus k_1 \oplus M )$$ where $PrevState$ is the 16 byte state resulting f...
Consider the problem of finding two keys K1 and K2, such that for two distinct plaintexts P1 and P2, AES-CMAC(K1, P1) = AES-CMAC(K2, P2). Is this problem any easier than brute-forcing? If so, how much easier? Edit: plaintexts P1 and P2 are inputs to the problem and therefore they are fixed. We need to find the ke...
Two preliminary remarks on the question's > RSA signatures are implemented by encrypting the padded hash with the private key - The terminology "encrypt with the private key" is improper. That could be e.g. "apply the private-key textbook RSA permutation". At issue is that public key _encryption_ is always with the...
[This question][1] covers how to convert a projective point $(X_E, Y_E, Z_E)$ on a twisted Edwards curve to a projective point $(X_M, Y_M, Z_M)$ on a Montgomery Curve. Using XZ coordinates, there is no inversion needed as $X_M, Z_M$ can be directly obtained. Is it also possible to convert inversion-free the other wa...
> If so, how much easier? Much easier. If you know the key, it is trivial to craft a message that CMACs to any specific value. Here's one approach: the output of CMAC (assuming that the last block $M$ is full) is: $$AES_k( PrevState \oplus k_1 \oplus M )$$ where $PrevState$ is the 16 byte state resulting f...
I am learning zero knowledge protocols, and studied the GMW protocol for 3-Coloring (https://www.wisdom.weizmann.ac.il/~oded/X/gmw1j.pdf). A similar proof is also presented in Oded Goldreich's Foundations of Cryptography textbook. In this proof, the zero-knowledgeness property uses the hiding property of commitments. A...
I'm working on a scenario where a safe has a lock code '42', and this code needs to be shared securely among four individuals. The goal is to set up a system where at least two out of these four individuals must combine their individual pieces of information to recover the original code and open the safe. However, no s...
I accidentally overwrote a whole LUKS1 header without any backup. Since I still have the password with which the header was created - is there *any way* that this information helps me to reduce the range of potential master keys? I realize that the mapping from password to key still involves some randomization, so t...
Is it possible in LUKS1 to recreate a lost master key with the original password?
**TL;DR:** *Does anyone have a reference to a study, implementation of different algorithms or otherwise "truth" about which solution - a set of coordinate systems and algorithms that enables the fastest known Point multiplication for e.g. `X25519 (Curve25519)` (Montgomery curve) and `secp256k1` (Not Montgomery)?* I...
I have three binary arrays each one representing the pixels of an image. For example, if the picture size is 100 pixels X 100 pixels. Then the binary array would be 100*100*8*3 bits. These files are encrypted using the same cypher generated using LFSR. What do we know about the LFSR? 1- The polynomial is [1,0,0,1,0...
Older hash functions like SHA-256 and SHA-512 are vulnerable to the [length extension attack][1], which is problematic in the [context of a MAC][2]. There are several ways to prevent this: 1. [Use a newer hash function/XOF][3]. 2. [Use HMAC][4] or [suffix MAC][5] or [envelope MAC][6]. 3. [Truncate the output][7]. ...
Does the length extension attack apply to KDFs?
I have three binary arrays each one representing the pixels of an image. For example, if the picture size is 100 pixels X 100 pixels. Then the binary array would be 100×100×8×3 bits. These files are encrypted using the same cypher generated using LFSR. What do we know about the LFSR? 1. The polynomial is [1,0,0,1,0...
Many companies argue their gathering of private data with 'digitization' but I guess their real intention is most likely just gathering data. However I didn't came up with a simple idea without it. **Use case:** Digital ticket for an event or for transportation or similar. \ We have: a ticket Seller $S$, a ticket o...
Does 'digitization' of tickets always need private data? Or is it just data gathering? Any simple method without?
Slight modification of El Gamal signature scheme is not secure?
So I'm trying to understand why the montgomery arithmetic is fast and what the montgomery ladder is. With this [Post](https://crypto.stackexchange.com/questions/31969/using-montgomery-ladder-to-calculate-the-coordinates/75879#75879) i understood the basic affine arithmetic and Ladder. So this is not really faster...
Ok sort of long post incoming. Will go slow to make it as clear as possible I'm trying to build a C library for Elliptic Curve Arithmetic. Since the idea is to learn from the process, I decided to support many different coordinate systems. So far, I've implemented the group arithmetic for Affine and Projective coord...
Given AES-128 with a 128 bit key, but the key is chosen such that its only last 16 bit are random rest are 0, how can i exploit this to know the key being used, given i have access to oracle that gives cipher for any chosen plaintext. Brute force can be using all the key and checking cipher, can someone suggest a be...
AES CTR mode is insecure if key is not choosen properly, How?
The Argon2 [variable-length hash function][1] uses BLAKE2b directly if the user requests an output less than or equal to 64 bytes in length. However, if the user requests an output longer than this, each BLAKE2b-512 hash is truncated to become BLAKE2b-512-256. From [Wikipedia][2]: // If the requested digestSi...
Why does Argon2 truncate BLAKE2b outputs?
I first posted this question on StackOverflow but they told me it belongs here instead: https://stackoverflow.com/questions/77856486/in-symmetric-encryption-where-alice-and-bob-message-each-other-how-can-both-dec I am building a messaging app where one client can message another. There will be 2 clients - Alic...
In Symmetric encryption where Alice and Bob message each other, how can both decrypt the same data?
Given AES-128 with a 128 bit key, but the key is chosen such that its only last 16/32/48 bit are random rest are 0, how can i exploit this to know the key being used, given i have access to oracle that gives cipher for any chosen plaintext. Brute force can be using all the key and checking cipher, can someone sugges...
I first posted this question on StackOverflow but they told me it belongs here instead: https://stackoverflow.com/questions/77856486/in-symmetric-encryption-where-alice-and-bob-message-each-other-how-can-both-dec I am building a messaging app where one client can message another. There will be 2 clients - Alic...
Consider ed25519 signing ([RFC 8032](https://www.rfc-editor.org/rfc/rfc8032.html)). There, the private key is a 32-byte random value, and for signature generation, the 32-byte private key is first hashed and then the secret scalar and nonce are derived from the hash. Now, in threshold ed25519 ([RFC draft](https:/...
Threshold ed25519: How to export keys?
ed25519 is defined over curve `edwards25519` which has a large prime order subgroup and a small subgroup of order 8. During key generation, bit clamping is used to derive the private key scalar. In https://eprint.iacr.org/2020/823.pdf, Section 4.2.3, the authors describe the effect of clamping the lower order bits a...
ed25519: Scalar multiplication guaranteed to land in prime order subgroup?
Consider I have a secret $a \in Z_P^*$ and n public messages where $m_i=x_i -a \mod p-1$ and $x_i \in Z_p$ for i=1,2, ..., n. Given that $a$ and $x_i$ for $i=1,2, ..., n$ are secrets, can a PPT adversary get the value of $a$ or $x_i$?
Can I a PPT adversary get secret a from public messages $m_i=x_i-a \mod p-1$ for i=1,2, ...,n?
Consider I have a secret $a \in Z_P^*$ and n public messages where $m_i=x_i -a \mod p-1$ and $x_i \in Z_p$ for i=1,2, ..., n. Given that $a$ and $x_i$ for $i=1,2, ..., n$ are secrets, can a PPT adversary get the value of $a$ or $x_i$? I have an impression that it is difficult because this problem would be similar t...
Can a PPT adversary get secret a from public messages $m_i=x_i-a \mod p-1$ for i=1,2, ...,n?
Can a PPT adversary get secret $a$ from public messages $m_i=x_i-a \mod p-1$ for i=1,2, ...,n?
> can a PPT adversary get the value of $a$ or $x_i$? As written, no, the adversary has no information on any specific value of $a$ or $x_i$ (even if we assume a computationally unbounded adversary). This can be seen by the observation that if we set any of the unknowns to any specific value (two examples, if $a=4...
Consider I have a secret $a \in Z_P^*$ and n public messages where $m_i=x_i -a \mod p-1$ and $x_i \in Z_p$ for i=1,2, ..., n. Given that $a$ and $x_i$ for $i=1,2, ..., n$ are secrets, can a PPT adversary get the value of $a$ or $x_i$? I have an impression that it is difficult because this problem would be similar t...
> can a PPT adversary get the value of $a$ or $x_i$? As written, no, the adversary has no information on any specific value of $a$ or $x_i$ (even if we assume a computationally unbounded adversary, which is a far weaker assumption than a PPT adversary). This can be seen by the observation that if we set any of th...
Ronald Rivest designed MD2, MD4, MD5, and MD6, but what about MD3? Was it skipped? Or perhaps kept private and never publicly released?
What Happened to MD3 in Rivest's Series of Hash Functions?
I first posted this question on StackOverflow but they told me it belongs here instead: https://stackoverflow.com/questions/77856486/in-symmetric-encryption-where-alice-and-bob-message-each-other-how-can-both-dec I am building a messaging app where one client can message another. There will be 2 clients - Alic...
Ronald Rivest designed MD2, MD4, MD5, and MD6, but what about MD3? Was it skipped? Or perhaps kept private and never publicly released? (edit: found [a related question](https://crypto.stackexchange.com/questions/10093/is-the-first-version-of-the-message-digest-algorithm-by-ronald-rivest-publically/10565#10565))
I'm learning about encryption $(E)$ and decryption $(D)$ algorithms and am wondering what the following notation means, specifically the cartesian product for $E$ and $D$. - $k$ represents key, $P$ represents plaintext, $*$ represents some length $$k ∈ \{0,1\}^l$$ $$P ∈ \{0,1\}^m$$ $$E: \{0,1\}^l × \{0,1\}^m...
ECDSA can be instantiated with a variety of different elliptic curve groups. Two example curves are `secp256k1` and `edwards25519`. **Question:** Assume we have a secret key scalar generated for `secp256k1`. Is it OK to use this scalar for ECDSA over `edwards25519`?
ECDSA: Can we use the private key for a different curve?
In the MPC protocol based on the CRS model, the CRS can be generated by the simulator, and the simulator can obtain the backdoor information in the CRS (such as the private key $sk$ corresponding to the public key $pk$), thus simulating correctly. One measure I can take if I want to build a protocol in the plain model ...
Say there are 5 parties. 1 is the sender, and 4 are the receivers. The sender has a unique shared key with each receiver. k1 - between sender and receiver1 k2 - between sender and receiver2 k3 - between sender and receiver3 k4 - between sender and receiver4 Sender wants to send a encrypted message Em to all 4...
Say there are 5 parties. 1 is the sender, and 4 are the receivers. The sender has a unique shared key with each receiver. k1 - between sender and receiver1 k2 - between sender and receiver2 k3 - between sender and receiver3 k4 - between sender and receiver4 Sender wants to send a encrypted message Em to all 4...
To achieve approximately 128 bits of security, curve BLS12-381 uses 381 bits to encode the X coordinate. This means the size of a group element needs at least 48B to store/transmit. I am in a situation of trying to transmit a $G_1$ element in the IP packet level, where size is *very* critical, and 48B is somehow to...
BLS curve with a smaller modulus?
Exploring LWE Lattice crypto. Generate system matrix and secret key from cryptographic PRNG (Fortuna). Derive public key as |p> = A|s>, then add NBits of zero mean uniform noise to the public key elements, producing |p'>. Publish (|p'>, A). System matrix, A, has been defined with NRows = 128, matching a 128-bit elem...
Why the unreasonable effectiveness of simple brute-force attack on LWE Lattice Secret Key?
Are you comfortable with the connection between ElGamal encryption and Diffie-Hellman key agreement? ElGamal is just DHKA + OTP, just "repackaged" in a different way: * The ElGamal receiver's public key $X = g^x$ is like their DHKA message. * The first component of the ElGamal ciphertext $R = g^r$ is like the send...
Are you comfortable with the connection between ElGamal encryption and Diffie-Hellman key agreement? ElGamal is just DHKA + OTP, just "repackaged" in a different way: * The ElGamal receiver's public key $X = g^x$ is like their DHKA message. * The first component of the ElGamal ciphertext $R = g^r$ is like the send...
I'm wondering if the following scheme (or something similar) can exist: I want to encrypt a randomly generate a public key and secret key pair, $(pk, sk)$. I would like that $sk$ is encrypted some form of timelock encryption. My goals are: 1. Nobody should be able to compute $sk$ before the timelock expires 2. Any...
Keygen with timelock encryption so that the secret key is hidden from everyone?
## Context To learn about fully homomorphic encryption (FHE) and a new language I implemented the [Paillier](https://en.wikipedia.org/wiki/Paillier_cryptosystem) [cryptosystem](https://blog.openmined.org/the-paillier-cryptosystem/) in Go, and I thought it would be fun to apply it to the following interaction: > A cus...
I'm wondering if the following scheme (or something similar) can exist: I want to encrypt a randomly generate a public key and secret key pair, $(pk, sk)$. I would like that $sk$ is encrypted some form of timelock encryption. My goals are: 1. Nobody should be able to compute $sk$ before the timelock expires 2. Any...
## Context To learn about fully homomorphic encryption (FHE) and a new language I implemented the [Paillier](https://en.wikipedia.org/wiki/Paillier_cryptosystem) [cryptosystem](https://blog.openmined.org/the-paillier-cryptosystem/) in Go, and I thought it would be fun to apply it to the following interaction: > A cus...
Are you comfortable with the connection between ElGamal encryption and the Diffie-Hellman Key Agreement (DHKA)? ElGamal is just DHKA + OTP, just "repackaged" in a different way: * The ElGamal receiver's public key $X = g^x$ is like their DHKA message. * The first component of the ElGamal ciphertext $R = g^r$ is li...
## Context To learn about fully homomorphic encryption (FHE) and a new language I implemented the [Paillier](https://en.wikipedia.org/wiki/Paillier_cryptosystem) [cryptosystem](https://blog.openmined.org/the-paillier-cryptosystem/) in Go, and I thought it would be fun to apply it to the following interaction: > A cus...
I am new to cryptography by the way. I used "openssl rand -hex 256" i want to know if i am on the right path. I also need to use this "key" to encrypt a string and provide the cipher text?
Decrypting an AES-Encrypted Message Without the Key: A Cryptographic Challenge ------------------------------------------------------------------------ ---------- Summary: I am investigating the possibility of decrypting an AES-encrypted message when the encryption key is unknown and unguessable. My query i...
Given and encrypted message, is it theoretically possible to decrypt a message without the key or guessing it? If so, what methods could be used?
Mr. Bodewes gave the answer in the comment above: the key had somehow been compromised, an identical radio with active crypto had been captured, someone on the Ukrainian side was helping the Russians in real time, some kind of side-channel attack took place, or the Ukrainians somehow transmitted their fire mission in ...
I was reading "serious Cryptography" by Jean-Philippe Aumasson,and when coming to Feedback Shift Registers,I didn't understand what role Polynomials play in the feedback function, does it have to do with polynomial addition,which is simuar to XOR? Also i made a simple FSR,just to understand it better,so I wanted to ask...
What is a LFSR?
I was reading "serious Cryptography" by Jean-Philippe Aumasson,and when coming to Feedback Shift Registers,I didn't understand what role Polynomials play in the feedback function, does it have to do with polynomial addition,which is simuar to XOR? Also i made a simple FSR,just to understand it better,so I wanted to ask...
I was reading "serious Cryptography" by Jean-Philippe Aumasson,and when coming to Feedback Shift Registers,I didn't understand what role Polynomials play in the feedback function, does it have to do with polynomial addition,which is simuar to XOR? Also i made a simple FSR,just to understand it better,so I wanted to ask...
I was reading "serious Cryptography" by Jean-Philippe Aumasson,and when coming to Feedback Shift Registers,I didn't understand what role Polynomials play in the feedback function, does it have to do with polynomial addition,which is simuar to XOR? Also i made a simple FSR,just to understand it better,so I wanted to ask...
In the MPC protocol based on the common reference string (CRS) model, the CRS can be generated by the simulator, and the simulator can obtain the backdoor information in the CRS (such as the private key $sk$ corresponding to the public key $pk$), thus simulating correctly. One measure I can take if I want to build a p...
I read that in elliptical curve cryptography, the order of the Montgomery Curve is a multiple of 8, this mean that we can't have cofactor one curves which can be problematic in some corner cases because always has a cofactor bigger than 1. When the cofactor is not 1, it means that the subgroup of prime order is only a ...
I have an arbitrary array $X = (x_1, x_2, \dots, x_n)$ of disjoint integers. I want to determine whether there exists a prime number, $p$, and a value $y < p$ such that the sequence $$Y = \left(y_1, y_2, \dots, y_n\right), \quad y_i \equiv x_i y \pmod p$$ forms a superincreasing sequence. Furthermore, how can I find...