instruction
stringlengths
15
30k
[secp256k1][1] is an elliptic curve $E$ over a prime field $\mathbb F_p$, of equation $y^2\equiv x^3+b\pmod p$, with prime order $n$. I noticed† that the different curve $E'$ over the prime field $\mathbb F_n$ with the same equation has order $p$. Notice how the roles of $p$ and $n$ are reversed in $E$ and $E'$. ...
[secp256k1][1] is an elliptic curve $E$ over a prime field $\mathbb F_p$, of equation $y^2\equiv x^3+b\pmod p$, with prime order $n$. I noticed† that the different curve $E'$ over the prime field $\mathbb F_n$ with the same equation has order $p$. The roles of $p$ and $n$ are reversed in $E$ and $E'$. That also h...
This is trivial if $\gcd(\ell, p - 1) = 1$, and I assume it's easy otherwise, but I won't try to remove that restriction. Recall Fermat's little theorem: $z^{p - 1} \equiv 1 \pmod p$. Let $\ell_{inv} = \ell^{-1} \pmod{p - 1}$, which exists as long as $\gcd(\ell, p - 1) = 1$. Then, $(z^\ell)^{\ell_{inv}} \equiv z^...
This is trivial if $\gcd(\ell, p - 1) = 1$, and I assume it's easy otherwise, but I won't try to remove that restriction. Recall Fermat's little theorem: $z^{p - 1} \equiv 1 \pmod p$. Let $\ell_{inv} = \ell^{-1} \pmod{p - 1}$, which exists as long as $\gcd(\ell, p - 1) = 1$. Then, $(z^\ell)^{\ell_{inv}} \equiv z^...
I'd ignore it. Maurer's test is a compression test. Does your file compress with pkzip, 7z or stronger stuff like PAQ8 or cmix? No? Does it pass ent (the most trustworthy test in my opinion)? Most randomness tests return a p-value, which should be uniform on [0,1) if the input file contains truly independent rand...
Naively, when one applies rounding to a uniform random value one anticipates that the change is uniformly distributed. In lattice-based cryptography, is there a formal notion or proof of equivalence between learning with rounding and learning with uniform error schemes? Secondly has anyone proposed a dynamic version...
I'm trying to implement impossible differential cryptanalysis on 3.5 round IDEA using [Miss in the Middle Attack on IDEA and Khufu][1] paper as a reference and I'm stuck on the first two steps of the attack: [![enter image description here][2]][2] In the paper the authors say that I should choose a structure of $...
how to build the plaintext structure for impossible differential cryptanaysis on IDEA?
I want to know if there's any algorithm to find the embedding degree of elliptical curve? for example SECP256K1 curve has embedding degree 19298681539552699237261830834781317975472927379845817397100860523586360249056. this number is so large that it can't be found using brute force. So there has to be an algorithm to f...
How to find the embedding degree of an elliptical curve?
I want to know if there's any algorithm to find the embedding degree of elliptic curve? for example SECP256K1 curve has embedding degree 19298681539552699237261830834781317975472927379845817397100860523586360249056. this number is so large that it can't be found using brute force. So there has to be an algorithm to fig...
How to find the embedding degree of an elliptic curve?
I'm working on implementing a digital signature algorithm for academic purposes using elliptic curves. I am familiar with equations of the form $$y^3 = x^2 + ax + b$$, but the paper I am reading for implementing point addition and doubling uses the equation $$Y^2Z = X^3 +aXZ^2 +bZ^3$$. I guess the $Z$ comes from rep...
I'm working on implementing a digital signature algorithm for academic purposes using elliptic curves. I am familiar with equations of the form $$y^3 = x^2 + ax + b$$, but the paper I am reading for implementing point addition and doubling uses the equation $$Y^2Z = X^3 +aXZ^2 +bZ^3$$. I guess the $Z$ comes from rep...
I'm working on implementing a digital signature algorithm for academic purposes using elliptic curves. I am familiar with equations of the form $$y^2 = x^3 + ax + b$$, but the paper I am reading for implementing point addition and doubling uses the equation $$Y^2Z = X^3 +aXZ^2 +bZ^3$$. I guess the $Z$ comes from rep...
LWE and Lattice-based cryptography: How to recover binary message $M$ from $(u, v)$ values?
In information theory, entropy is the measure of uncertainty associated with a random variable. In terms of Cryptography, entropy must be supplied by the cipher for injection into the plaintext of a message so as to neutralise the amount of structure that is present in the unsecure plaintext message. How it is measur...
I'm implementing a digital signature algorithm for academic purposes using elliptic curves. I am familiar with equations of the form $$y^2 = x^3 + ax + b$$, but the paper I am reading for implementing point addition and doubling uses the equation $$Y^2Z = X^3 +aXZ^2 +bZ^3$$. I guess the $Z$ comes from representing t...
I am studying about RP-algorithm from the book *Algebraic Aspects of Cryptography* by *Neal Koblitz*. The following example is given in the beginning which is the Probabilistic Primality Test. [![primality-test][1]][1] [1]: https://i.stack.imgur.com/2p345.jpg I understand the scheme of the algorithm b...
These days I found myself thinking about the implications of padding or not padding block cipher modes that act like additive stream ciphers (I meant **OFB**, **CTR**, **GCM** etc). Let's call additive modes. You know, people hooked on crypto tend to be I little bit paranoid... Well, at some point in my ruminations ...
A vigenere cipher is just a ceasar cipher (ROT13) based on a SECRET word from my understanding. Are there variations of a vigenere cipher that are similar? I want to create a new type of vigenere cipher where the SECRET is used 2-3 times. Once forward for encrypting it once, then a second time encrypting it twice with ...
Are ideal functions and leakage collections the terms of UC security? Why I often see them in a simulation-based proof under stand-alone model? Some papers use the definition in Lindell's *How to simulate it?* while defining ideal functions (sometimes with leakage collections), which really confuse me a lot!
Is there a non-deterministic encryption scheme that is vulnerable to a CPA? I got asked this in an interview and I answered with no but the interviewer said that my answer is wrong. Would somebody clarify if this is possible?
When could CPA work against non-deterministic encryption schemes?
I am a noob to cryptography in the sense that I have only little understanding as to how RSA encryption schemes work in practice. However I do understand the theoretical foundations of RSA cryptography and also Chaum's Blind Signature scheme as described in [the wikipedia article on RSA Blind Signatrures][1]. I did ...
On 6 March, Yi Lee sent over the NIST mailing list an announcement of their submitted paper that found a flaw in the original security proof for Dilithium. In their manuscript, they fix the proof on paper, and they also verified whole proof using EasyCrypt. URL: http://ia.cr/2023/246 In Section 3.2, paragraph "The ‘...
Are rejected Dilithium commitments secret?
Given two numbers $x_1$, $x_2$ and their respective binding numbers, $b_1$ and $b_2$, let's take their Pedersen Commitment to be $C(x_n, b_n)$ for all $n$. What is $C(x_1 * x_2, b_1 * b_2)$?
How to multiply the Pedersen Commitment of two numbers?
Given two numbers $x_1$, $x_2$ and their respective binding numbers, $b_1$ and $b_2$, let's take their Pedersen Commitment to be $C(x_n, b_n)$ $\forall n=1,2$. What is $C(x_1 * x_2, b_1 * b_2)$?
I want to encrypt Bluetooth Beacon data. I was wondering if having very little entropy in the clear text would make the key easier to guess? The maximum data length is 31 bytes An example example of the data (packed struct): where sequence monotonically increases, all other measurements have small variations betw...
I want to encrypt Bluetooth Beacon data. I was wondering if having very little entropy in the clear text would make the key easier to guess? The maximum data length is 31 bytes An example example of the data (packed struct): where sequence monotonically increases, all other measurements have small variations betw...
I would like to use JWT but one thing I'm still thinking is ¿what is the best length for the secret? If I'm using HS512 as signing method the secret should have a length of 512 bits as far as I understand and I imagine that 512 bits are 64 characters (of 1 byte) because secret is a string, as far as I understand. ...
I would like to use JWT but one thing I'm still thinking is ¿what is the best length for the secret? If I'm using HS512 as a signing method the secret should have a length of 512 bits as far as I understand and I imagine that 512 bits are 64 characters (of 1 byte) because the secret is a string, as far as I understa...
Given two field elements as input of **Arithmetic Circuit** (consists of adding gates and multiplicating gates only), how could I output the bigger one? Or, **how to place the gates** in order to distinguish which one is bigger (using Arithmetic Circuit)? Could you please describe the method in picture? In **Zero-kn...
How to compare two field elements in Arithmetic Circuit?
> *If I'm using HS512 as a signing method the secret should have a length of 512 bits as far as I understand and I imagine that 512 bits are 64 characters (of 1 byte) because the secret is a string, as far as I understand.* Correct. HS512 (terrible name) is using HMAC-512, and HMAC is has been defined to take keys t...
I want to encrypt Bluetooth Beacon data. I was wondering if having very little entropy in the clear text would make the key easier to guess? The maximum data length is 31 bytes An example of the data (packed struct): where sequence monotonically increases, all other measurements have small variations between read...
Several texts talk about malicious/dishonest verifiers in a zero knowledge interactive proof but none of them properly detail how a dishonest verifier can gain extra knowledge over a honest verifier using some example like Quadratic Residue Interactive proof or graph 3 colouring Interactive proof. I went over the proof...
How can a verifier be malicious or dishonest in a Zero Knowledge interactive proof?
How can a verifier benefit from being malicious or dishonest in a Zero Knowledge interactive proof?
I am making an implementation of Niels Ferguson's paper: [Single Term Off-Line Coins][1] in Python. In the Coin withdrawal protocol, in the last steps, Alice checks that the signatures she received are correct. She checks if she needs to adjust the signatures by making corrections. When I run the program I get mos...
I'm having troubles in interpreting the output of the SUPERCOP benchmarks of some digital signature schemes. Precisely, I don't understand how to read the number of cycles for the key generation. This should be found in the line of the SUPERCOP output file with the keyword "keypair_cycles". However, I find three su...
I was reading [this][1] paper, where I came across the following statement: > We consider the problem of unbounded MPC with security against **semi-malicious adversaries** in the dishonest majority setting. In our communication model, parties publish their first message through a broadcast channel which is immediat...
What does a semi-malicious setting mean in MPC? How is it different from malicious or semi-honest setting?
I want to encrypt Bluetooth Beacon data. I was wondering if having very little entropy in the clear text would make the key easier to guess? The maximum data length is 31 bytes An example of the data (packed struct): where sequence monotonically increases, all other measurements have small variations between read...
I was reading [this][1] paper, where I came across the following statement on Pg 4 under the **Homomorphic Commitments**: > A witness encryption scheme, associated with a NP language, consists of an encryption and a decryption algorithm: Anyone can encrypt their message **µ** under an NP instance and the decrypti...
How is a message $\mu$ encrypted in a witness encryption scheme below? What does C(x) = 1 mean below?
In [SMhasher][1], it seems that data (keys) are read one by one sequentialy, and not splited and: MiB/sec: The average of the Bulk key speed test for alignments 0-7 with 262144-byte keys. The higher the better. /\ This is written in its README. The author said that are the output of hash functions that is ...
Why do the hash functions tested by SMhasher appear to be exceptionally fast?
Several texts talk about malicious/dishonest verifiers in a zero-knowledge interactive proof but none of them properly detail how a dishonest verifier can gain extra knowledge over an honest verifier using some examples like "*Quadratic Residue Interactive proof*" or "*graph 3 colouring Interactive proof*". I went o...
We have the RSA function: $c = m^e (mod n)$. I would like to know the proof that there is not an $m_1$ and an $m_2$ message that produce the same $c$. My thoughts: We know that $m \le n$, so $m_1 \ncong m_2 (mod n)$. We also know that if $a \cong b (mod n)$, then $a^k \cong b^k (mod n)$. So if $m_1 \ncong m_2...
What is the proof that the RSA is collision-free?
Let $\mathbb{F}_q$ be a finite field of odd characteristic. I know that a constant-time implementation of the square root extraction $\sqrt{\cdot} \in \mathbb{F}_q$ is used in the context of hashing to elliptic curves (see Appendix I of [the draft][1]). Are you aware of other cryptographic contexts in which a squar...
Are you aware of cryptographic contexts (e.g., post-quantum) in which a square root $\sqrt{\cdot}$ must be computed in constant time?
Bob has two detectors + and x. You can see it in the picture I sent. Alice sends a photon with vertical polarization and Bob uses the + detector and the detector is detecting Alice's photon. Bob's + detector detects when the polarization of the photon from Alice is either vertical or horizontal. (because it is + de...
An adversary is able to insert a random string (which he does not control: he can only randomly generate it and insert it). The random string is parsed by the victim as an ECDSA public key. This public key is used to verify a signature (the adversary can insert whatever signature he chooses). Is this a vulnerability? E...
I'm implementing impossible differential cryptanalysis on AES and I've started with implementing it on mini-AES to fully understand the process using [R.Phan's paper][1] as a reference. But I don't understand the initial pairs preperation step: [![!\[enter image description here][2]][2] In the paper the author s...
Where did the number of initial plaintexts required for impossible cryptanalysis on Mini-AES came from?
If understood right, CMAC is not quantum-safe because it relies on AES-128 (which isn't considered as quantum-safe), while HMAC is, because it relies on SHA3 (which is considered as quantum-safe). Did I understand this right?
> I'm trying to implement the attack on 3.5-Round IDEA and I stumbled with the initial pair generation step because they suggest generating $2^{32}$ pairs, which would normally be executed on a mainframe but I'm trying to implement it on my laptop (8GB RAM). We know out of the top of our head that $2^{32}$ is 4 bill...
I'm having trouble understanding how time complexity of trial division is exponential. If it takes √n tries to factor n in the worst case scenario then time complexity is O(√n), which I thought would mean that the number of operations grows slower than the increase in the number of inputs. So how would that be ineffi...
I'm having trouble understanding how time complexity of trial division is exponential. If it takes $\sqrt n$ tries to factor $n$ in the worst case scenario then time complexity is $\mathcal{O}(\sqrt n)$, which I thought would mean that the number of operations grows slower than the increase in the number of inputs...
I was recently trying to perform a AES-128 CTR Encryption and Decryption. I had a observation that if a AES-CTR encrypted value is encrypted again (with same key and Iv) it results in the plain text that was in encrypted in first place. Just want to the reason behind this and does any other AES scheme support thi...
Let $\mathbb{F}_q$ be a finite field of odd characteristic. I know that a constant-time implementation of the square root extraction $\sqrt{\cdot} \in \mathbb{F}_q$ is used in the context of hashing to elliptic curves (see Appendix I of [the draft][1]). Are you aware of other cryptographic contexts in which a squar...
Given two field elements as input of **Arithmetic Circuit** (consists of adding gates and multiplicating gates only), how could I output the bigger one? Or, **how to place the gates** in order to distinguish which one is bigger (using Arithmetic Circuit)? Could you please describe the method in picture? In **Zero-kn...
One of the methods to break a ECDLP is Pollard's rho algorithm. When ECDLP is defined over a finite field $F_p$, and given a relation $S=w.T$, where S and T are a member of $F_p$. Then ECDLP is to find w. The algorithm is supposed to take a time $O(\sqrt p)$. The authors say its exponential or subexponential, at ...
I am using Montgomery ladder with Montgomery curve `b*y2=x3+a*x2+x` using XZ coordinates and I recovered the `X` value using `X3=X1/Z1` but I don't know how to recover the `Y` coordinates? for Double and add ladder I using this : ``` A = X2+Z2 AA = A2 B = X2-Z2 BB = B2 E = AA-BB...
As detailed in the paper [Statistical test suite for random and pseudorandom number generators for cryptographic applications](https://tsapps.nist.gov/publication/get_pdf.cfm?pub_id=906762) by NIST, the first test is given as a basic significance test, it uses a bit sum and calculates the p-value and test statistic. Bu...
Is it insecure to sign the plaintext 0 with ElGamal signature algorithm? Can this leak the private key, give the possibility to forge other signatures or does provide any other attack vector?
Is it insecure to sign the value 0 with ElGamal?
[One experienced user of this forum said][1]: "The key is the input of the hash function to build up a fast internal hash table. The key is hashed again to perform the lookup.". If I hash a data such as a 262144-bytes seed (as [SMhasher][2] does) is passed through a hash function to build up a fast internal hash tab...
Once a secure hash function built up a (fast) internal hash table, can data to be hashed be different from the data inserted when doing the lookups?
> Is it insecure to sign the plaintext 0 with ElGamal signature algorithm? It is insecure to verify the plaintext that hashes to 0 with the ElGamal signature algorithm, because anyone can generate such a signature with only the public key. The validation requirement is: $$g^{H(m)} = pk^r r^s$$ (where $g$ is...
[One experienced user of this forum said][1]: "The key is the input of the hash function to build up a fast internal hash table. The key is hashed again to perform the lookup.". If I hash a data such as a 262144-bytes seed (as [SMhasher][2] does) is passed through a hash function to build up a fast internal hash tab...
When I try to generate decimal numbers in the range 0-18446744073709551616 using a hash function I always get big numbers like this: $ A=$(date | b2sum -l 64 | awk '{ print $1 }'); echo $(calc 0x$A) 16324260068905187599 $ A=$(date | b2sum -l 64 | awk '{ print $1 }'); echo $(calc 0x$A) 550052511392...
Is there a way to make a pseudorandom function to generate truly decimal numbers? Is there PRFs made specifically for this?
When I try to generate decimal numbers in the range 0-18446744073709551616 using a hash function I always get big numbers like this: $ A=$(date | b2sum -l 64 | awk '{ print $1 }'); echo $(calc 0x$A) 16324260068905187599 $ A=$(date | b2sum -l 64 | awk '{ print $1 }'); echo $(calc 0x$A) 550052511392...
Is there a way to make a pseudorandom function to generate decimal numbers in a specified range and not only producing big ones?
I have been trying to implement my own SHA3 256 function in python to try and learn and understand how it works. I have been comparing my hashes with an online sha3 tool found here <https://emn178.github.io/online-tools/sha3_256.html> and the test files on the NIST website found here <https://csrc.nist.gov/projects/cry...
In Crystal Kyber [specification](https://pq-crystals.org/kyber/data/kyber-specification-round3-20210804.pdf), page no10, there are 3 algorithms namely **KYBER.CCAKEM** for making the _CPA-secure_ Kyber into _CCA-secure_ one. Q1: How is the shared key _**K**_ being generated in **KYBER.CCAKEM.Enc** & **KYBER.CCAKEM....
Due to protocol limitations, I can put in 24 bytes of data only for tx (excluding headers), if I use AES_GCM for encrypting my data, I understand I don't need to worry about padding. So for instance, if my data is of 22 bytes, I would be getting a 22 bytes encrypted output. So, I had zero-ed in on AES-GCM or AES-CTR....
In garbled circuits, functions need to be converted into boolean circuits. So is this Boolean circuit a combinational logic, i.e. a directed acyclic graph, satisfying the topological order? If there is some `loop` structure in the function that we cannot transform into a circuit, it means that the garbled circuit pr...
I'm implementing impossible differential cryptanalysis on AES and I've started with implementing it on mini-AES to fully understand the process using [R.Phan's paper][1] as a reference. But I don't understand the initial pairs preperation step: [![!\[first step of impossible differential cryptanalysis on Mini-AES][...
I am very unsure why there is so much push to use small exponents. A lot of people is stating that 65537 is large, how it is large? It is small. A lot of people is stating that there are more important security concerns than small exponents, while it might be true I don't see how it should convince me to use small expo...
I am working with hardware that can only encrypt with AES. The problem with this is that the message must be publicly verifiable, without the encoding key being exposed. This is the textbook use-case for asymmetrical keys, yet the hardware does not support this. I cant come up with a method myself where a message is en...
Is it possible to generate a read-only key for a symmetrical encryption (AES)?
I am very unsure why there is so much push to use small exponents. A lot of people is stating that 65537 is large, how it is large? It is small, in fact EXTREMELY small. A lot of people is stating that there are more important security concerns than small exponents, while it might be true I don't see how it should conv...
I am very unsure why there is so much push to use small exponents. A lot of people is stating that 65537 is large, how it is large? It is small, in fact EXTREMELY small. A lot of people is stating that there are more important security concerns than small exponents, while it might be true I don't see how it should conv...
I recently read a [paper][1] that proposed a matrix-DDH which is a matrix variant of DDH assumption. The brief definition is follows: Let $G$ be a group of prime order $q$. Then, the matrix-DDH says that it is hard to distinguish between two distributions: $\{[A], [A\cdot w] \} \approx \{[A], [u], u\leftarrow \tex...
Is the composite order matrix-DDH secure?
I'd ignore it. Maurer's test is a compression test. Does your file compress with pkzip, 7z or stronger stuff like PAQ8 or cmix? No? Does it pass ent (the most trustworthy test in my opinion)? Most randomness tests return a p-value, which should be uniform on [0,1) if the input file contains truly independent rand...
We have to think about the cost of realizing a specific kind of [circuit complexity][1]. We can say that a general program executing some kind of interactive command can't be converted in a feasible circuit: think about a `main() { while(true) {} }`. An interesting discussion can be read here https://crypto.sta...
There are basically four PKCS#8 formats: the unencrypted "inner" format, which is what you displayed first, then there is the binary encrypted PKCS#8 format - PEM encoded or not - and there is the SSLeay format which has the encryption details in the PEM/text instead of in the binary DER. What you've shown is the [*inn...
Cant you look at the algorithm used to encrypt and find the private key from the public key that way? As an example, here's a simple python algorithm that encrypts an input: rnd.seed(int(pasc)) return [(tran_ltn[content[i]] + rnd.randint(400, 1400)) for i in range(len(content))] This is obviously symmetr...
How is asymmetric encryption possible if you need a passcode in order to encrypt something?
> Cant you look at the algorithm used to encrypt and find the private key from the public key that way? Welcome to the wonderful (and nonintuitive) world of public key cryptography. In this world, we can generate a 'public key' and a 'private key'; with the 'public key', we can encrypt a message that can only be ...
``` Let G be a pseudorandom generator with expansion factor l(n) > 2n. In each of the following cases, say whether G′ is necessarily a pseudorandom generator. If yes, give a proof; if not, show a counterexample. (a) Define G'(s) = G(s1 ···s⌊n/2⌋), where s = s1 ···sn. ``` I thought that it's not a PRG, by the coun...
``` Let G be a pseudorandom generator with expansion factor l(n) > 2n. In each of the following cases, say whether G′ is necessarily a pseudorandom generator. If yes, give a proof; if not, show a counterexample. (a) Define G'(s) = G(s1 ···s⌊n/2⌋), where s = s1 ···sn. ``` I thought that it's not a PRG, by the coun...
Why: G'(s) = G(s1 ···s⌊n/2⌋), where s = s1 ···sn. is PRG?