instruction
stringlengths
15
30k
Suppose i generate a random mXm matrix R, where each of its elements belongs to Z_n. I ensure that R is invertable in Z_n. Now i take a non-random mXm matrix A, where each of its elements belongs to Z_n and is not zero. I now multiply them both together to obtain R*A and reduce R*A modulo n. My question is: is H(...
Shannon entropy calculation is H(A|R*A) = H(A)?
Suppose I generate a random $m×m$ matrix $R$, where each of its elements belongs to $\mathbb Z_n$. I ensure that $R$ is invertible in $\mathbb Z_n^{m×m}$. Now I take a non-random $m×m$ matrix $A$, where each of its elements belongs to $\mathbb Z_n$ and is not zero. I now multiply them both together to obtain $R·A$ a...
Shannon entropy calculation: is $H(A|R·A) = H(A)$?
1) If your private key is compromised you are screwed, but this is pretty much always the case. I'd suggest one long term public key and securing that box to the highest degree. However, if you're worried, the key to clients will be interesting. You could do TLS, and create a certificate authority that's stored o...
When I need to generate unique id's based on some information hashing is typical choice. However, sometimes that id needs to be of a particular size. I've seen a lot of schemes (HMAC-MD5-96 in SSH, CGA in SeND for IPv6) that use a portion of a hash, so I'm thinking it might be alright to use it that way. Which pr...
Do parts of a hash carry the properties of the entire hash?
What's the difference between the "Signature Algorithm" and the "Signature Hash Algorithm" found in an X.509 certificate? Why does it need a "Signature Hash Algorithm"?
What's the difference between the "Signature Algorithm" and the "Signature Hash Algorithm" found in an X.509 certificate? Why does it need a "Signature Hash Algorithm"? ![enter image description here][1] [1]: https://i.stack.imgur.com/CBzuj.jpg
This has more to do with how Microsoft decided to implemented their certificate inspection GUI, than about the actual fields of the certificate. Most signature algorithm identifiers present in contemporary certificates specify both the public key algorithm (RSA in this case) and the digest algorithm (SHA-1 in this case...
I'm wondering why we use encrypt-decrypt-encrypt sequence in 3DES with three keys instead of three times encryption with three different keys ? thanks
What's the difference between the "Signature Algorithm" and the "Signature Hash Algorithm" found in an X.509 certificate? Why does it need a "Signature Hash Algorithm"? ![enter image description here][1] **Edit:** I'm creating the X.509 cert with PHP 5.2. When I change the 'digest_alg' to 'md5', both propert...
What's the difference between the "Signature Algorithm" and the "Signature Hash Algorithm" found in an X.509 certificate? Why does it need a "Signature Hash Algorithm"? ![enter image description here][1] **Edit:** I'm creating the X.509 cert with PHP 5.2. When I change the 'digest_alg' to 'md5', both propert...
What's the difference between the "Signature Algorithm" and the "Signature Hash Algorithm" found in an X.509 certificate? Why does it need a "Signature Hash Algorithm"? ![enter image description here][1] **Edit:** I'm creating the X.509 cert with PHP 5.2. When I change the 'digest_alg' to 'md5', both propert...
I'm wondering why we use encrypt-decrypt-encrypt sequence in 3DES with three keys instead of three times encryption with three different keys?
Why do we use encrypt-decrypt-encrypt (EDE) in 3DES, rather than encrypting three times?
This has more to do with how Microsoft decided to implemented their certificate inspection GUI, than about the actual fields of the certificate. Most signature algorithm identifiers present in contemporary certificates specify both the public key algorithm (RSA in this case) and the digest algorithm (SHA-1 in this case...
Yao's garbled circuit is simple to understand. First of all, note that if we can securely compute $\mathsf{NAND/NOR}$ of two input bit, we can perform any boolean operation. Yao's garbled circuit tries to achieve the same. Lets look at scrambled $\mathsf{OR}$ gate. 1. Alice creates a set of four keys, $K_{x=0},K_{x...
Yao's garbled circuit is simple to understand. First of all, note that if we can securely compute $\mathsf{NAND/NOR}$ of two input bit, we can perform any boolean operation. Yao's garbled circuit tries to achieve the same. Lets look at scrambled $\mathsf{OR}$ gate. 1. Alice creates a set of four keys, $K_{x=0},K_{x...
This is mostly a terminology question, but I suppose that it is best asked and answered here. After browsing the Internet I have come across a fair number of completely different definitions of the term "key stretching" and would like to know if there is any consensus in the research literature about how the term is to...
Are there any authoritative definitions of "key stretching"?
This is mostly a terminology question, but I suppose that it is best asked and answered here. After browsing the Internet I have come across a fair number of completely different definitions of the term "key stretching" and would like to know if there is any consensus in the research literature about how the term is to...
Yao's garbled circuit is simple to understand. First of all, note that if we can securely compute $\mathsf{NAND/NOR}$ of two input bit, we can perform any boolean operation. Yao's garbled circuit tries to achieve the same. Lets look at scrambled $\mathsf{OR}$ gate. 1. Alice creates a set of four keys, $K_{x=0},K_{x...
Complexity of arithmetic in a finite field?
Yao's garbled circuit is simple to understand. First of all, note that if we can securely compute $\mathsf{NAND/NOR}$ of two input bit, we can perform any boolean operation. Yao's garbled circuit tries to achieve the same. Lets look at scrambled $\mathsf{OR}$ gate. 1. Alice creates a set of four keys, $K_{x=0},K_{x...
Yao's garbled circuit is simple to understand. First of all, note that if we can securely compute $\mathsf{NAND/NOR}$ of two input bit, we can perform any boolean operation. Yao's garbled circuit tries to achieve the same. Lets look at scrambled $\mathsf{OR}$ gate. 1. Alice creates a set of four keys, $K_{x=0},K_{x...
CFB, OFB and other modes are meant for streaming and don't require padding. Are there still limitations such as the text needs to be greater than key length?
are CFB and OFB really meant for streaming?
When creating padding for RSA using OAEP, a message is prepared as follows: Hash(Input Parameter) || Zeros || 1 || Message My question is, what should the Input Parameter be? It must be known to both sides, I understand it can be an empty array (string, whatever). In that case there is no need to calculate th...
Assuming a bit string is deemed cryptographically secure, e.g. PRNG using AES in counter mode, can we equally assume any permutation of said bit string is also cryptographically secure? In a more practical sense, using a PRNG with AES in counter mode again (for instance), assume it turns out that AES can be more eff...
Is division possible in the Paillier Cryptosystem? i.e. given a the cipher-text $C$ of an integer $M$ the plain-text divisor $D$, and only the public key, can one compute the cipher-text of $M/D$ ?
In general, no. There are, however, specific conditions that, when met, make it possible. If given $D^{-1} \bmod{\phi(N^2)}$, then $\mathcal{E}(M/D)$ can be computed. So the question remains, when is computing $D^{-1} \bmod{\phi(N^2)}$ possible? It is only possible if $gcd(D, \phi(N^2))=1$. Note that $\phi(N^2)=N...
Why is CBC considered the canonical mode when there are streaming modes available such as CFB and OFB? One thing that I can think of is that in CBC you can easliy do range-based decryption. All you have to do is load the previous block. How would you do it in CFB/OFB? In my [previous question](http://crypto.stackexchan...
Why is CBC considered the canonical mode when there are streaming modes available such as CFB and OFB? One thing that I can think of is that in CBC you can easliy do range-based decryption. All you have to do is load the previous block (whose size is explicit). How would you do it in CFB/OFB? In my [previous question](...
Why is CBC considered the canonical mode when there are streaming modes available such as CFB and OFB? One thing that I can think of is that in CBC you can easliy do range-based decryption. All you have to do is load the previous block (whose size is explicit). How would you do it in CFB/OFB? In my [previous question](...
I've identified a weakness in a distributed simulation system I'm looking at, and I'm looking for some advice on how to fix it. Clients initially negotiate an authentication token with a login server using Diffie-Hellman. They then connect to the each simulation node they require (seperate hosts) in turn, using the ...
How to generate successive stream-cipher keys?
In general, no. There are, however, specific conditions that, when met, make it possible. **Working Mod $\phi(N^2)$** If given $D^{-1} \bmod{\phi(N^2)}$, then $\mathcal{E}(M/D)$ can be computed. So the question remains, when is computing $D^{-1} \bmod{\phi(N^2)}$ possible? It is only possible if $gcd(D, \phi(N...
No, this isn't a good idea. The reason is that if you *ever* re-use a key in a stream cipher, an attacker can XOR off known plaintext to get the key stream. Yes, your fix is an improvement, but you were starting from completely insecure and you've pushed it up into mostly completely insecure. The login token ...
Don't. Just don't. You are indeed perceptive enough to note that if the output of PBKDF2 is truly pseudo-random, then XORing it onto data is as secure as the password is. But don't. Really. It's not good hygiene. A KDF is a Key Derivation Function, not a cipher. It's not designed to be used as a cipher, so don't use...
**Question:** *If you had to implement BGN, how would you do it?* I'm looking for an implementation of the public-key cryptosystem due to Boneh, Goh, and Nissim (aka [BGN][1]), or at least some suggestions on implementing it myself. My goals are to explore/learn/play around with its structure, and, eventually, to pr...
Constructing a [hash tree](https://en.wikipedia.org/wiki/Hash_tree) is simple enough if the data fits into a number of blocks that is a power of two. root = H(H(A+B)+H(C+D)) / \ H(A+B) H(C+D) / \ / \ A B C D In ...
How does the Tiger Tree Hash handle data whose size isn't a power of two?
Constructing a [hash tree](https://en.wikipedia.org/wiki/Hash_tree) is simple enough if the data fits into a number of blocks that is a power of two. root = H(H(A+B)+H(C+D)) / \ H(A+B) H(C+D) / \ / \ A B C D In ...
Constructing a [hash tree](https://en.wikipedia.org/wiki/Hash_tree) is simple enough if the data fits into a number of blocks that is a power of two. root = H(H(A+B)+H(C+D)) / \ H(A+B) H(C+D) / \ / \ A B C D In ...
How does a "Tiger Tree Hash" handle data whose size isn't a power of two?
I've looked at several hash function specifications, and they all emphasize the need for big-endian byte ordering. Is there a reason for this that has to do with security, or is it simply convention?
Why do all hash functions use big-endian data?
Let's say I have - two keys K1 and K2. - two messages M1 and M2 of the same length. - Cipher (E,D) - 3 ciphertexts: C11, C12,C22 where `Cij = E(Ki, Mj)` In situation where attacker knows K2 and all the ciphertexts (which also gives him M2), can I choose a cipher to guarantee that attacker won't be able t...
I [just learned](http://crypto.stackexchange.com/a/2103/342) that the THEX hash tree specification which is widely used in P2P requires that two different hash functions be used: one for the leaf nodes (hashes of input data) and one for the internal hashes (hashes of hashes). > In order to protect against collisions...
What is the purpose of using different hash functions for the leaves and internals of a hash tree?
I am trying to relate the notion of RSA security. Choosing a public exponent where e = 3 facilitates the calculations considering that it is secure if the plaintext or message is long. If the message is short it affects security but why ? does that relates to the 2 exponent n possibilities, if the message is short t...
I am trying to understand the notion of RSA security. Choosing a public exponent where $e = 3$ facilitates the calculations, considering that it is secure if the plaintext or message is long. If the message is short, it affects security but why? Does that relates to the $2^n$ possibilities, if the message is s...
Why does RSA give better security on longer messages?
Consider the following fixed length MAC for messages of length l(n)=2n-2 using a pseudorandom function F: On input a mesage m0||m1 (m0=m1=n-1) and a key {0,1}^n. alg Mac outputs t=Fk(0||m0)||Fk(1,m1). Algorithm Vrfy is defined in the natural way. Is (gen, mac, vrfy) existentially unforgeable under a chosen message atta...
I'm planning on using this [Javascript BCrypt implementation][1], but as you can see in the code, it uses a 4KB precalculated dataset for the `P` and `S` parameters needed for blowfish hashing. I've also tracked a similar dataset back to the [original C BCrypt code][2]. Shouldn't blowfish hashing use a dynamically c...
How is BCrypt secure when it uses a static dataset for blowfish hashing?
Consider the following fixed length MAC for messages of length $\ell(n)=2n-2$ using a pseudorandom function $F$: On input a mesage $m_0||m_1$ ($m_0=m1=n-1$) and a key $\{0,1\}^n$. alg Mac outputs $t=F_k(0||m_0)||F_k(1,m_1)$. Algorithm Vrfy is defined in the natural way. Is (gen, mac, vrfy) existentially unforgeable und...
Consider the following fixed length MAC for messages of length $\ell(n)=2n-2$ using a pseudorandom function $F$: On input of a mesage $m_0||m_1$ ($|m_0| = |m_1| = n-1$) and a key $k \in \{0,1\}^n$, algorithm Mac outputs $t=F_k(0||m_0)||F_k(1,m_1)$. Algorithm Vrfy is defined in the natural way. Is (Gen, Mac, Vrfy)...
Is this fixed length MAC unforgeable?
Forgeries can be made against this algorithm; here's how: If the attacker gets the MAC with the two messages M0||M2 and M1||M3 as follows: MAC(M0||M2) = Fk(0||M0) || Fk(1||M2) MAC(M1||M3) = Fk(0||M1) || Fk(1||M3) then, the attacker knows the values of Fk(0||M1) and Fk(1||M2), and thus can deduce the M...
Say I want to verify the identity of Alice, but Alice could be colluding with Bob to fool me. Is there any way to verify Alice's identity and also be sure that Bob is not impersonating Alice, e.g. using her private key?
Are there any signature schemes that protect against collusion by multiple parties?
Is SHA1 secure with such many inputs Z that Z = constant secret X + variable public Y?
In DES, different S-boxes were tested for cryptanalytic resistance and the most secure one was chosen for the algorithm itself. How do different S-boxes offer different levels of security against cryptanalysis and how is this tested?
Under the assumption that there exists a real-world implementation of the McEliece scheme, could it be applied to streaming data as is? By that I mean in 'block cipher mode'? I've read that McEliece is very fast in encryption and decryption, hence calculating a session key for a symmetric stream cipher might be unneces...
This is only a partial answer to the question, but still: The S-boxes where chosen to maximize confusion and to create an avalanche of change. For example, there were specific properties chosen to make the S-boxes resistant against differential cryptanalysis, by making sure that small differences between different inpu...
Answering the question as worded in its body: **NO**, $\mathrm{SHA1}$ is not _designed_ so that the proposed construction is secure under the stated conditions. The design objective of the $\mathrm{SHA1}$ and $\mathrm{SHA2}$ hashes, [as explained by NIST][1], is that > it is computationally infeasible to find a mess...
Answering the question as worded in its body: **NO**, $\mathrm{SHA1}$ is not _designed_ so that the proposed construction is secure under the stated conditions. The design objective of the $\mathrm{SHA1}$ and $\mathrm{SHA2}$ hashes, [as explained by NIST][1], is that > it is computationally infeasible to find a mess...
Answering the question as worded in its body: **NO**, $\mathrm{SHA1}$ is not _designed_ so that the proposed construction is secure under the stated conditions. The design objective of the $\mathrm{SHA1}$ and $\mathrm{SHA2}$ hashes, [as explained by NIST][1], is that > it is computationally infeasible to find a mess...
Answering the question as worded in its body: **NO**, $\mathrm{SHA1}$ is not _designed_ so that the proposed construction is secure under the stated conditions. The design objective of the $\mathrm{SHA1}$ and $\mathrm{SHA2}$ hashes, [as explained by NIST][1], is that > it is computationally infeasible to find a mess...
Answering the question as worded in its body: **NO**, $\mathrm{SHA1}$ is not _designed_ so that the proposed construction is secure under the stated conditions. The design objective of the $\mathrm{SHA1}$ and $\mathrm{SHA2}$ hashes, [as explained by NIST][1], is that > it is computationally infeasible to find a mess...
Does the encryption with a private key and decryption with a public key works in RSA? Is it done when we use RSA for sender authentication ? Thanks.
The two keys $(e,m)$ and $(d,m)$ in the RSA key pair are fully equivalent, in that $e$ and $d$ can be arbitrarily chosen integers (in the interval $0..m-1$) as long as they fulfill the well-known congruence $ed \equiv 1 \mod \phi(m)$. You can swap them and nothing will change. A key becomes `public` the moment you (...
In my application i'm doing a DH key exchange where both sides generate their own ephemeral key. No static keys are used. I am trying to make my application resistant against an active attack and therefore need to validate the public key that my counterpart is sending me. Below I'm using standard DH variable na...
In my application i'm doing a DH key exchange where both sides generate their own ephemeral key. No static keys are used. I am trying to make my application resistant against an active attack and therefore need to validate the public key that my counterpart is sending me. Below I'm using standard DH variable na...
I'm building a storage system for JSON documents where they are looked up on a 128 bit key. These JSON documents have a timestamp within them, but apart from that are user-entered data. These JSON documents can have within them private information, so I want to avoid any issues where two documents have the same hash an...
In my application i'm doing a DH key exchange where both sides generate their own ephemeral key. No static keys are used. I am trying to make my application resistant against an active attack and therefore need to validate the public key that my counterpart is sending me. Below I'm using standard DH variable na...
In my application i'm doing a DH key exchange where both sides generate their own ephemeral key. No static keys are used. I am trying to make my application resistant against an active attack and therefore need to validate the public key that my counterpart is sending me. Below I'm using standard DH variable na...
This is only a partial answer to the question, but still: The S-boxes where chosen to maximize confusion and to create an avalanche of change. For example, there were specific properties chosen to make the S-boxes resistant against differential cryptanalysis, by making sure that small differences between different inpu...
I want to encrypt a key file, which is assumed to be truly random (generated with hardware RNG, for instance). Given that there are no patterns in the plaintext, what implications are there for my choice of encryption algorithm? Could I get away with something as trivial as a Vigenere cipher (or XOR equivalent)? Assumi...
If plaintext is random, how does it affect my choice of encryption algorithm?
The RP in ECC would be to find $a_1,\ldots,a_n$ (integers) given $P$ and $Q_1,\ldots,Q_n$ (points in the EC) such that $P = a_1 \cdot Q_1 + \ldots + a_n \cdot Q_n$. Is it hard when DH-like assumption holds in the EC? Is is hard in secp256k1 or Curve25519?
Lets say you are presented with an encrypted string of bits or text, and no other information. What would be necessary before you could apply brute force methods to decrypting the string? How would a cryptanalyst approach such a case?
Is it generally possible to employ brute force methods when the encryption scheme is not known? Why or why not?
Lets say you are presented with an encrypted string of bits or text, and no other information. What would be necessary before you could apply brute force methods to decrypting the string? How would a cryptanalyst approach such a case? (lets assume the conditions are such that the encryption can be brute forced in a rea...
In my application I'm doing a DH key exchange, where both sides generate their own ephemeral key. No static keys are used. I am trying to make my application resistant against an active attack and therefore need to validate the public key that my counterpart is sending me. Below I'm using standard DH variable n...
How should I check the received ephemeral Diffie-Hellman public keys?
This is only a partial answer to the question, but still: The S-boxes where chosen to maximize confusion and to create an avalanche of change. For example, there were specific properties chosen to make the S-boxes resistant against differential cryptanalysis, by making sure that small differences between different inpu...
To authenticate a message m = m1|| · · · ||m` the tag t := Fk(r) ⊕ Fk(m1) ⊕ · · · ⊕ Fk(m`), where r is uniform random number {0,1}^n and m{0,1}^n . . . Even though if the random number is prepended to the sequence still there is any chance of reordering the message blocks which makes it insecure. . i am confused whe...
whether the MAC is secure or not?
If you can't tell what function was applied to create the cipher text, your search space is as many bits as the message. It's the perfect secrecy achieved with a one time pad. (x + y = z, given z what are x and y?) During an exhaustive search the attacker could find as many messages as they were willing to compute, b...
This doesn't sound like a cryptography problem. I think you could use Fnv1 and get the same dangerous construction. Hashes of any kind do not work for row identity. Collision resistance does not mean collisions don't occur. It means that it is computationally difficult to determine an input (of which there are m...
As evident from the site of john the ripper, JTR [example][1], john can be used for finding password form a unix machine `passwd` file. Are there any other usage of JTR? I mean can JTR be used for anything else? probably, crack password for windows or say a password encrypted doc file etc... It seems to me that ...
I'm using the SHA1/2 family of algorithms for a particular project. I'm was wondering if all the SHA algos return a fixed length hash regardless of the length of the data?
Does the SHA hash function always generate a fixed length hash?
To authenticate a message $m = m_1|| \ldots ||m_n$ the tag $t := F_k(r) \oplus F_k(m_1) \oplus · · · \oplus F_k(m_n)$, where r is uniform random number $(0,1)^n$ and $m=(0,1)^n$. Even though if the random number is prepended to the sequence there is still a chance of reordering the message blocks which makes it insecur...
Block ordering and security in a MAC?
Essentially yes, they do. Depending on the exact hash function you choose depends on the length of output you'd expect. For example, SHA256 produces 256 bits of output. This does then beg the question "but the length of the hash is fixed and there are infinite possible inputs??!!". That's correct, except that $2^...
I'm implementing the Secure Remote Protocol that is specified to have this equation for the parameter `S`, the premaster secret. S = (B - (k * g^x)) ^ (a + (u * x)) % N But the implementation I'm referring to, has done it this way. Is this equivalent to the author's description? Its too complex for me to und...