Questions tagged [xor]

XOR, often written ⊕, is one of the basic operations on bits and bit-sequences. It is a building block of many cryptographic primitives (and some higher-level algorithms, like modes of operations).

Filter by
Sorted by
Tagged with
10
votes
5answers
2k views

Why is XOR preferred over XNOR?

The XOR operator seems to be a frequently used building block inside many cryptographic primitives. As far as I can see, its most desirable properties seem be that for the XOR of two bits $a\oplus b=...
0
votes
0answers
33 views

implementation problems with xor cipher [migrated]

I tried to reimplement the simple Xor cipher in the book Applied Cryptography Protocols, Algorithms, and Source Code in C A book by Bruce Schneier using python. The ...
1
vote
1answer
279 views

Decrypting a vigenere cipher with a reused one-time pad

I understand that when a plaintext is encrypted with a key of the same length, it is referred to as a one-time pad. Now when this key is reused to encrypt another plaintext, there is potential for ...
0
votes
1answer
73 views

Secret Sharing between $x$ parties

So for an unknown number of parties $x$, I make $x-1$ random $n$-bit strings represented by {$r_1, r_2,...,r_{x-1}$}. Where $s$ is the complete string split up between $x$ parties (yes?). I then ...
9
votes
1answer
120 views

GCM mode of operation with long-term keys

Regarding GCM, NIST specifies the following: The total number of invocations of the authenticated encryption function shall not exceed $2^{32}$, including all IV lengths and all instances of the ...
1
vote
1answer
36 views

Definition of diffusion matrix

I've been studying this article and since I'm not studying cryptography in English and it is not my native language, I don't understand some of the terminology. More precisely: what are diffusion ...
1
vote
1answer
148 views

ChaCha20: is this a potentially safe way of using nonce derived from private key if the key/nonce pair is never reused, for a given plaintext?

Note: I realize in ChaCha20 the nonce should be random and unique each time follow certain constraints but am trying to determine whether there could be a safe way to use it just once if other ...
1
vote
1answer
40 views

How to handle multiple key-agreements

If I would use two different key-agreements e.g. SIDH and ECDH how would I handle these both derived keys? Is there a different between XOR or SHA-256 the two keys? (Would one reduce the level of ...
4
votes
1answer
399 views

Salsa20 Implementation: Sum of 2 Words with Carries Suppressed

I'm working on the 2nd part of the Salsa20 spec, and I want to implement a closure for the exclusive-or of two words(u32). The author defines the operation as the sum of two words with carries ...
0
votes
1answer
53 views

Why is this OTP decryption wrong? [closed]

i have a problem that goes: ...
0
votes
2answers
160 views

XOR and key reuse [duplicate]

I've been doing a bit of reading on the use of XOR and the dangers of key reuse. I'm aware that reusing a key can open a door for a frequency analysis attack on my plain text. So far, everything ...
3
votes
1answer
145 views

Circular hash collision where digest is pre-image: Could hash(a) = b, hash(b)=c, then hash(c)=a?

For any SHA-family of algorithms (including Keccak) except for SHA1, would it be theoretically possible for there to exist a pre-image a whose hash digest ...
2
votes
1answer
667 views

Does XOR'ing a random number with its inverse reduce its security if the result is a palindrome?

[And four related questions/examples below:] 2) If a random 256-bit number is XOR'ed with its reverse (i.e. the big-endian version XOR'ed with the little-endian version), does this reduce the ...
2
votes
1answer
906 views

One-time pad XOR question

For a one-time pad to be truly secure, do I need to use XOR? In other words, is a numerical OTP as secure as a XORed one? I'm new to cryptography, so this might not even make sense.
5
votes
2answers
609 views

Using a one-time pad with a block cipher

The one-time pad is often described with a simple XOR cipher. This is nice for showing the theoretical strengths of the one-time pad, but not so great in real-world scenarios where key reuse is a ...
6
votes
1answer
1k views

Hash functions to generate a one-time pad

Maybe this is a newbie question: Stream cypher, will XOR message bits with one-time pad bits. Suppose I have a pseudorandom number generator, like a Mersenne Twister or something similar. I could use ...
5
votes
2answers
187 views

Collision resistance of partial SHA-256 hashes XOR'ed

My hashing algorithm computes the SHA-256 for each of 12 input strings and XORs them to get the final hash. Is there a risk of an attacker being able to forge 2 sets of inputs that yield the same ...
-2
votes
3answers
984 views

