instruction
stringlengths
15
30k
How to generate a random integer in interval $[1, 2^{n-1}]$ from random integer in interval $[0, 2^{n-1}]$?
[Shamir's original paper][1] (PDF, 197kb) describing a threshold secret sharing scheme states: > To make this claim more precise, we use modular arithmetic instead of > real arithmetic. The set of integers modulo a prime number $p$ forms a > field in which interpolation is possible. Given an integer valued > data...
For a project I am working on, I have access to a CSPRNG that outputs a random integer in the interval $[0, 2^n-1]$ for any integer $n$ greater than 0. I cannot use the zero values, so I have my RNG code in a `while` loop that runs until the random number is `!==0`. For small $n$ it is very likely that the while loop w...
How to generate a random integer in interval $[1, 2^n-1]$ from random integer in interval $[0, 2^n-1]$?
Is there a big dataset containing RSA public $(n,e)$ and private keys $d$ and primes $p,q$ where $n = p.q$ ?
The answer depends upon the factorization of $p-1$. Let me explain the situation for two example cases: * Suppose $p-1=2p'$, where $p'$ is also prime. This is the best case (for the defender): it minimizes the information leakage. Then the best known attack that takes advantage of the reduced range of the exponen...
I was trying to understand RSA when I encountered the Euler Function. I do understand that :- `phi(P) where P is a prime is P-1` However it seems that for a number `N` such at `N=P*Q` where `P` and `Q` are non-equal primes :- `phi(P*Q) = (P-1)*(Q-1)` I'm having trouble understanding why that is so. Could so...
I was trying to understand RSA when I encountered the Euler Function. I do understand this: $\phi(P)$, where $P$ is a prime is $P-1$. However it seems that for a number $N$ such at $N=P\cdot Q$ where $P$ and $Q$ are non-equal primes: \begin{equation} \phi(P\cdot Q) = (P-1)\cdot(Q-1) \end{equation} I'm ha...
$N=p·q$ ($p$ and $q$ are prime numbers), $m_1, ..., m_x$ are the messages, $e$ and $d$ are RSA encryption and decryption exponents, respectively. I am given $e, m_1, m_1^e, m_1^d, ..., m_x, m_x^e, m_x^d$. Is it possible for me to factor $N$ or derive $d$ from the above knowledge? My tentative answer is "no" beca...
The original question states that we are given $e,m_1,{m_1}^e,{m_1}^d,\dots,{m_x}^e,{m_x}^d$, but not $N$; and asks for $d$ or a factorization of $N$. I suspect some gremlin crept in this statement, because if any of the ${m_j}$ is such that ${m_j}>1$, it is trivial to obtain $d$ from ${m_j}$ and ${m_j}^d$, as $d=\l...
The [NIST-Recommended Random Number Generator Based on ANSI X9.31 Appendix A.2.4 Using the 3-Key Triple DES and AES Algorithms](http://csrc.nist.gov/groups/STM/cavp/documents/rng/931rngext.pdf) has 3DES being used three times for each 64-bit block of random data desired, e.g. $I = ede_K (DT)$, $R = ede_K(I \oplus V...
Here is the [post][1] that explains the failure for doing h(k||m) and I understand it. But I don't understand how h(m||k) is subjected to collison attack, or birthday attack. Please explain? [1]: http://crypto.stackexchange.com/questions/1070/why-is-hkx-not-a-secure-mac-construction
Why is h(m||k) insecure?
So I was just wondering in RSA, can the encryption exponent e be greater than ϕ(N)?? For an examples sake, lets just say N = 707, so p = 101 & q = 7. So, we have ϕ(707) = 600. Can I have e = 707? because I can calculate d = 443 by de=1 mod 600. I have seen it almost everywhere that 1 < e < ϕ(N). But my questio...
Can the encryption exponent e be greater than ϕ(N)?
[This answer][1] points out that certain key and block lengths were a requirement for the AES submissions: >The candidate algorithm shall be capable of supporting key-block combinations with sizes of 128-128, 192-128, and 256-128 bits. My question is this; how can having a key length that is greater than the bloc...
> Once you increase the key length beyond that, you start to introduce collisions. In fact, you *only* introduce collisions from then on don't you? I don't know if there's a proof of that. As a pseudo-random function, the expected value of 128-bit keys that produce a given plaintext-ciphertext pair is one, but that ...
Except for standards, regulatory, and interoperability concerns, it is OK to choose a huge $e$, as long as the only link between $e$ and the factors $p$, $q$ of $N$ are the mandatory $\gcd(e,p-1)=1$ and $\gcd(e,q-1)=1$; and nothing is made to chose $e$ so that $d$ as special properties. For example $e$ could be: - A...
Except for standards, regulatory, and interoperability concerns, it is OK to choose a huge $e$, as long as the only link between $e$ and the factors $p$, $q$ of $N$ are the mandatory $\gcd(e,p-1)=1$ and $\gcd(e,q-1)=1$; and nothing is made to chose $e$ so that $d$ as special properties. For example $e$ could be: - A...
Except for standards, regulatory, and interoperability concerns, it is OK to choose a huge $e$, as long as the only link between $e$ and the factors $p$, $q$ of $N$ are the mandatory $\gcd(e,p-1)=1$ and $\gcd(e,q-1)=1$; and nothing is made to chose $e$ so that $d$ as special properties. For example $e$ could be: - A...
Does RSA hide all bits of the message, or are there some bits that can be easily revealed. Concretely, $$m^e \space mod \space N$$ Can any part of $m$ be learned(with significant probability) without learning the secret key, and if so how?
This question relates to the underlying RSA assumption. Forgetting about the fact that Textbook RSA is deterministic, I am curious about the assumed strength of the RSA problem. Does RSA hide all bits of the message, or are there some bits that can be easily revealed. Concretely, $$m^e \space mod \space N$$ ...
This question relates to the underlying RSA assumption. Forgetting about the fact that Textbook RSA is deterministic, I am curious about the assumed strength of the RSA problem. Does RSA hide all bits of the message, or are there some bits that can be easily revealed. Concretely, $$m^e \space \bmod \space N$$ ...
Lets say I have a seed named iv which has a decent amount of entropy. Are there any glaring issues with the following? First 64 bytes are generated by SHA512(iv)<br> Next 64 bytes are generated by HMAC_SHA512(iv, Previous64Bytes)<br> and so on... Obviously if I needed "perfect" security I could use something...
The answer depends upon the factorization of $p-1$. Let me explain the situation for two example cases: * Suppose $p-1=2p'$, where $p'$ is also prime. This is the best case (for the defender): it minimizes the information leakage. Then the best known attack that takes advantage of the reduced range of the exponen...
Is FIPS 140-2 requires specific key size or specific requirements for the data? in other words, if I encrypt a file, how I can check whether it is FIPS complaint or not? only the key needs to be checked or the encrypted file has to be checked too? if yes, is it possible to elaborate on how to check an encrypted file ...
In terms of security, would it be MORE or LESS secure to take, say, an RC4 output (or Serpent) or other, that is encrypted with one key, and to encrypt that output with AES (using a different key)? > $Data -> Serpent -> key: $s_key = HASH_HMAC(sha256, "1st Key" . > $salt1, "HMAC KEY1") = $S_Output > ...
In terms of security, would it be MORE or LESS secure to take, say, an RC4 output (or Serpent) or other, that is encrypted with one key, and to encrypt that output with AES (using a different key)? > $Data -> Serpent -> key: $s_key = HASH_HMAC(sha256, "1st Key" . > $salt1, "HMAC KEY1") = $S_Output > ...
Lets say I want to tweak/alter the textbook RSA encryption function to create a pseudorandom function by pre-processing the input. Suppose I do something simple like add 2 to the input before encrypting it: $c = (m+2)^e mod N$ How do I know if this is a secure pseudorandom function or not? Does this give any i...
I'm going to try and eventually factor RSA-100, but my current QS needs a lot of improvement, so I'm going to try and switch over to the MPQS. I'm a bit confused as to how the MPQS works, which is correct: 1) Use the QS polynomial to generate X/Y pairs, then sieve with the "new" polynomial<br> 2) Use the "new" p...
This is not a secure pseudorandom function. No tweak is going to make this a pseudorandom function. After all, it is a public-key operation, so anyone who knows your algorithm can compute $f(m)$ given $m$. Consequently, it cannot possibly be pseudorandom: there will always be a trivial distinguisher. What are you...
Lets say I want to tweak/alter the textbook RSA encryption function to create a pseudorandom function by pre-processing the input. Suppose I do something simple like add 2 to the input before encrypting it: $c = (m+2)^e \bmod N$ How do I know if this is a secure pseudorandom function or not? Does this give any...
Lets say I want to tweak/alter the textbook RSA encryption function to create a pseudorandom function by pre-processing the input. Suppose I do something simple like add 2 to the input before encrypting it: $$c = (m+2)^e \bmod N$$ How do I know if this is not a secure pseudorandom function? Does this give any ...
I think the first paragraph of [this document](https://docs.google.com/viewer?a=v&q=cache:na6sx75owoMJ:www.cosic.esat.kuleuven.be/publications/article-1532.pdf+&hl=en&gl=uk&pid=bl&srcid=ADGEESieh-KUtBz8arrJGH7eYme88wa1ytJLAvaqtRdM0iNbfYoHg5PZ5L8C3y8HQGoTeAdulOvxnayGKxp6s92a_ijKdQi7aoRttRfB_wlt7-jIITMu_gDoBO5PhLR2BoV3da...
I think the first paragraph of [this document](https://docs.google.com/viewer?a=v&q=cache:na6sx75owoMJ:www.cosic.esat.kuleuven.be/publications/article-1532.pdf+&hl=en&gl=uk&pid=bl&srcid=ADGEESieh-KUtBz8arrJGH7eYme88wa1ytJLAvaqtRdM0iNbfYoHg5PZ5L8C3y8HQGoTeAdulOvxnayGKxp6s92a_ijKdQi7aoRttRfB_wlt7-jIITMu_gDoBO5PhLR2BoV3da...
Having some specific ECDSA curve and a private key, how does one calculate the public key? I am having a hard time finding the algorithm and equations for it.
How to generate a public key from a private ECDSA key?
I don't want you to solve,I want some hints to solve this problem : we want to change the AES encryption so that the user now provide a string of 1408 bits and in addition we delete the key schedule algorithm ,we divide the string to 11 sub keys , then we use this function as cryptographic compression function in t...
Obviously, given a single 128 bit value $h(M)$, we cannot uniquely deduce the 1408 bit value $M$. However (hint), let us assume that we can ask for the value $h(M \oplus delta)$, for 1408 bit values $delta$ that we pick; how can we use that to recover $M$?
As Mike asked, it's not clear if you're asking about onewayness, or collision resistance (as you call the function a 'cryptographic compression function'). Assuming you're asking about onewayness, well, given a single 128 bit value $h(M)$, we obviously cannot uniquely deduce the 1408 bit value $M$. However (hint), ...
As Mike asked, it's not clear if you're asking about onewayness, or collision resistance (as you call the function a 'cryptographic compression function'). Assuming you're asking about onewayness, well, given a single 128 bit value $h(M)$, we obviously cannot uniquely deduce the 1408 bit value $M$. However (hint), ...
In terms of security, would it be MORE or LESS secure to take, say, an RC4 output (or Serpent) or other, that is encrypted with one key, and to encrypt that output with AES (using a different key)? > $Data -> Serpent -> key: $s_key = HASH_HMAC(sha256, "1st Key" . > $salt1, "HMAC KEY1") = $S_Output > ...
Are you sure you want 2-2-3, not 2-3-2? The latter is more common in my experience. None the less, the first step is almost always done with a quadratic extension where i^2=-1. So you just need to implement complex numbers over your field of choice. Multiplying complex numbers is simple if you just treat them as ...
I'm making a digital-asset manager written in ActionScript 3, it will be used to manage highly sensitive information. I'm using the [AS3Crypto](http://code.google.com/p/as3crypto/source/browse/#svn%2Ftrunk%2Fas3crypto%2Fsrc%2Fcom%2Fhurlant%2Fcrypto%2Ftests%253Fstate%253Dclosed) library (which has quite a good reputati...
AES key length greater than 256 bits - is it dangerous to do an implementation outside of the standard?
I understand that Blowfish is getting old, but is still a secure algorithm, and that AES is very popular, and is recommended by most people. My question is, how do the two compare when a 256-bit key is used for AES, and a 448-bit key (the maximum according to the standard) is used for Blowfish? Would Blowfish with a ...
Imagine the following situation. There is an application for a microcontroller-driven system. The profits are made from manufacturing and selling the device itself. However, it is expected, that the users can later download software-updates from a public website, and install it (using a USB-connection, for example). ...
A situation where security by obscurity might be the best solution - or am I wrong?
Imagine the following situation. There is an application for a microcontroller-driven system. The profits are made from manufacturing and selling the device itself. However, it is expected, that the users can later download software-updates from a public website, and install it (using a USB-connection, for example). ...
In [Wikipedia][1], there is an article explaining Lenstra's factorization algorithm. As far as I got it, we choose *some* $e \in \mathbb{N}$ and a point $P$ on the curve and then calculate $eP$. While calculating, we must invert elements, and if that does not work, we are rewarded with a factorization. So far, so go...
By non-standard do you mean when to use custom curves? Like in [crypto++](http://www.cryptopp.com/wiki/Elliptic_Curve_Builder) where you can specify your own parameters? Given that the [standards](http://www.certicom.com/index.php/the-basics-of-ecc) recommend certain sets of domain parameters it's sounds like the a...
By non-standard do you mean when to use custom curves? Like in [crypto++](http://www.cryptopp.com/wiki/Elliptic_Curve_Builder) where you can specify your own parameters? Given that the [standards](http://www.certicom.com/index.php/the-basics-of-ecc) recommend certain sets of domain parameters (and interesting enoug...
Imagine the following situation. There is an application for a microcontroller-driven system. The profits are made from manufacturing and selling the device itself. However, it is expected, that the users can later download software-updates from a public website, and install it (using a USB-connection, for example). ...
Historically hashes have been from a large set (say 256 characters) to a smaller set (256 bits). Also, hash functions that are P-complete have no known parallel algorithm; they must be computed serially which ensures a certain amount of temporal cost in computing them. Three questions: 1)What is the technica...
Say I'm connecting to a web server secured with TLS but with a self-signed certificate. Since I know to expect this, I call the owner of the server and ask him what SHA1 fingerprint his server has. He starts reading out the hex digits to me and I follow along, but before he reaches the end, I just tell him "That's f...
How many bits of hash are realistically needed for key verification?
Asymmetric cryptography can generate huge keys and make it almost impossible for people to crack without a super computer because it will take a very long time to cipher/decipher anything if your key is big .e.g 4096 bit key. <br /> What I know is you can only cipher data that is smaller than the Key length.<br /> I ...
Why is asymmetric cryptography bad for huge data?
I recommend stopping after 20 hex digits, i.e., 80 bits. That will be plenty for security. It would take an adversary $2^{80}$ steps of computation to fool you, which is beyond what is feasible given the current state of technology. I would *not* recommend 40 hex digits, i.e., 160 bits. That offers needlessly poo...
Prove? Why does the attacker need to "prove" it? For example, the attacker can check whether there is an oracle by looking at the code and seeing whether such an attack is possible. Or, the attacker can guess that such an attack might be possible and then try the attack. If the attack succeeds, the attacker knows ...
Lets say an application is using CBC mode without authentication. The application is generating cipher text. This cipher text can be manipulated by the attacker and then transmitted back to the application. Without looking at the code, what is an easy method for the attacker to prove that a Padding Oracle or Decr...
What is an easy method of proving that a cryptographic oracle attack is possible?
Say I'm connecting to a web server secured with TLS but with a self-signed certificate. Since I know to expect this, I call the owner of the server and ask him what SHA1 fingerprint his server has. He starts reading out the hex digits to me and I follow along, but before he reaches the end, I just tell him "That's f...
I recommend stopping after 20 hex digits, i.e., 80 bits. That should be enough for security. Suppose you connect to no more than 128 different servers with self-signed certificates, for which you will use this verification procedure. Then it would take an adversary $2^{80}/128 \approx 2^{73}$ steps of computation to...
I recommend stopping after 20 hex digits, i.e., 80 bits. That should be enough for security. Suppose you connect to no more than 128 different servers with self-signed certificates, for which you will use this verification procedure. Then it would take an adversary $2^{80}/128 \approx 2^{73}$ steps of computation to...
I don't think it's a bad idea - neither does [Bruce Schneier](http://en.wikipedia.org/wiki/Bruce_Schneier). In his book [Applied Cryptography](https://www.google.com/search?q=bruce%20schneier%20applied%20cryptography), there is a section called "Cascading Multiple Block Algorithms". He basically states that provided t...
Say I'm connecting to a web server secured with TLS but with a self-signed certificate. Accordingly, I call the owner of the server and ask him what SHA1 fingerprint he has. He starts reading out the hex digits to me and I follow along, but before he reaches the end, I just tell him "That's fine thanks, no need to r...
Why is it important that `phi(n)` is kept a secret, in RSA?
Why is it important that phi(n) is kept a secret, in RSA?
Why is it important that $\phi(n)$ is kept a secret, in RSA?
When performed in binary Galois fields $GF_{2^n}$, [Shamir's threshold secret sharing scheme][1] produces shares that are each the same bit-size as the secret. Though the scheme is "perfectly secure" in that less than the requisite number of shares provide no information about the secret, in practice it does leak infor...
Does zero-padding the secret in Shamir's sharing scheme increase security?
As you note, Shamir's threshold secret sharing is perfectly secure (or information theoretically secure), yet does leak some information about the size of the secret (same thing with one-time pad). If you are worried about leaking some information about the size of the secret, then padding could be used to lower the...
Assuming I already have a 256-key (32 char password) for AES encryption, comprised of random alpha-numeric characters and punctuation (95 possible ascii chars), generated by a decent PRNG, is there any reason to use a KDF to convert this into another key of the same length? Is a derivative hash in some way stronger? ...
Why the following attack in common modulus RSA works?
we don't want change standard just after every attack, now for AES 128bit blocks i think 16 round is secure, but what is best round amount ? we had attack for 7 round then 10 round and it going so on i think so is better we use a better standard. how many round you think we use is better for a long time ?
Suppose that $S=(E,D)$ is an additively homomorphic encryption scheme. Now I want to design a protocol $P$ such that given inputs $x_1,x_2,..,x_n$, the adversary $A$ (who can decrypt) **can only learn $\sum x_i$ and nothing else**. To do that, $P$ first generates random values $r_1, r_2,..,r_n$ such that $\sum r_i = 0$...
I was reading about the differences between the GCM and the CBC more [here][1] and I have a follow up doubt on the same. In the CBC mode the person who performs the encryption is the one who provides the IV for the encryption -- and the IV is required to decrypt the ciphertext. However, in GCM i read that the `no...
The functioning of the Internet as we know it nowadays depends very heavily on public-key cryptography, including several key root systems that depend on its asymmetric properties. But what would it be like to not have that tool? Could a sufficiently advanced but less convenient private-key cryptography system still...
What would the Internet be like without public-key cryptography?
assume we say 128bit keys are secure so a 16 character long password is safe, but if i even use lower case and upper case letters with numbers and special characters on my keyboard its about 80 different character i can choose, as we have 256 different byte in nature so it look like the 16 character random password i c...
True 128bit secured password length?
If your alphabet (set of all possible characters) has size $s$ and your password has length $l$, a *randomly* generated password has a strength of $\log_2s^l = l\cdot\log_2s = l\cdot\frac{\log_{10}s}{\log_{10}2}$ bits. This means if you want to create a 128-bit password using a 80-character alphabet, you need at lea...
I am somewhat familiar with current research on fully [homomorphic enryption](http://en.wikipedia.org/wiki/Homomorphic_encryption) schemes and their possible application to Cloud computing. I've just noticed (somewhat late) that a marketing-savvy group of Physicists working on quantum information is approaching the ...
You can create a public key cryptosystem from any trapdoor function, and you need some form of trapdoor to design a public key cryptosystem. Do you mean "those trapdoor functions, which are currently USED in Internet standards"? The most prominent ones are discrete log of integers, factorization and discrete log in ell...
We change the AES block cipher encryption: * we delete the key schedule algorithm * the user now provides a string of 1408 bits * we divide the string to 11 sub keys, and use them directly in the encryption part of AES as the round keys. We call the resulting function $AES' : \mathbb Z_2^{1408} \times \mathbb Z...
Can one build a one-way function from AES?
The standard approach is to break this problem into two pieces: * **What information is unavoidably leaked, merely by computing the desired function?** In your case, the goal is to compute $\sum_i x_i$. This sum unavoidably leaks a little bit of information about the $x_i$'s. For instance, as you correctly state, ...
As Mike asked, it's not clear if you're asking about onewayness, or collision resistance (as you call the function a 'cryptographic compression function'). Assuming you're asking about onewayness, well, given a single 128 bit value $h(M)$, we obviously cannot uniquely deduce the 1408 bit value $M$. However (hint), ...
Restrict to $n=1$. Let $M$ and $M'$ be two 1408-bit messages differing in the last 128 bits. What's $h(M)\oplus h(M')$? Can a function $h$ with this property be one-way?
Re-reading my copy of Cryptography Engineering for the holidays, I was struck by the following question about the [Fortuna RNG][1]: Why require an entropy source specify which pool a random event should go in? (For code, see the `add_random_event` method in [this python implementation][2]). The book discusses ...
Why does Fortuna (RNG) require entropy sources to specify accumulator pool?
It seems to be believed that encrypting twice with a block cipher using an independent key each time is not as secure as you might expect because of the "meet in the middle" attack. This is explained at wikipedia for example. This is an attack with known plaintext. The theory is that the attacker encrypts the plai...
Can repeated block cipher avoid meet in the middle attack with cbc with key1?
It seems to be believed that encrypting twice with a block cipher using an independent key each time is not as secure as you might expect because of the ["meet in the middle" attack][1]. This is an attack with known plaintext. The theory is that the attacker encrypts the plaintext with every possible key, and decry...
Can a nested block cipher avoid the meet in the middle attack by using a secret initialization vector for the inner encryption?
A while ago, I came across the problem of trying to systematically reduce "RNG abuse" in the competitive battling environment of Pokémon (which, for anyone who's into this stuff, runs quite rampant) while developiong an engine for the game. For anyone who's not familiar, "RNG abuse" is tricking the pseudorandom number ...
Ron Rivest posed a puzzle in 1999. [MIT LCS35 Time Capsule Crypto-Puzzle][1]. > The problem is to compute 2^(2^t) (mod n) for specified values of t and n. Here n is the product of two large primes, and t is chosen to set the desired level of difficulty of the puzzle. > > Note that the puzzle can be solved by ...
What is the progress on the MIT LCS35 Time Capsule Crypto-Puzzle?
Ron Rivest posed a puzzle in 1999. [MIT LCS35 Time Capsule Crypto-Puzzle][1]. > The problem is to compute $2^{2^t} \pmod n$ for specified > values of $t$ and $n$. Here $n$ is the product of two large primes, > and $t$ is chosen to set the desired level of difficulty of the puzzle. > > Note that the puzzle can...