instruction
stringlengths
32
27.2k
Can someone please explain - using a simple example - how a chosen ciphertext attack works?
I've seen a lot of 2-party applications that derive a shared key from distinct keys created by each party. Why is this technique employed? Would it not be better to use those two distinct keys for each party (where both parties know both keys, but each key is used to encrypt and decrypt the messages of the party who cr...
I've seen some proofs of MAC security that are based on the extremely-unlikely event that two MAC tags collide (ie, they are equal for distinct messages). Suppose that this extremely unlikely event occurs, then what? Can we forge arbitrarily more messages with this same tag? With ANY tag? Or even better, do we get ...
The following is a definition taken from Introduction to Modern Cryptography by Katz and Lindell. I'm having a hard time understanding some basic concepts! Can you please help me? $\newcommand{\Gen}{\operatorname{Gen}}\newcommand{\Enc}{\operatorname{Enc}} \newcommand{\Dec}{\operatorname{Dec}}$ Consider the following ...
I need a mathematical explanation of what does the DES encryption system really do. This means I need more explanation than the one that offers FIPS, which is more an explanation for computer specialists. Among other things, I want to know where do these permutation tables come from: $$IP\\ \newcommand\T{\Rule{0pt}{1em...
I have this idea of implementing a license key: After the user downloads the program, he connects to a website and sends his Windows product ID. The website, then, sends this back to him with a signature using a private RSA key. The program, then, checks, using a public key, whether it is really signed by the private...
I am trying to get my head round the chi square test, when used with the Caesar cipher. I started off using this formula, $$ X = \sum_{i = 1}^k \frac{f_i · f'_i}{n · n'} $$ Where $k$ is the number of distinct letters in the alphabet, $f$ is the number of times the $i$-th letter appears in the first string and $f'$ is ...
What is the message space in the following example and how does a message space relate to a security definition? I mean, what difference does it make to such a definition if your message space is $\{0,1\}^n$ or if it is $\{0,1\}$? We say $(\mathsf{K},\mathsf{E},\mathsf{D})$ is $(t,\epsilon)$-IND-CPA secure if for all ...
I have strings that are if the form: {static data}{changing data} The beginning static data part is around 20 characters and is common to all strings. The last part is around 5 characters and is different for each string. The string is encrypted using blowfish (from xjava.security.Cipher) with a fixed initialization ...
What weaknesses (or strengths) do block ciphers based on only key xor and s-box have when operating in CBC mode? A cipher's internal primitive might be a simple as this: $C = S[M \oplus k]$, where $C$ is ciphertext, $M$ is the plaintext message, $k$ is the key and $S$ is an S-box. Assume the follwoing: The key $k$ is ...
What desirable properties should an S-box have? My current standard selection process is to just pick them at random and verify that they fit the following criteria: The probability that any random two bits $S[a]_b$ and $S[c]_d$ are equal (for any random $a$, $b$, $c$ and $d$) is 50%. The probability that any random t...
I've been recently looking into the creation (and theory) of hash functions, however I just can't figure out how to turn a message into something of a fixed length. At the moment, my theory of a hash function is like so: Take in the message (e.g. "secret") Split it into different 'blocks' (e.g. "sec" + "ret") Mix them...
The weakness CWE-329 is an interesting problem with CBC mode. However, does this same weakness affect the other modes of operation that rely upon an IV such as: PCBC, CFB and OFB? My gut feeling is, YES. I am wondering if there a consensus on this topic? Or is there a possible explanation of why its not a weakness....
I've seen ciphers (usually in spy drama shows) that involve taking a book and writing down an index to individual characters. Essentially it's a keyed substitution cipher, where the key is the name and exact edition number of the book. Example: Imagine a book that has 500 pages, with approximately 60 lines per page and...
Is there perhaps some neural expository article on crypto systems based on non-abelian groups? I've gleaned that Anshel–Anshel–Goldfeld key exchange is the most well-known cryptographic algorithm based upon non-abelian groups. Do people consider it respectably secure? Why? Why not? Any opinions about the role of com...
I am interested in developing DES (in verilog) for my college project. Can I get help in understanding the simulation results of DES encryption and decryption?
If the GCD(r, p-1) is small and the value k is used to sign a message using ElGamal is also small. Then the secret value of x can be determined. Why is this true? How would one retrieve x?
For an ElGamal-like signature scheme, I am given two things: The signing function, the verification function. How can I show that the verification function is valid? Example 1: Signing: $s := x^{-1}(m - k·r) \pmod {p - 1}$ Verification: $g^m = (g^x)^s · r^r \pmod p$ NOTES: $g$ is the generator over the set $\mathbb Z...
I'm taking a crypto class this semester and after learning the definition of a perfect cipher. I started wondering how this definition applies to AES. Obviously AES isn't a perfect cipher, since the key length is only 256 bit at the maximum. But when talking about messages of sizes 128 bits to 256 bits, can one claim t...
A digital currency system like Lucre (OpenTransaction) creates a coin by a mint blind signing the output of a hash function, which the payer then unblinds and pairs with the input to the has function. In this way, the coins themselves cannot be used to identify the payer; however, the payee and the mint are free to cor...
There is an apparently provably secure cipher that was proposed by Diffie, but enhanced by R.A. Rueppel. The scheme, which was mentioned in Applied Cryptography, works like this: Measure the length of the plain-text, $n$. Multiply it by $128$. Generate this much ($128·n$ bytes of) real random data and split it out int...
All rounds of AES (and Rijndael) have a MixColumns step, save the last round which omits it. DES has a similar feature where the last round differs slightly. The rationale, if I recall correctly, was to "make the cipher appear similar in reverse as it does in the forward direction." Why does this make AES$^{-1}$ look...
In public key cryptography we can also use session keys which are symmetric. How do the sender (say a server) provides this session key information to its clients? If the sender (here server) provides the session key by encrypting using its private key, all the clients (including a malicious one) can decrypt (using ava...
In a Feistel cipher (as shown below), it seems that the security of the cipher would be entirely dependent upon the function $F$. What requirements on $F$ are necessary for a secure Feistel cipher? Is there any relationship between the function $F$ and the number of rounds necessary to have a secure cipher?
I've got an application (detailed below) that calls for the use of a cipher that is commutative. I've been doing some googling & reading, and there are two algorithms that seem to get mentioned in these discussions--SRA (not RSA) and Pohlig-Hellman exponentiation. (Supposedly SRA is a variant of RSA?). I need someth...
Say I have an authentication protocol where the shared secret is never transmitted. The server passes a challenge to the client and the client calculates a response using an algorithm where the challenge and the secret is used. When choosing the algorithm, what are the benefits and drawbacks of using either a hash (s...
I have designed an SQL aggregate function in Oracle that bitwise XORs all MD5 sums of the values stored in a column. For example, if my table is: +-----+----------+---------+ | Key | Sequence | Value | +-----+----------+---------+ | 1 | 1 | 'Hello' | | 1 | 2 | 'World' | | 2 | 1 | '1234' | ...
I am a beginner in cryptography. I designed an password based encryption-decryption algorithm, which uses a random salt and a password to encrypt a message. I'm using SHA-512 for hashing, matrix operations for shuffling, bitwise XOR for mixing data and retrieving. The length of the salt and the ciphertext is 256 letter...
How would you generate a list of distinct random strings, where all strings are alphanumeric and have a fixed length?
I quote Bobby's question here since I encountered the same one... Random Coin Flip using ElGamal and a Trusted Party Consider the following protocol for two parties to flip a fair coin. Trusted party $T$ publishes her public key $K_{pub}$ $A$ chooses a random bit $b_A$, encrypts it under $K_{pub}$, and announces the c...
In RSA, suppose we know that $e=N$ and we are given the value of $e$. ($N = p\cdot q$ for some large primes $p$ and $q$; $\gcd(e, \varphi(N) = 1)$ Can we calculate $d$ ($d = e^{-1} \mod \varphi(N)$) without factoring $N$?
I take the definition of safe prime as: a prime $p$ is safe when $(p-1)/2$ is prime. Safe primes of appropriate size are the standard choice for the modulus of cryptosystems related to the discrete logarithm problem, such as Diffie-Hellman. A modulus $p=2^k \pm s$ with $s$ small makes exponentiation $\bmod p$ appreciab...
I am creating a service that will return an set of objects, which will be used by multiple systems. At the end of the process, one (or more) of the objects will be sent back to our system for association. My service basically checks our system and gets valid solutions. I want to create a hash to validate that the obj...
Out of the two deterministic random bit generators defined in section 10.1 of NIST SP 800-90A (i.e. based on hash functions), which one is cryptographically stronger? Hash-DRBG (Section 10.1.1) HMAC-DRBG (Section 10.1.2) Is there any other criteria to select between these two?
A secret even permutation $P$ of the set of non-negative integers less than $n$ is chosen. That might be a Feisltel cipher with a random key. We are given in sequence the $P(x)$ for $x$ from $0$ to $n-3$, and must output the ordered pair $(P(n-2),P(n-1))$. What's an efficient online algorithm for that? What’s a practic...
How can we generalize the conversion of Diffie-Hellman to El Gamal public-key encryption scheme? The goals is to be eventually able to show that any 2-round key-exchange protocol can be converted into a public encryption scheme that is CPA-secure. The 2-round key-exchange protocol mentioned should satisfy the requireme...
I'm trying to calculate how many possible combinations of files there can be using a signed 64-bit file length, but can't seem to find a formula (or I'm using the wrong keywords). For example, the number of unique files that have a length of 256 bytes is $2^{256*8}$ = $2^{2048}$. I assume the total number of combinatio...
I recently learned about the hashing algorithm bcrypt, which allows you to specify a "work factor" for the hash which can be incremented to stay ahead of Moore's Law. I understand there are some other hashing algorithms that also do this. Are there any two-way encryption algorithms with this property? For example, I'd ...
Proving the security of a scheme with the random oracle model (ROM) involves two steps: first you prove that the scheme is secure in an idealized world where a random oracle exists, and then you implement this scheme in the real world by replacing the random oracle with a hash function. Why wouldn't you prove the secu...
I was wondering whether plain RSA encryption can be cracked given: The public key A plaintext of a known cipher text(s). In other words the decrypted message from an encrypted one (but without knowing the private key) I.E.: you have managed to find the plaintext of an already encrypted message using the public key,...
I'm implementing the HASH_DRBG algorithm. As per NIST-SP800 90 document for HASH DRBG Generation, section 10.4.1 "Derivation Function Using a Hash Function (Hash_df)", the Hash_df algorithm contains this step 4.1: temp = temp || Hash (counter || no_of_bits_to_return || input_string). I believe || here represents "app...
Section 8, Security considerations, of RFC3526, which defines groups used for Diffie-Hellman has a table recommending some random exponent sizes. In particular, it says: The strength of a key exchanged using the 1536 bit group has about 90 bits strength for a 180 bit random exponent about 120 bits of strength for a 2...
The initial counter value can actually be thought of as a sort of IV, which I assume is safe to transmit with the ciphertext, but I really want to be sure that this is indeed safe.
I'm working on problem 12.4 from Katz-Lindell. The problem is as follows: Given a public encoding function $\newcommand{\enc}{\operatorname{enc}}\enc$ and a textbook RSA signature scheme where signing occurs by finding $\enc(m)$ and raising it to the private key $d \bmod N$, how can we demonstrate the scheme's i...
For RSA and El Gamal (and most other public key cryptosystems), one of the key ideas is that factoring and finding discrete logarithms are hard. There are other systems that rely on certain properties of lattices. What are the other one-way-ish functions that have cryptosystems designed around them?
I understand the need for padding in MD5 and other hash algorithms such as SHA-1, SHA-256, SHA-384 and SHA-512. But why do we append the message length to the padding? I heard it strengthens the hash but how? Please provide an example if possible and how it applies to this quote: The inclusion of the length-block effe...
Is there an example of two known strings which have the same MD5 hash value (representing a so-called "MD5 collision")?
An authentication and key-agreement protocol between devices shall mutually demonstrate their identity, and establish a shared random secret $R$ suitable for securing later communications. To that purpose, each of the many devices receive a certificate from a certification authority, binding their identity $ID_i$ (incl...
Why do we use modular arithmetic so often in Cryptography?
I do not know if the question lies exactly in that field but I'll give it a try unless rejection. I want to study methods of applying LSH functions to feet in a specific area of digest values. Briefly i would like to control the results of hash functions such as "similar" inputs (similarity is defined by an LSH algorit...
What is the definition of textbook or "raw" RSA? What are some of the properties of textbook RSA? How does it differ from other schemes based on RSA?
Here on the ElGamal wikipedia page http://en.wikipedia.org/wiki/ElGamal_encryption Alice generates an efficient description of a multiplicative cyclic group G, of order q, with generator g. How is this done? What are some of the properties here?
I am new to here, I was having some problems with a problem I am working on: "For each of the following variants of the definition of security for signatures, state whether textbook RSA is secure and prove your answer: (a) In this first variant, the experiment is as follows: the adversary is given the public key $pk=(...
Trapdoor functions are a fundamental part of public key cryptography. An example of the most common trapdoor is Prime Factorization, used in cryptosystems such as RSA How are these trapdoor functions found?
How we can solve this equation and get the value of M? $$8 = M^{13} \mod 33$$ not a computer program, but a mathematical operation.
I'm not sure what SSL uses to share the symmetric key to both end users, i.e. at the beginning of the communication. Is it RSA? Or El-Gamal? Or something else?
I'm working on implementing a cryptographic system and I'm trying to understand the Zero Knowledge Password Proof concept. So here's some background: To generate a secret key I am: Doing an ECDH key exchange and generating 2 secret keys. One key is to encrypt messages and the other key is to HMAC sign the data. To der...
How does GPG (or other programs using the OpenPGP file format) verify that it has succeeded with decryption (for symmetrically encrypted data)? Is something appended to the clear text so there exist some expected data? For example, I'm using these command lines: gpg -c test.txt gpg -d test.txt.gpg The second command o...
One difference between RSA and ElGamal is that ElGamal isn't necessarily deterministic (while RSA is). What makes it non-deterministic? Is this advantageous to security? How else does this property affect ElGamal encryption or the ElGamal signature scheme?
Show that if $n = 35$ is used as an RSA modulus then the encryption exponent $e$ always equals the decryption exponent $d$? What I have so far: $n = 35$ Therefore $p = 5$ and $q = 7$ or vice versa, which means Euler's phi function is $\varphi = (5-1) \cdot (7-1) = 24$ Then to find $e$ we need the fact that $\gcd(e,\va...
Question: Suppose A encrypts a number $x$ which indicates her bid on a contract, using ElGamal encryption. Say that the encryption of $x$ produces a ciphertext $c$. Explain how E can modify $c$ to make it an encryption of $100 \cdot x$. Answer: E is exploiting the malleability of ElGamal. She can take the ciphertext p...
Show how if Alice uses the same value of $k$ to sign two different messages $m_1$ and $m_2$, using the ElGamal signature scheme, Eve can recover the value of $a$ from the corresponding signatures $(m_1, r_1, s_1)$ and $(m_2, r_2, s_2)$. (Note: you are allowed to assume that if $\gcd(a, n) = d$ then there are $d$ soluti...
Affine Cipher: $Enc(x) = (ax + b) \mod m$ $Dec(x) = a^{-1}(x-b) \mod m$ For a brute-force key search, we need to do $a \cdot b$ encryptions in the worst case. For a meet-in-the-middle attack, how many encryptions/decryptions do we need to do in the worse case? Meet-in-the-middle attack definition: Affine cipher can be...
If there are 4 people involved, and every two of them should be able to know the secret (the polynomial is just a line) and you are given $f(x)$ and $x$ for each of those people, and you know exactly one of them is a cheater, how do you find the cheater?
Depending on the framework you are using, there are various padding modes that can be used with AES encryption. For example, with .NET we can choose PKCS7, ISO10126, ANSIX923, Zeros or None. I understand that the encryptor and decryptor need to use the same mode to be interoperable. What considerations are there when c...
Imagine I have a blob that I want to encrypt-then-MAC. Now, what I can realistically ask my users for (out of UX considerations) is just an encryption password. Naturally, I bcrypt original password and use bcrypted value as an encryption key. Using the same key for MAC purposes seems risky to me, so I reckoned I'd has...
Suppose a message $m$ is divided into blocks of length $160$ bits: $m > = M_1 || M_2 || ... || M_l$ And define $h(m) = M_1 \oplus M_2 \oplus ... \oplus M_l$ Which of the three desirable properties of a good cryptographic hash function does h satisfy? Show that it does not satisfy the other two. Three desirable pro...
How are the three problems Discrete Logarithm, Computational Diffie-Hellman and Decisional Diffie-Hellman related? From my understanding, since the Discrete Log (DL) Problem is considered hard, then so is CDH. And since CDH is considered hard, then so is DDH. On the Wikipedia article for DDH it mentions that DDH is con...
So I'm trying to properly implement the EKE protocol and I'm using C# with the Windows CNG and ECDH key exchange. I need to use this because it's FIPS certified and all that jazz. So what I'm understanding about EKE is the fact that it depends on the fact that the public keys are completely randomized, therefore not ve...
From RFC 4226 I understand how HOTP generates one-time passwords by incrementing a counter and uses the 'look-ahead' window to try to resynchronise (from this counter), if the user tries a few wrong passwords. Say the user leaves their token with their cat, which decides to generate 200 passwords while rolling around w...
We're using the Objectivity/DB object database with a custom encryption plugin that encrypts serialized objects on disk. Encryption uses AES with a shared secret key held by all users. I would like to be able to provide some guidance to users if they enter the "wrong" shared encryption key (as in "I think you mistyped ...
I want to be able to verify the integrity of a ciphertext by providing the cleartext hash, for this to work it would need to: $$hash(crypt(cleartext)) = f(hash(cleartext))$$ Where $f$ is an arbitrary function mapping the cleartext hash to the ciphertext hash. Is there such a pair? Update: I'm trying to prove the integr...
At least it's my understanding that AES isn't affected by known-plaintext. Is it immune to such an attack, or just resistant? Does this vary for chosen-plaintext?
I am familiar with Challenge-Response Authentication scheme. However I would like to know actual message content sent between client and server for 1 way authentication, over an insecure channel. When the user enters the password, is the password encrypted and sent, or is the hash of the password encrypted and sent? ...
Is there any reasonable homomorphic encryption protocol that supports some meaningful fragment of regular languages/expressions and/or edit distance bounds? I'm suspicious that homomorphic encryption never handles this sort of "insert bounded amount of arbitrary garbage", but maybe a subset of regular expressions with ...
Is there's a way for someone (with the key) to decrypt a message encrypted with the cipher mode shown? $$ P_0 = IV $$ $$ C_i = P_{i-1} \oplus E_K(P_i) \oplus P_i $$
Does an attacker gain any advantage by knowing which initialisation vector was used for encryption?
I'm curios about protocols which leak considerable personal information, like instant messaging exposing the contacts relation. How does one make an instant messaging protocol which is resistant to traffic analysis? I'm interested most specifically in server side attacks on users' contacts/friends lists. In particula...
I'm looking for a related key scheme for elliptic curve cryptography. The basic idea would be that there would be a master public key and a master private key. From the master public key, you could generate a series of public keys. From the master private key, you could generate the corresponding series of private keys...
A signature of some data can mean many different things, such as: This is a message I sent, this is a certificate I validated,... So I was surprised that common signing schemes don't include a "purpose" parameter as part of the signature. In particular I didn't find such a parameter in the schemes from PKCS#1. Other me...
I've been trying a long time to understand a thing which is obviously extremely simple, but I just can't get it. Read this, please: The NTRUEncrypt PKCS uses the ring of truncated polynomials $R$ combined with the modular arithmetic described in Section 1. These are combined by reducing the coefficients of a polynomia...
I am currently using AESManaged encryption for my silverlight application. Does AESManaged encryption have a severe trade compliance issue in Bureau of Industry and Security in terms of shipping the application internationally?
Assuming that the salts are sufficiently long (16 random chars) is there any advantage in using a per-application salt in addition to a per-secret salt when storing hashed passwords in a database? The per-application salt would held in the code. The per-secret salt would be held in plain text on the same database entr...
According to Wikipedia: Related-key attacks can break AES-192 and AES-256 with complexities $2^{176}$ and $2^{99.5}$, respectively. What are the requirements for these attacks (i.e how many related keys, what should the relationship between the keys be)? Optionally, how do the attacks work in summary?
I'm revising for a cryptography exam at the moment and I'm having some problems with a question. The question looks for the key length of a cipher given that the word "earthquake" appears in the plaintext. Ciphertext: aaatr ksams itahb netrs weurs rheti aadne ttrht eakgt snqid s I was wondering how I use the fact that...
Instead of using actual data for one time pads, what would be different if the code for an algorithm was exchanged so that to acquire the pad one would execute the algorithm and use its output? Why is this not being used? An algorithm would be much shorter and could generate a significant amount of chaotic information...
Recently, a user on Gaming.SE asked a question about whether the user password in the video game Uplink could be modified after being initially set. The game does not contain an option to change the password, and the password is repeatedly displayed in plain text throughout in the game. Obviously, this is a problem i...
Ever since the SHA-3 competition, I've been wondering if it is possible to create a hash algorithm that is easier to parallelize. The current algorithms all seem to require building a tree of hashes. This has however rather serious drawbacks: as they requires a tree with certain parameters (such as the size of nodes a...
In c#, there is a namespace called System.Security.Cryptography and there are many classes in this namespace, which help developers encrypt and decrypt data. However, always they take byte[] array and they return byte[] array. So, as a developer, you have to always write a library to get the clear-text, turn it into by...
I'd like to encrypt files deterministically, such that any users encrypting the same plaintext will use the same key and end up with the same ciphertext. The ciphertext should be private as long as the plaintext is. I plan to use AES-128-CTR with an IV of 0 and the SHA-256 of the plaintext as the key. IV values are req...
I originally posted this question in the mathematics section, you can see it here. Let $p$ and $q$ be large primes, $n=pq$ and $e : 0<e<\phi(n), \space gcd(e, \phi(n))=1$ the public encyption exponent, $d : ed \equiv 1 \space (mod \space \phi(n)) $ the private decription exponent, and $m \in \mathbb{Z_n}$ the plaintext...
In the comments of the question "Why programming languages don't provide simple encryption methods?" the following statement was made: A well thought out, tested and understood standard that has undergone extensive review by the crypto community has a much better [chance] of avoiding compromise than a system desig...
I wish to simulate an implementation of a DES Cracker using verilog. But every paper I read give only abstract hints but no concrete steps or how really to go about it. How is it usually done? For example for DES encryption there exists a sequence of steps with ordered connection of known blocks.
I am an electronics and communication engg student currently doing my 3rd year second semester. i am interested in info coding and the security aspects of it. As an ECE student i want to know what is the scope of cryptography in my field. and i also want to know about the projects that i can take up in the field of cr...
Suppose someone had generated a 2.048-Bit RSA GPG/PGP key pair and published the public key on the usual key servers. Then he withdraws this key and generates a new one in 4.096-Bit RSA using the same passphrase again. Theoretically, can the passphrase be cracked by mathematically comparing the two public keys or does ...
If I have a 1024-bit number, and someone is telling me that it is in fact a valid RSA public key, is there any way I can quickly validate that it is indeed so (without cracking RSA)? (I suppose I am asking if it's possible to quickly tell if a number only has 2 prime factors)
Suppose we have two people: Smith and Jones. Smith public key is e=9, n=179 and Jones public key is e=13, n=179. Bob sends to them a message $M$. The encrypted message $C_s$ to Smith is 32. The encrypted message $C_j$ to Jones is 127 I tried to resolve this problem with no luck. First I put both of them as an equatio...
First of all, I don't recommend doing this. This was something I created when I didn't know better and didn't have a solution available to me. Long ago I created my own entropy gather for a cryptography project. I used a window and had the user type with the keyboard while moving and clicking the mouse. I kept the mill...
Random.org provides true random numbers through an unsecured web service. Since these numbers would be transmitted in plaintext could they still be considered useful as true random numbers while maintaining security in a cryptographic solution? At first I was thinking if a large pool of them was obtained then a small s...
The ISAAC site claims it is secure, but I wasn't aware of any trusted 3rd party sources that verified its security.