Why the AES perform encryption in 10 rounds Instead of one?

I'm a Master's Degree student and researching about AES-128 encryption. My Advisor asked me a question about necessity of iterative rounds in AES. he asked:"why we couldn't encrypt a 128-bit plaintext ...
0
votes
1answer
286 views

What's the number of unique possible Cayley tables in a 16*16 grid for XOR'ing single hex characters?

A few days ago, I designed and s-box then derived the following Cayley table of all possible XOR outputs of hex digits in the range of ${2^4}$ and was curious how many such "valid" possible ...
1
vote
2answers
623 views

What are the vulnerabilities of XOR in the following scenario?

What are the security vulnerabilities of the XOR operator in the following scenario: The Key, The Cyphertext and the Plaintext are the same size in bits. The Key is only used once and it's secret The ...
1
vote
2answers
79 views

OTP with fixed plaintext

I have just learned about the OTP, how it uses XOR, and how it's secure if the keys are random. But what will happen when the same plaintext is used again with a new key? $c_1 = k_1 ⊕ p$ $c_2 = k_2 ...
0
votes
0answers
57 views

Can I use XOR to establish a longer shared secret?

SIKEp434 can only be used to encapsulate a 16 byte (128 bit) shared secret key. Most encryption algorithms these days (specifically (X)ChaCha20) require a 256 bit key to be secure, especially in a ...
-1
votes
2answers
399 views

How to find the key of XOR encryption in Java?

I am trying to find the key of an XOR-encrypted string in Java. It is very probable that the key is eight characters long. I have the encrypted string. I do not understand how to go backwards and ...
4
votes
2answers
117 views

What are linear and non-linear elements in cryptography?

I was reading this answer, How secure is XOR for encryption, and it stated that XOR's aren't good for securing messages as they are linear in Nature. And therefore should be paired with some non-...
2
votes
2answers
2k views

Calculating XOR Key Sizes [duplicate]

I've been playing around with the Matasano crypto challenges (cryptopals.com). I had a couple false-starts on the challenge that has you creating a program to calculate the key size of a XOR encrypted ...
1
vote
3answers
9k views

How to XOR two hexa numbers by hand fast

I have an upcoming exam where I can use a simple Calculator. On some sample questions they ask us to XOR two values (for AES round key) and I know how to write it out by hand but is there any other ...
1
vote
2answers
233 views

What are the implications of XORing ciphertext with plaintext?

I was intrigued by this question: Does adding complexity mean a more secure cipher? And it led me to wonder: What are the implications (if any) of XORing a ciphertext with the original plaintext ...
1
vote
1answer
188 views

Help understanding how to decrypt cipher

I am trying to create a padding oracle attack to decrypt a cipher that is encrypted with cbc and PKCS#7 padding. My first step is just to try and decrypt the second block. I have read a lot about it,...
1
vote
0answers
65 views

Hamming distance in xor decryption

I've been working on cryptopals 1.6, breaking xor and have got it working. I found this answer that explains why hamming distance works and I think after some thinking I believe I'm starting to ...
3
votes
1answer
201 views

What are the disadvantages of XOR key derivation?

Assume a 256-bit Key and a 256-bit Salt, with uniformly distributed entropy, both fully independent. Assume ...
1
vote
0answers
100 views

How can I calculate the feasibility of brute-forcing missing secret shares against the secret checksum?

