instruction stringlengths 15 30k |
|---|
Say I have a [request-response][1] protocol and the task to make it immune to [replay attacks][2]. The requirements are as follows:
1. The defense mechanism cannot rely on the clocks of the parties.
2. The defense mechanism should work even when requests are not sequential.
3. No party can store more than 1KB o... |
In normal LFSR, the state is a function of the initial seed, taps positions and time, nothing else. I've seen a modification of LFSR that works like this:
TAPS = const
MASK = (1<<L)-1 #L=bitlength of state
def parity(x):
return (number of ones in x)&1
def tick(state):
... |
For this question, the following caveats and assumptions hold:
- There exists a 2048-bit RSA key pair used exclusively for signing/verification
- The private key is kept completely private
- There exists a group of users who have the public key
- There is a group shared password
- I understand the functiona... |
The standard solution would be to have the sender maintain a counter, and sending the value of that counter in each request (which is tied into the integrity check of the request). The receiver would remember the largest counter value that he has received a valid request for, and a bitmap showing which of the N reques... |
For this question, the following caveats and assumptions hold:
- There exists a 2048-bit RSA key pair used exclusively for signing/verification
- The private key is kept completely private
- There exists a group of users who have the public key
- There is a group shared password
- I (mostly) understand the ... |
In many existing padding schemes, without padding always being added there is a trivial second preimage attack. For simplicity let's assume a 10 bit hash function $h_{10}$ (extending this to other size hash functions is trivial).
Let $m_1=101$ and $m_2=1011000000$. I claim that $h_{10}(m_1)=h_{10}(m_2)$.
Since $m... |
For this question, the following caveats and assumptions hold:
- There exists a 2048-bit RSA key pair used exclusively for signing/verification
- The private key is kept completely private
- There exists a group of users who have the public key
- There is a group shared password
- I (mostly) understand the ... |
RFC 4880 describes the version 4 signature packet, tag 2, as
- One-octet signature type.
- One-octet public-key algorithm.
- One-octet hash algorithm.
- Two-octet scalar octet count for following hashed subpacket data.
Note that this is the length in octets of all of the hashed
subpac... |
For this question, the following caveats and assumptions hold:
- There exists a 2048-bit RSA key pair used exclusively for signing/verification
- The private key is kept completely private
- There exists a group of users who have the public key
- There is a group shared password
- I (mostly) understand the ... |
I want to combine encryption and MAC.
For encryption I use AES-256 with CBC and PKCS5Padding.
For MAC I use HmacSHA512.
I use the Encrypt-then-Mac approach (calculate MAC over the ciphertext and deliver it with the ciphertext)
The algorithm should be able to process streamed data and if I calculate the MAC on... |
Is this streamable combination of encryption and MAC secure? |
I want to combine encryption and MAC.
For encryption I use AES-256 with CBC and PKCS5Padding.
For MAC I use HmacSHA512.
I use the Encrypt-then-Mac approach (calculate MAC over the ciphertext and deliver it with the ciphertext)
The algorithm should be able to process streamed data, and if I calculate the MAC o... |
Is the uncompressibility of encrypted data a necessary property for a good cryptographic algorithm?
To make a crude experiment, I encrypted an 8K file with all 'A' and then compressed both the encrypted and the unencrypted file.
The compressed unencrypted file went down to less than 200 bytes while the conpressed... |
RFC 4880 describes the version 4 signature packet, tag 2, as
- One-octet signature type.
- One-octet public-key algorithm.
- One-octet hash algorithm.
- Two-octet scalar octet count for following hashed subpacket data.
Note that this is the length in octets of all of the hashed
subpac... |
RFC 4880 describes the version 4 signature packet, tag 2, as
- One-octet signature type.
- One-octet public-key algorithm.
- One-octet hash algorithm.
- Two-octet scalar octet count for following hashed subpacket data.
Note that this is the length in octets of all of the hashed
subpac... |
Being very new to C++ and cryptography, I finally managed to implement a version of the Vinegere algorithm. I would like to try something a bit more complicated. I have looked at AES and DES and others like them, but I was wondering if there is something simpler. Something that might use some of the same basic ideas as... |
RFC 4880 describes the version 4 signature packet, tag 2, as
- One-octet signature type.
- One-octet public-key algorithm.
- One-octet hash algorithm.
- Two-octet scalar octet count for following hashed subpacket data.
Note that this is the length in octets of all of the hashed
subpac... |
RFC 4880 describes the version 4 signature packet, tag 2, as
- One-octet signature type.
- One-octet public-key algorithm.
- One-octet hash algorithm.
- Two-octet scalar octet count for following hashed subpacket data.
Note that this is the length in octets of all of the hashed
subpac... |
Are there any simple and yet secure encryption algorithms? |
A friend just showed me how to combine padlocks to achieve a lock that opens when `k` out of `n` people turn their keys.
I was wondering if there was something similar for encryption; using n or fewer public keys encrypt a piece of data so it can only be unlocked if at least `k` out of `n` specific private keys are ... |
Let's say I would like to communicate with my friend using asymmetric/public-key encryption, e.g. RSA.
(**Note:** I do realize that in practice this is done through an intermediate symmetric key, but this question assumes we only use asymmetric encryption.)
Say I try to do this: I slice up my data into 2<sup>*n*<... |
Is re-using a public key safe? |
Let's say I would like to communicate with my friend using asymmetric/public-key encryption, e.g. RSA.
(**Note:** I do realize that in practice this is done through an intermediate symmetric key, but this question assumes we only use asymmetric encryption.)
Say I try to do this: I slice up my data into 2<sup>*n*<... |
Is RSA in a ECB-like-mode safe for bulk encryption? |
Can I protect against the failure of a block or symmetric cipher by chaining different techniques together? If so what implementation details should I be aware of?
Are some combination of ciphers better or worse than others?
In my case I'm not concerned about the CPU expense, but am more concerned about defend... |
How can I protect against the failure of a block or symmetric cipher? |
Unintentional programming errors can be defeated by extensively checking your code against test vectors before releasing it (or better yet, create a self-test routine). Note that this doesn't protect against a malicious attacker circumventing your self-test and inserting his backdoor at runtime, obviously.
Of course... |
Alice securely gives Bob a secret key so they can exchange 10 different messages encrypted with RC4. (Messages will include a counter for uniqueness and a MAC for authentication.) For each message exchange, Alice and Bob both start by permuting the standard byte array using the secret key (ie, the ["KSA" key-scheduli... |
Do these 2 KSA shortcuts weaken RC4? |
How to remove padded value in Decrypted Message?
I am using AES Algorithm..
ex:
this is the decrypted message..
"abcdefghijklmn "
there is a 2 space in that decrypted message which is equivalent to 0x00
how can I removed that value? during decryption. |
How to remove padded value in Decrypted Message?
I am using AES Algorithm..
ex:
this is the decrypted message..
"abcdefghijklmn "
there is a 2 space in that decrypted message which is equivalent to 0x00
how can I removed that value? during decryption to show the exact message before it was encrypted. |
How to remove padded value in Decrypted Message?
I am using AES Algorithm..
ex:
this is the decrypted message..
"abcdefghijklmn "
there is a 2 space in that decrypted message which is equivalent to 0x00
how can I removed that value? during decryption to show the exact message before it was encrypted.
... |
The obvious problem with Shortcut 1 is that the same keystream will be used to encrypt all the messages. That is, an attacker can exclusive-or two ciphertexts together, and the result will be the exclusive-or of the two plaintexts; this may very well allow the attacker to recover both messages. How easy this is depen... |
What other attack can avoid by the used of Output Feedback than the ECB in an algorithm?
|
Is there any guarantee that there are no collisions for all 512-bit input values for SHA-512(Every 512-bit input has a unique output), or just that they are highly improbable and can't be algorithmically deduced? |
For a file encryption program, I was told to use Output Feedback mode (OFB) instead of ECB (Electronic code book) mode.
Which attacks can I avoid by this choice? |
Which attacks can be avoided by the use of OFB instead of ECB? |
> **Possible Duplicate:**
> [Is SHA-512 bijective when hashing a single 512-bit block?](http://crypto.stackexchange.com/questions/301/is-sha-512-bijective-when-hashing-a-single-512-bit-block)
<!-- End of automatically inserted text -->
Is there any guarantee that there are no collisions for all 512-bit input valu... |
Alice securely gives Bob a secret key so they can exchange 10 different messages encrypted with RC4. (Messages will include a counter for uniqueness and a MAC for authentication.) For each message exchange, Alice and Bob both start by permuting the standard byte array using the secret key (ie, the ["KSA" key-scheduli... |
I tried to encrypt and decrypt a file in ECB mode using AES Algorithm but I encountered one problem during decryption, I don't know how to remove the padded value.. because every byte in a file is unpredicted.. I am only using 0x00 in padding.
how to remove the padded value in a encrypted file during decryption? ho... |
> **Possible Duplicate:**
> [Removing Padded Value in Decrypted Message](http://crypto.stackexchange.com/questions/2803/removing-padded-value-in-decrypted-message)
<!-- End of automatically inserted text -->
I tried to encrypt and decrypt a file in ECB mode using AES Algorithm but I encountered one problem during... |
I have been reading about the 3DES algorithm and I cannot understand one part. In 3DES we do following operation: $$C=E[K_3,D[K_2,E[K_1,P]]].$$
Where $C$ is ciphertext, $P$ is plaintext, $E$ is DES encryption and $D$ is DES decryption.
In the second part we have the *decryption* with $K_2$. How can we decrypt a cip... |
How can 3DES encryption use decryption in the middle step? |
**Regarding #1:**
You don't lose anything with regards to the algorithm itself. The algorithm to go from the key to the key schedule (KS) is deterministic and well known, so anyone who gets the key can easily get the KS too. The actual algorithm itself isn't made less secure by communicating the KS instead of the ke... |
**Regarding #1:**
You don't lose anything with regards to the algorithm itself. The algorithm to go from the key to the key schedule (KS) is deterministic and well known, so anyone who gets the key can easily get the KS too. The actual algorithm itself isn't made less secure by communicating the KS instead of the ke... |
DJB's [`nistp224`](http://cr.yp.to/nistp224.html) program purports to be an implementation of elliptic curve Diffie-Hellman relative to the standard NIST P-224 elliptic curve.
To the best of my understanding, ECDH relative to this curve should produce *225*-bit public messages (compressed points consisting of a 224-... |
How does DJB's nistp224 manage to fit compressed points into 224 bits? |
My assumption is that S/MIME almost always utilizes certificates as follows:
- My certificate can be used to allow people to encrypt messages and send them to me.
- My certificate (the same certificate) is used by me to sign messages and send them.
Is there an RFC reference that specifies this is a requireme... |
How secure is my OTP program? |
I have a question about attacks on the
implementation of cryptographic code that are enabled by compilation and compiler-optimisations. I am aware of [this](https://www.securecoding.cert.org/confluence/display/cplusplus/MSC06-CPP.+Be+aware+of+compiler+optimization+when+dealing+with+sensitive+data). Would
anyone be ab... |
I was not able to articulate why there is a requirement of "Non-Linear functions" as a component of many popular block cipher (eg sbox in DES or 3DES). how does it make the cipher more secure? The only intuition i have is a non linear function can have many roots (solutions) For eg : for a non linear y = F(x) if attac... |
Why is there a requirement of "Non-Linear functions" as a component of many popular block ciphers (e.g. the S-box in DES or 3DES)?
How does it make the cipher more secure?
The only intuition I have is a non linear function can have many roots (solutions). E.g. for a non linear $y = F(x)$, if attacker knows $y$ to... |
Why do block ciphers need a non-linear component (like an S-box)? |
ECB mode is a deterministic encryption, instead in OFB if the initial vector is random choosed (and of course published with the cryptogram) is a random encryption.
What's the matter with det.enc.? The problem is that if you encoded two time the same message you are going to get two time the same chipertext, so the ad... |
(Hand moved from stackoverflow.com,due to suggestion)
Since breaking password hashes has become a new passtime for scriptkiddies, I thought of the problem and came up with a novel(?) idea.
1. store the pass as offset+number instead of hash
2. the number is a product of two large primes
3. the password is conve... |
Idea for secure password hash-likes, is this feasible/usable/workable? |
I don't see anything horribly wrong with your proposal. On the other hand, the obvious question would be "what advantage would this approach have over, say, [PBKDF2][1] with a good salt"?
- In your proposal, it is infeasible to recover the password from the hash (short of brute-force); that's also true of PBKDF2.
... |
I have a question about attacks on the
implementation of cryptographic code that are enabled by compilation and compiler-optimisations. I am aware of [this](https://www.securecoding.cert.org/confluence/display/cplusplus/MSC06-CPP.+Be+aware+of+compiler+optimization+when+dealing+with+sensitive+data). Would
anyone be ab... |
I want to learn whether or no there is a cryptographic primitive,scheme assumption that is based on the following hard problem if it is hard . By hard we mean that we have a polynomial adversary: The attacker obtains a number $\sigma$ . In order to reverse engineer that or to go one step further for the cryptanalysis ... |
How hard is to find the operators of an addition knowing the sum of them? |
Well, the problem "given a finite set $A$ of integers, is there a subset that sums to a target value $B$" is known as the [Subset Sum problem][1]; it is known to be hard. Specifically, the decisional problem (is there such a sum) is [NP-complete][2], and the computational problem (find the subset) is [NP-hard][3].
... |
One of the typical approaches to computing a salted hash is this:
hash(salt+hash(secret))
where `hash` is something like SHA-256 hash function - taking any size input and returning fixed size output. What's the need for the `hash(secret)`?
Why can't I just do this:
hash(salt + secret)
where `+` is ... |
What's the reason for applying the hash twice when hashing with salt? |
I have two pseudorandom generators,
1. $f1$ takes a random seed $l_0|r_0$ $\in \{0,1\}^{160}$ as input and outputs $r_1|r_2| ... |r_k$, where $l_i|r_i =$ SHA-1$(l_{i-1}|r_{i-1})$ and $l_i, r_i \in \{0,1\}^{80}$
2. $f2$ takes a random seed $s \in \{0,1\}^{160}$ as input and outputs $t_1|t_2| ... |t_{k/2}$, where ... |
Which of the following PRG is preferable? |
I have two pseudorandom generators:
1. $f_1$ takes a random seed $l_0||r_0$ $\in \{0,1\}^{160}$ as input and outputs $r_1||r_2|| \dots ||r_k$, where $l_i||r_i = \operatorname{SHA-1}(l_{i-1}||r_{i-1})$ and $l_i, r_i \in \{0,1\}^{80}$
2. $f_2$ takes a random seed $s \in \{0,1\}^{160}$ as input and outputs $t_1||t_2... |
Does a hash function in chaining mode or in counter mode make a better pseudo-random number generator? |
Under the assumption that SHA-1 is a random oracle, $f_2$ is better (if I understand it properly, i.e. concatenating a constant seed with a counter) in that it forbids the possibility of a short cycle. Specifically, $f_2$ guarantees that no two inputs will be the same, which means that any two outputs are independent o... |
Sorry if this is a noob questions, but I finally figured out how to implement the Tiny Encryption Algorithm in C++.
My question is what to do about padding the key and the plaintext? I know that there are various ways of doing this, but is there a "default" way to do this or does one make a choice? |
First, just to make sure I understand "salting" correctly:
You randomly generate a string to append to the password before hashing it, so as to increase its length and make precomputed tables much less useful in cracking them.
Assuming my understanding is correct, then I'm having trouble how [LinkedIn salted thei... |
How did LinkedIn "salt" all their passwords? |
I am planning on encrypting a message then signing the message so the recipient can authenticate the source. Reading [this article][1] has me concerned that I'm doing something wrong.
My current plan is to use OpenSSL to do the following:
- Create a random key
- Use key to encrypt message with a block cypher
... |
Okay to use OpenSSL to encrypt then sign a message? |
The fragment " _what to do about padding the_ ___key___ _?_ " of the question looks scarily like transforming a password into a cryptographic key using some padding mechanism.
This would be a known, serious, often made and often exploited mistake. A standard security assumption for ciphers is that the key is chosen ... |
I am planning on encrypting a message then signing the message so the recipient can authenticate the source. Reading [this article][1] has me concerned that I'm doing something wrong.
My current plan is to use OpenSSL to do the following:
- Create a random key
- Use key to encrypt message with a block cypher
... |
The fragment " _what to do about padding the_ ___key___ _?_ " of the question looks scarily like transforming a password into a cryptographic key using some padding mechanism.
Doing this would be a known, serious, often made and often exploited mistake. A standard security assumption for ciphers is that the key is c... |
The fragment " _what to do about padding the_ ___key___ _?_ " of the question looks scarily like transforming a password into a cryptographic key using some padding mechanism.
Doing this would be a known, serious, often made and often exploited mistake. A standard security assumption for ciphers is that the key is c... |
I am very confused between the concept of known-plaintext attack and chosen-plaintext attack. It seems to me that these two are the same thing, but it definitely is not. Can anyone explain to me how these two differ? |
The fragment " _what to do about padding the_ ___key___ _?_ " of the question looks scarily like transforming a password into a cryptographic key using some padding mechanism.
Doing this would be a known, serious, often made and often exploited mistake. A standard security assumption for ciphers is that the key is c... |
I am very confused between the concept of known-plaintext attack and chosen-plaintext attack. It seems to me that these two are the same thing, but it definitely is not.
Can anyone explain to me how these two differ? |
What is the difference between known-plaintext attack and chosen-plaintext attack? |
The fragment " _what to do about padding the_ ___key___ _?_ " of the question looks scarily like transforming a password into a cryptographic key using some padding mechanism.
Doing this would be a known, serious, often made and often exploited mistake. A standard security assumption for ciphers is that the key is c... |
From this [excellent answer][1] I learned (correct me if I am wrong) that when writing a block cipher with say key size 128 bit, one has to pad the password given (variable size) so that it becomes exactly the 128 bit that is needed. I had thought that one would just add zeros or repeat the password until the length be... |
1. If you are not planning on using your code in a deployed system, just for learning/testing (which is what you are doing right?), then zero padding is fine.
2. A hash function takes bits as input and outputs bits. Most software will convert those bits to something human readable (hex typically). If you want to use... |
1. If you already have a block cipher primitive (TEA), the simplest and most secure hash can be made with a [Davies-Mayer construction](http://en.wikipedia.org/wiki/One-way_compression_function#Davies.E2.80.93Meyer). I don't advise to simply pad the password to 128 bits because:
a. You should never prevent the user... |
Does the same encryption algorithm given the same plaintext always produces the same ciphertext?
Does this cause any security flaws? |
In MD5, there are four rounds. After every round, why do we need to add the computed Q values to the initial values and then take this value as input to the next round. For example after the first round, we compute Qnew1=Q60+Q-4, Qnew2=Q61+Q-3, Qnew3=Q62+Q-2, Qnew4=Q63+Q-1.
Why cant we directly take the computed value... |
[Sha256Crypt / Sha512Crypt][1] are designed based on ideas of BCrypt but use SHA instead of Blowfish because of political requirements.
The Sha*Crypt algorithms have the advantage that they are used in /etc/shadow on all common Linux distribution.
Do the Sha*Crypt algorithms have the same properties concerning [m... |
Does ShaCrypt have the properties which make BCrypt slow on GPUs? |
From the answer you linked to:
>For SHA-1 or SHA-256, computation entirely consists in 32-bit operations on a handful of registers, so a password cracker will run without doing any memory access at all, and full parallelism is easily achieved (I did it on my GeForce 9800 GTX+, and I got about 98% of the theoretical ... |
I have to encrypt some very short messages (approx. 5 characters) and I would like the ciphertext to be as short as possible. I am currently using AES but the initialization vector (IV) is making my minimum cipher text be 32 bytes, even for plaintext of 1 byte.
Can I do better than 32 bytes? |
What algorithm would give the shortest ciphertext for very short plaintexts? |
While developing some code that uses the .NET AesManaged algorithm, I made some mistakes but was surprised at the results.
My encryption was correct. I was generating a random IV block and writing it to the file (without encrypting the IV). Then I was encrypting the plaintext and writing it.
The decryption was ... |
I'm calculating a SHA2 hash of a certain sensitive key value. I need to store files on disk using this hash a directory path prefix. So lets say I hash the key value 150023, I get a 32-byte value which in hex is 64-characters long - quite a long filename.
What's the shortest string I can get of this 32-byte hash, th... |
How to represent a 32-byte SHA2 hash in the shortest possible string? |
What is the *fundamental* difference between DH and RSA? Aren't they both public-key encryption? |
What's the fundamental difference between Diffie-Hellman and RSA? |
In the correct use of CBC mode, you should see the following:
$c_1=E_k(IV\oplus p_1), c_2=E_k(c_1\oplus p_2)$, etc
and decryption is:
$p_1=D_k(c_1)\oplus IV, p_2=D_k(c_2)\oplus c_1$, etc
From what you are saying, it sounds like you have stored in the file (for case 1):
$IV||c_1||c_2||\cdots$ (where $||... |
There are 94 printable ascii characters. Not all of which are valid for file names, however. There should be $64=2^6$ that are valid for file names, so read $6$ bits at a time and map those to one of the $64$ characters that are valid for file names. That would give you $256/6\approx 43$ characters. It will be hard to ... |
Why does CBC decryption with a wrong IV still give readable results? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.