instruction stringlengths 15 30k |
|---|
I am trying to build a hash function computationally indistinguishable from random (thus collision-resistant and preimage-resistant), with input a message $M$ of fixed size $|M|=m\cdot b$ bits, and output the hash $H(M)$ of fixed size $|H(M)|=h\cdot b$ bits, using as the single primitive a $b$-bit block cipher with key... |
I am trying to build a public hash function computationally indistinguishable from random (thus collision-resistant and preimage-resistant), with input a message $M$ of fixed size $|M|=m\cdot b$ bits, and output the hash $H(M)$ of fixed size $|H(M)|=h\cdot b$ bits, using as the single primitive a $b$-bit block cipher w... |
I am trying to build a public hash function computationally indistinguishable from random (thus collision-resistant and preimage-resistant), with input a message $M$ of fixed size $|M|=m\cdot b$ bits, and output the hash $H(M)$ of fixed size $|H(M)|=h\cdot b$ bits, using as the single primitive a $b$-bit block cipher w... |
IV is called an initialization vector because it is the first vector. The next vectors are the cipher text blocks. And guess what: all of them are send in plain. So what again are you trying to achieve by simply encrypting the very first one?
Answer only valid for particular blockcipher encryption modes (most import... |
I am trying to build a public hash function computationally indistinguishable from random (thus collision-resistant and preimage-resistant), with input a message $M$ of fixed size $|M|=m\cdot b$ bits, and output the hash $H(M)$ of fixed size $|H(M)|=h\cdot b$ bits, using as the single primitive a $b$-bit block cipher w... |
I am trying to build a public hash function computationally indistinguishable from random (thus collision-resistant and preimage-resistant), with input a message $M$ of fixed size $|M|=m\cdot b$ bits, and output the hash $H(M)$ of fixed size $|H(M)|=h\cdot b$ bits, using as the single primitive a $b$-bit block cipher w... |
I am trying to build a public hash function computationally indistinguishable from random (thus collision-resistant and preimage-resistant), with input a message $M$ of fixed size $|M|=m\cdot b$ bits, and output the hash $H(M)$ of fixed size $|H(M)|=h\cdot b$ bits, using as the single primitive a $b$-bit block cipher w... |
I am trying to build a public hash function computationally indistinguishable from random (thus collision-resistant and preimage-resistant), with input a message $M$ of fixed size $|M|=m\cdot b$ bits, and output the hash $H(M)$ of fixed size $|H(M)|=h\cdot b$ bits, using as the single primitive a $b$-bit block cipher w... |
In Advanced Encryption Standard, If I used "Counter Mode", in it's nonce value, what should I do?
ex. should I cut the nonce value into two? ex. I have 128-bit of nonce, should I cut it from two? that will turn into 64-bit each?
the first 64-bit is my chosen nonce value.. ex: a0a1a2a3a4a5a6a7
and the second 64-b... |
In Advanced Encryption Standard, If I used "Counter Mode", in it's nonce value, what should I do?
ex. should I cut the nonce value into two? ex. I have 128-bit of nonce, should I cut it from two? that will turn into 64-bit each?
the first 64-bit is my chosen nonce value.. ex: a0a1a2a3a4a5a6a7
and the second 64-b... |
In Advanced Encryption Standard, If I used "Counter Mode", in it's nonce value, what should I do?
ex. should I cut the nonce value into two? ex. I have 128-bit of nonce, should I cut it from two? that will turn into 64-bit each?
the first 64-bit is my chosen nonce value.. ex: a0a1a2a3a4a5a6a7
and the second 64-b... |
In Advanced Encryption Standard, If I used "Counter Mode", in it's nonce value, what should I do?
ex. should I cut the nonce value into two? ex. I have 128-bit of nonce, should I cut it from two? that will turn into 64-bit each?
the first 64-bit is my chosen nonce value.. ex: a0a1a2a3a4a5a6a7
and the second 64-b... |
I was looking through block cipher padding methods, and found two good candidates:
- **ANSI X.923** - pad with zeros, then a final byte for the padding length, e.g. `00 00 00 04`.
- **PKCS7** - pad with bytes that each show the number of padding bytes, e.g. `04 04 04 04`.
Is there any benefit to using PKCS7 ov... |
I was reading a question about [combatting traffic analysis][1], and a thought occured. If I send random junk messages periodically, would that defeat traffic analysis?
The messages would contain some form of header to specify "this is junk", and would otherwise be comprised of random data of a random (plausible) le... |
Well, this isn't a new idea. One place (and probably not the first place) this has appeared before is in [IPsec RFC4303, see dummy packets in section 2.6][1].
Now, IPsec differs from your suggestion in that it isn't using some output from a CSPRNG. Instead it just grabs some arbitrary amount of data of the right l... |
for an embedded device I need to sign a 14-byte string and want to verify that string on the device.
Since there is already an AES-Library on the device, I thought about using the following scheme:
Use AES with a fixed IV and a fixed secret key to encrypt the following string:
> "2byte Random Padding | 14byte ... |
I am trying to build a public hash function (thus collision-resistant and preimage-resistant, and more generally behaving like a random oracle), with input a message $M$ of fixed size $|M|=m\cdot b$ bits, and output the hash $H(M)$ of fixed size $|H(M)|=h\cdot b$ bits, using as the single primitive a $b$-bit block ciph... |
I am trying to build a public hash function (thus collision-resistant and preimage-resistant, and more generally behaving like a random oracle), with input a message $M$ of fixed size $|M|=m\cdot b$ bits, and output the hash $H(M)$ of fixed size $|H(M)|=h\cdot b$ bits, using as the single primitive a $b$-bit block ciph... |
I am trying to build a public hash function (thus collision-resistant and preimage-resistant, and more generally behaving like a random oracle), with input a message $M$ of fixed size $|M|=m\cdot b$ bits, and output the hash $H(M)$ of fixed size $|H(M)|=h\cdot b$ bits, using as the single primitive a $b$-bit block ciph... |
I am trying to build a public hash function (thus collision-resistant and preimage-resistant, and more generally behaving like a random oracle), with input a message $M$ of fixed size $|M|=m\cdot b$ bits, and output the hash $H(M)$ of fixed size $|H(M)|=h\cdot b$ bits, using as the single primitive a $b$-bit block ciph... |
I am implementing an AES cipher in GCM mode in c# and have a few questions. My code is based on the code found here for reference. I'll copy in the relevant portions.
http://blogs.msdn.com/b/shawnfa/archive/2009/03/17/authenticated-symmetric-encryption-in-net.aspx
1. I am having difficulty understand the "additio... |
Well, I'm unfamiliar with this specific C# library, and so I can't answer questions about its API. I could guess, but I suspect you want something better than that.
However, I can answer generic GCM questions.
1a. What does the AAD consist of?
Well, AAD is another service that GCM provides. When encrypting m... |
I'm signing very small messages using RSA, and the signature and public key are added to every message, which requires a lot of space compared to the actual content.
I'm considering switching to ECDSA, would this require less space with the same level of encryption? And is the verification performance in the same ra... |
I'm considering switching to ECDSA, would this require less space with the same level of encryption?
The answer to that question is yes, both ECDSA signatures and public keys are much smaller than RSA signatures and public keys of similar security levels. If you compare a 192-bit ECDSA curve compared to a 1k RSA ke... |
> I'm considering switching to ECDSA, would this require less space with the same level of encryption?
The answer to that question is yes, both ECDSA signatures and public keys are much smaller than RSA signatures and public keys of similar security levels. If you compare a 192-bit ECDSA curve compared to a 1k RSA ... |
I have noticed that different implementations of SHA1 give different results. As I'm currently programming my own SHA1 implementation (in MATLAB / GNU Octave), I wonder which one should I follow?
There are several implementations of SHA1 in [Rosetta Code](http://rosettacode.org/wiki/SHA-1). Using the message `Rosett... |
Different implementations of SHA1, which one is correct? |
I have noticed that different implementations of SHA1 give different results. As I'm currently programming my own SHA1 implementation (in MATLAB / GNU Octave), I wonder which one should I follow?
There are several implementations of SHA1 in [Rosetta Code](http://rosettacode.org/wiki/SHA-1). Using the message `Rosett... |
I have posted a couple questions about AES GCM here lately, and now that I have a prototype of the code written, I am posting again to hopefully get some feedback and ask a question or two.
The following is a symmetric encryption/decryption routine using AES in GCM mode. This code operates in the application layer... |
> I currently manually append the "tag" property to the ciphertext, is this the correct method of authentication?
That is a perfectly acceptable method. In the end, there needs to be some protocol which tells the other party where the ciphertext is and where the authentication tag is. In your case, the other party ... |
Is the encryption of a hash a good MAC? |
No, in general, this is not secure, unless you make additional assumptions on the encryption method beyond the standard assumption of privacy.
To simplify things a bit, the assumption of privacy means that given a ciphertext $C$, the attacker has no information about what the plaintext might be. However, in your ca... |
I have written some code to do AES in [GCM][1]. I currently manually append the tag property to the ciphertext, is this the proper way to communicate the authentication tag?
[1]: http://en.wikipedia.org/wiki/Galois/Counter_Mode |
How to communicate authentication tag for GCM? |
I assume you're talking about SSL/TLS or a similar protocol. In these protocols there are two reasons to use Diffie-Hellman:
1. **Your certificate only supports signing**
Either it is an RSA certificate restricted to signing, or it uses an algorithm that doesn't support encryption, such as DSA or ECDSA.
2. **[Fo... |
i wrote this code:
// integer is a drop-in replacement of standard int
// http://calccrypto.wikidot.com/programming:integer
// it is an arbitrary precision intger
// integer::str(base, size) returns a string in that base, 'size' long padding the front with 0s
// base 256 means an ASCII string... |
No, in general, this is not secure, unless you make additional assumptions on the encryption method beyond the standard assumption of privacy.
To simplify things a bit, the assumption of privacy means that given a ciphertext $C$, the attacker has no information about what the plaintext might be. However, in your ca... |
I'm studying the Rc4 algorithm and I have the following questions:
On all questions assume that an expanded (2048-bit) key is used, and that the first 4096 bytes of the KeystreamIm are discarded.
After the above process, is the resulting S-box indistinguishable from a random permutation of the numbers 0 through 2... |
What are the disadvantages of using random s-boxes?
In AES, the s-boxes had to obey certain mathematical rules, which? And why?
What security does using hidden s-boxes (GOST) or generating them from the key (Khufu) add?, and how do these secret and generated s-boxes defend against differential and linear cryptanalysi... |
I'm studying the RC4 algorithm and I have the following questions:
On all questions assume that an expanded (2048-bit) key is used, and that the first 4096 bytes of the KeystreamIm are discarded.
After the above process, is the resulting S-box indistinguishable from a random permutation of the numbers 0 through 2... |
As for your first question "is the S-box indistinguishable from a random permutation?", well, there are likely some subtle biases. For one, we know that, after exactly 4096 steps, the combination $j=1$ and $SBox[1] = 1$ is impossible; that's because $i=0$ after 4096 steps, and the combination $j=i+1$ and $SBox[j]=1$ i... |
RFC 4880 may be full of information, but it can be incredibly vague at times, so im looking for someone who actually knows the answer to this.
Given this public key:
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: BCPG v1.39
mQGiBE5B0h8RBAD533Z5bK1IpBx02QyQL0QoJE4uFRIMGDiwXuwmZzVl+R7Vlurd
G... |
RFC 4880 may be full of information, but it can be incredibly vague at times, so im looking for someone who actually knows the answer to this.
Given this public key:
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: BCPG v1.39
mQGiBE5B0h8RBAD533Z5bK1IpBx02QyQL0QoJE4uFRIMGDiwXuwmZzVl+R7Vlurd
G... |
Is this a correctly formatted PGP session key packet? |
It turns out that this *is* actually secure, up to the length of the block cipher, if $\mathrm{enc}(\cdot)$ is a secure block cipher (a pseudorandom permutation) and if $\mathrm{hash}(\cdot)$ is collision-resistant.
However, there is a catch. (You just knew there had to be one, didn't you?)
The catch is that typ... |
Is it possible to secure a communications channel against both passive (sniffing) and active (injecting / MitM) attackers without either legitimate party knowing any pre-shared information?
I know that this isn't possible using "traditional" asymmetric crypto, since an active attacker could create its own public key... |
Is it possible to ensure security with zero pre-shared information? |
Is it possible to secure a communications channel against both passive (sniffing) and active (injecting / MitM) attackers without either legitimate party knowing any pre-shared information?
I know that this isn't possible using "traditional" asymmetric crypto, since an active attacker could create its own public key... |
Yes. Simply send the data in the clear.
Passive attacks are not possible. For a passive attack to work, the data must be intercepted by someone other than the intended recipient. But by your definition of "pre-shared information" the existence of an intended recipient would count as "pre-shared information" (since b... |
In implementing a cipher in GCM or CCM mode, you are provided the option to add "Additional Authenticated Data" (AAD). This AAD is required for decrypting the cipher text, and seems to be used when data is crucially specific to a label.
What I am wondering is, could you use this AAD as a secondary key and simply kee... |
In implementing a cipher in GCM or CCM mode, you are provided the option to add "Additional Authenticated Data" (AAD). This AAD is required for decrypting the cipher text, and seems to be used when data is crucially specific to a label.
EDIT: to clarify, an example of when it might be used that I have seen is if you... |
Imagine that we're trying to create a function to generate a random string conforming to a user-supplied alphabet. That way, users can generate random strings with given characters. Something like:
string random_string(int length, string alphabet)
Now, the alphabet could be any combination of characters from ... |
RFC 4880 may be full of information, but it can be incredibly vague at times, so im looking for someone who actually knows the answer to this.
Given this public key:
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: BCPG v1.39
mQGiBE5B0h8RBAD533Z5bK1IpBx02QyQL0QoJE4uFRIMGDiwXuwmZzVl+R7Vlurd
G... |
MACs differ from digital signatures in the sense that MAC values are both generated and verified using a shares secret key. Does this in any way put MAC on a disadvantage as compared to digital signatures? How is one of them better than the other? |
Is MAC better than digital signature? |
GnuPG has slow hash built-in in form of [iterated+salted S2K][1].
Does it have disadvantages in comparance with bcrypt or scrypt? Is GnuPG's slow hash method easily automated in GPUs?
[1]: http://tools.ietf.org/html/rfc4880#section-3.7.1.3 |
Is bcrypt better than GnupPG's iterated+salted hashing method? |
Was, as you stated, a MAC "are both generated and verified using a shared secret key", while with a digital signature, the signatures are generated with one key, and are verified with another (and it is infeasible to sign anything with the verifier key alone).
So, with digital signatures, we can give someone the abi... |
RFC 4880 may be full of information, but it can be incredibly vague at times, so im looking for someone who actually knows the answer to this.
Given this public key:
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: BCPG v1.39
mQGiBE5B0h8RBAD533Z5bK1IpBx02QyQL0QoJE4uFRIMGDiwXuwmZzVl+R7Vlurd
G... |
Can anyone suggest a good (CS)PRNG algorithm that takes advantage of having a very large (ideally arbitrarily large) seed? I'd like to use several kilobytes, perhaps several hundred kilobytes, of random data to generate up to a few dozen megabytes of PRNG output. The PRNG algorithms I'm aware of only take relatively sm... |
As per title, other than brute force, are there any attacks on Threefish-512 using only a single plaintext block? Are there any attacks like this in any other cipher? |
Other than brute force, are there any attacks on Threefish-512 using only a single known plaintext block? |
Are there any security risks using a single key-pair for both key-exchange and signing?
I'm mainly interested in using Curve25519 for key-exchange and Ed25519 for signing. But similar combinations, such as ECDH and ECDSA with the same key pair would be interesting too.
I saw some recommendations to avoid using a ... |
I recently ran across elliptic curve crypto-systems:
* [An Introduction to the Theory of Elliptic Curves][1] (Brown University)
* [Elliptic Curve Cryptography][2] (Wikipedia)
* [Performance analysis of identity management in the Session Initiation Protocol (SIP)][3] (IEEE)
* [Overview of Elliptic Curve Cryptosyst... |
Is there a paper or link where it explains , how the plain vanilla Textbook RSA is actually implemented in practice with all the padding and stuff ?
basically i want to know the intricacies of implementing an algo to a production level crypto code ! |
Vanilla textbook RSA does not include "padding and stuff", the term "textbook RSA" generally refers to simply encoding a plaintext message as an integer and raising it to an exponent. Implementing this is pretty easy, just follow the [steps outlined][1] on Wikipedia. You can easily translate those steps into some given... |
##[Original Answer](http://stackoverflow.com/a/11402200/416646) (StackOverflow)
--------------
Haven't got enough time to look up the details, but I would guess that you're applying (or not applying) padding correctly. That would cause the right result to come up for some input lengths, but not for others... |
I would like to know how to extract contents of the password protected winrar file without the password. I have downloaded that WinRar file from a file hosting website. I only found out that it was password protected after I have download. And brute force attacking take ages. I would like to know is there any way to ma... |
Consider the generation of an RSA key pair with a given modulus size $n$ and a known, small public exponent $e$ (typically $e = 3$ or $e = 65537$). A common method is to generate two random primes numbers of size $n/2$ (or very close), and check at least that they are probable primes and that $\mathrm{gcd}(e, (p-1)(q-1... |
Why should the RSA private exponent have the same size as the modulus? |
Why can't you simply ask the person who made that file to tell you the password?
No one knows how to decode an AES-encrypted file, such as password-protected WinRar files, without knowing the password.
As far as we know, the only way to decode AES-encrypted files is to somehow obtain the right password, and then ... |
When I use libgcrypt to encrypt using Elgamal, what padding scheme should I add? ANd how do I do it? I know that usign RSA I can use this S-expression to the `function gcry_pk_encrypt`:
(data
(flags pkcs1)
(value BLOCK))
And I can use `oaep` or `pss` instead of "`pkcs1`". But what do I use with ... |
How to use padding with Elgamal in libgcrypt? |
How secure is libgcrypt's Elgamal implementation of encryption (how different it is from textbook Elgamal), and how can I tweak padding and other preprocessing actions?
For example, I know that usign RSA I can use this S-expression to the `function gcry_pk_encrypt`:
(data
(flags pkcs1)
(value BL... |
How to securely use Elgamal encryption in libgcrypt? |
Well, first off, it appears that these requirements are a bit confused. If the requirement is that for a given modulus $N$ and public exponent $e$, that the corresponding private exponent $d$ satisfies $d > N/2$, that rules out all public keys (!). You can see that from the necessary and sufficient relation $de = 1 \... |
Most modern algorithms require relatively large amount of resources.
Is there any recent (and freely usable) encryption/decryption algorithm which is specially designed for low-level microcontrollers in mind? This means it has to run fast, (on a very simple, 8 or 16 bit, 10-20 MHz processor), be small (few hundred byt... |
Is there any recent cryptographic algorithm especially designed for low-level processors? |
I'm not going to explain this but after looking at [redshirt.c](http://www.mario-konrad.ch/file.php?id=14012); the core part of the program is that after skipping the header (which is `"REDSHIRT"` (9 bytes includes an ending null byte)), it has a loop which does:
int j;
j = (j & 0x7F) + (~j & 0x80);
Whic... |
Is there difference between Algebraic Homomorophic Encryption and Fully Homomorphic Encryption Schemes ? |
Is there difference between Algebraic Homomorophic Encry and Fully Homomorphic Encry Schemes? |
Is there difference between Algebraic Homomorophic Encryption and Fully Homomorphic Encryption Schemes? |
As sort of a follow up to my [(currently) unanswered question][1], if it is correct, how do i properly calculate and format the packet that actually stores the data being encrypted? I thought I knew what I was doing, but something here causes bouncycastle to freak out.
Using data from the [first post][1]
AES2... |
How to properly format a PGP Message Block? |
Is there any relation between [secure multiparty computation][1] and [threshold cryptosystem][2] ?
[1]: http://en.wikipedia.org/wiki/Secure_multi-party_computation
[2]: http://en.wikipedia.org/wiki/Threshold_cryptosystem |
Relation between Threshold Cryptosystem and Secure Multiparty Computation ? |
As sort of a follow up to my [(currently) unanswered question][1], if it is correct, how do i properly calculate and format the packet that actually stores the data being encrypted? I thought I knew what I was doing, but something here causes bouncycastle to freak out.
Using data from the [first post][1] and:
... |
Is there difference between Algebraic Homomorphic Encryption and Fully Homomorphic Encryption Schemes? |
Is there difference between Algebraic Homomorphic Encryption and Fully Homomorphic Encryption Schemes? |
In a few implementations of hashed passwords, I have seen that length of random salt is chosen to be 10 or say "some constant". Is there any specific reason why salt is chosen to be of same length? Can a smart attacker Trudy take advantage of it?
Does hashed password with random salt make the password stronger? |
In a few implementations of hashed passwords, I have seen that the length of the random salt is chosen to be, say, 10 or "some constant". Is there any specific reason why the salt is chosen to have a fixed length? Can a smart attacker take advantage of it?
Does hashing a password with a random salt make the password... |
I realize this is mixing the purposes between asymmetric and symmetric crypto, but I was wondering if it is safe to use a hashed, truncated private key (asymmetric) as the symmetric key for encrypting data at rest? For this question I am presuming RSA is a 1024 bit key, SHA1 produces 160 bits, and AES is using a 128 b... |
Is truncating a hashed private key with SHA-1 safe to use as the symmetric key for AES for data at rest? |
I have several questions concerning the original Paillier cryptosystem as described in
Paillier, Pascal (1999).
"Public-Key Cryptosystems Based on Composite Degree Residuosity Classes".
EUROCRYPT. Springer. pp. 223-238. [http://www.springerlink.com/content/kwjvf0k8fqyy2h3d/?MUD=MP][1]
Notation:
msgp - unencryp... |
I have a PDF document intended for long-term (many years, maybe decades) archival which I would like to digitally sign with my personal certificate to ensure its integrity.
As far as I understand, I need to timestamp the signature in order to ensure it remains valid even after certificate expiration.
Let's say I ... |
I've been looking at the [off-the-record messaging protocol][1], and there is something about its deniability property that seems strange to me.
Consider the following scenario:
> In the course of an OTR conversation, Alice decides to break Bob's deniability, e.g. she wants to be able to prove to
> some third ... |
Why is a MAC needed? |
A "normal", brute-force attack on a cryptographic hashing algorithm $H$ should have a complexity of about $2^{n}$ for a hash algorithm with an output length of $n$ bits.
That means it takes about $2^{n-1}$ tries on average to find a colliding message $y$ for a given message $x$ so that $H(y) = H(x)$ while $y \ne x$.... |
How does a birthday attack on a hashing algorithm work? |
A "normal", brute-force attack on a cryptographic hashing algorithm $H$ should have a complexity of about $2^{n}$ for a hash algorithm with an output length of $n$ bits.
That means it takes about $2^{n-1}$ tries on average to find a colliding message $y$ for a given message $x$ so that $H(y) = H(x)$ while $y \ne x$.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.