Secret sharing has the problem of player cheating, where a forged share $s'_i$ can be sent to generate a fake secret $m'$ during reconstruction (and the cheaters can even collude to generate the real ...
0
votes
0answers
65 views

How to determine if a generalized $\sigma$ function (similar to what is defined in SHA-2) is invertible?

Let $ROTR^n(x)$ and $SHR^n(x)$ denote the rotate right (circular right shift) and the right shift operations, as defined in SHA-2 standard. Consider any function of the form $$f(x) = ROTR^{n_1}(x) \...
0
votes
0answers
24 views

XOR operation to uncover plain-text out of given cipher-texts [duplicate]

I have a set of 11 hex coded strings that have been encrypted using XOR operation each with the same stream cipher key. How do I decrypt the 11th hex-coded string to arrive at the plain-text without ...
5
votes
2answers
239 views

Is there an efficient 2 out of 3 secret sharing scheme based on XOR?

I want to know if there is an efficient secret sharing scheme based on XOR such that a share of the message is given to three people and at least two must combine their share in order to construct the ...
0
votes
0answers
44 views

Storing secrets on a peer-to-peer network by splitting up AONT data

I've come up with a way to transform a stream of bytes such that if any single bit is modified, it cannot be transformed back into its original state. Here's how it works: Encoding Get hash ...
4
votes
2answers
423 views

XOR Encryption with bcrypt password de-biasing

Objective: To have a very simple to verify, but very secure small message encryption. Idea: Message ⊕ bcrypt( Password). We remove password biases with bcrypt ...
4
votes
2answers
118 views

Why is this MAC flawed?

Consider a function to create a tamperproof cookie as follows: $$\text{cookie}(m, k) = m \| \text{hash}(m \oplus k)$$ where $m$ is a message provided by Alice, and k is a secret key known only to ...
1
vote
1answer
90 views

Reducing the XOR's in Implementation Cost

Suppose that we want to implement the following equations in binary finite field. $$ \begin{array}{l}\tag{1} y_{{1}}=x_{{1}}\oplus x_{{2}}\oplus x_{{7}}\oplus x_{{8}},\\ y_{{2}}=x_{{1}}\oplus x_{{2}}\...
0
votes
1answer
92 views

Multiplication instead of Key Derivation Function?

context In a one message communication. We are right after 2 DHKE (instead of one). Both users then have 2 secret numbers, J and K. question Is it a risk to replace the use of a Key Derivation ...
25
votes
3answers
8k views

repeating-key xor and hamming distance

I read that to break repeating-key xor you can do the following: try a keysize $n$ and compute the hamming distance between the first $n$ bits of the encrypted string and the bits $n+1$ to $2n$ of the ...
1
vote
1answer
776 views

Decrypt simple CBC with XOR

I have searched and my problem is exactly the same as shown here: Decrypt simple CBC message with known IV using XOR encryption However, when I implement the solution it doesn't work, neither does ...
0
votes
1answer
121 views

How to break RSA signature on XOR of hashed blocks

I'm trying to figure out if there's a way of breaking or weakening the following method of signing long messages Given $M=m_{1}m_{2}...m_{n},\,\,|m_i|=64b, \,\,h=h(m_{1})\oplus h(m_{2})\oplus\cdots\...
2
votes
1answer
84 views

Attacks on one-time pad, given a property of keys

An adversary $A$, eavesdrops $n$ cipher-texts, $c_{1}, c_{2} ..., c{_n}$. It also knows a value $v$ and a function $f$ such that $$f(k_{1}, k_{2}, ..., k_{n}) = v$$ where, $k_{i}$ is used to encrypt $...
1
vote
1answer
101 views

Is this MAC correct and secure?

Let $m \in \{0, 1\}^{2n} = m_1 || m_2$. Let's also assume that $F_k$ is a PRF and $G$ is a PRG defined as $G: \{0, 1\}^n \rightarrow \{0, 1\}^n$. Now, Let's define the $MAC$ scheme as follows: $$MAC(...
4
votes
0answers
81 views

Upgrading key derivation by adding a XOR with a known value

In general keys for password based key derivation are derived from a password hash such as the old PBKDF2 function or Argon2, possibly followed by another derivation function to derive data and ...
1
vote
2answers
104 views

How is n-bit security calculated with nested encryption?

What will the total $n$-bit security be if I encrypt a message with a 128-bit XOR cipher and then take that ciphertext and encrypt it with a 128-bit key. Is the total security level now 256? One ...
1
vote
0answers
71 views

Is this a PRP? How can I create a distinguisher to show it isn't?

Consider the keyed permutation $F_k : \{0,1\}^2 \to \{0,1\}^2$ with two-bit keys defined as $F_k(x) = k\oplus x$. Is this F a PRP? How can I create a distinguisher D and calculate the difference ...
1
vote
2answers
164 views

Is it possible to use crib drag on base64 cipher text?

I am pretty new to the cryptography scene but I wanted to know if it is possible to use crib dragging on cipher text which doesn't contain words? This data would be encrypted using the same key with a ...
18
votes
1answer
27k views

How to attack a “many-time pad” based on what happens when an ASCII space is XORed with a letter?

I've already sent my correct solution to a homework exercise from Dan Boneh's Introduction to Cryptography class on Coursera: "Let us see what goes wrong when a stream cipher key is used more than ...
2
votes
2answers
334 views

Replacement for XOR in CBC?

In CBC mode, the XOR operation is used to combine the previous encrypted block with the current plaintext, to be used as the block to encrypt. Apart from other known disadvantages inherent to the mode ...