XOR bitwise operation (article) | Ciphers | Khan Academy (2024)

Want to join the conversation?

Log in

  • max dml

    9 years agoPosted 9 years ago. Direct link to max dml's post “I'm not sure to understan...”

    I'm not sure to understand why XOR is more difficult to revert than AND or OR. Are the two later possibly reversible anyway? What kind of clue could Eve get from such a string if she knew it was AND-ed or OR-ed?

    (14 votes)

    • JaniceHolz

      9 years agoPosted 9 years ago. Direct link to JaniceHolz's post “AND is not always reversi...”

      XOR bitwise operation (article) | Ciphers | Khan Academy (4)

      XOR bitwise operation (article) | Ciphers | Khan Academy (5)

      AND is not always reversible. For example, 1010 AND 1110 => 1010, but also 1011 AND 1110 => 1010, so I cannot always tell what my original number is if I use AND.
      Similarly with OR, 1010 OR 1110 => 1110, but also 0000 OR 1110 => 1110.

      I do not think XOR is more difficult to reverse if you know the pad (in fact it is very simple). However, it is impossible to reverse if you do not know the pad.

      If Eve got a string that was AND-ed, she would know that every 1 was in the original string. Similarly, if she got a string that was OR-ed, she would know that every 0 was in the original string.

      (47 votes)

  • Aalap Shah

    9 years agoPosted 9 years ago. Direct link to Aalap Shah's post “Is the ease of guessing t...”

    Is the ease of guessing the only reason why we should not use AND or OR ciphers? I was expecting the reason to be that AND and OR ciphers cannot be decrypted in many cases. As an example, if 101 is our message and 110 is our key, then the XOR-ciphertext would be 011. With the key, this can be easily decrypted to 101 again. However, the AND-ciphertext would be 100. With this and the key, we are still unable to conclude if the original text was 100 or 101. Since both are possible, this would effectively render the cipher redundant, as not even the intended recepient would be able to decipher it.

    (20 votes)

  • Vasudev Pai

    10 years agoPosted 10 years ago. Direct link to Vasudev Pai's post “how are ordinary numbers ...”

    how are ordinary numbers converted to binary numbers

    (4 votes)

    • compdoc1300

      10 years agoPosted 10 years ago. Direct link to compdoc1300's post “Suppose we want to repres...”

      XOR bitwise operation (article) | Ciphers | Khan Academy (12)

      Suppose we want to represent a decimal number as a 8 bit binary number. Is the number divisible by 2 to the 7th power? If so, our first binary digit (bit) is 1, we subtract that power of 2 from our decimal number and keep the remainder (call it r7). If not our first bit is 0 and we use the same number as our remainder. Is this r7 divisible by 2 to the 6th power? Repeat the process to get bit 2 and r6. Continue until you get to 2 to the 0th power (or 1) which gives us our last bit. So 140 is divisible by 128 (2^7) and the remainder is 12. 12 is divisible by 8 (2^3) and leaves 4 which is divisible by 2^2. So we have one's bits in the 7, 3, and 2 places and zero's elsewhere. 140 decimal = 1000110 binary.

      (15 votes)

  • SteveSargentJr

    11 years agoPosted 11 years ago. Direct link to SteveSargentJr's post “I understand how the *XOR...”

    I understand how the XOR Operator is "the same as addition mod 2", as Brit describes. However, earlier in the post he also says that the OR Operator "works just like Addition Modulo 2". According to this description, how would that make the OR Operator any different than the XOR Operator?

    (5 votes)

    • Noble Mushtak

      11 years agoPosted 11 years ago. Direct link to Noble Mushtak's post “I think Brit Cruise made ...”

      I think Brit Cruise made a mistake here, only the XOR operation is like addition mod 2. He will most likely see your post here, fix the mistake. And then respond back to you. The difference with the OR operator is that while in XOR, 1 XOR 1 = 0, in OR, 1 OR 1 = 1.

      As you can see in the OR case, OR is not the addition mod 2 operator, but XOR is. However, except for that case, XOR and OR are completely the same.

      I hope this helps!

      (8 votes)

  • Bryan Otis

    8 years agoPosted 8 years ago. Direct link to Bryan Otis's post “There should be more exce...”

    There should be more excercises for cryptography

    (4 votes)

    • ‮:) #BringBackBackgrounds

      a year agoPosted a year ago. Direct link to ‮:) #BringBackBackgrounds's post “Yeah, I agree, this is ki...”

      Yeah, I agree, this is kinda confusing.

      (2 votes)

  • Yoel Ivan

    10 years agoPosted 10 years ago. Direct link to Yoel Ivan's post “"Notice when we perform t...”

    "Notice when we perform the AND operation on any binary number, the resulting sequence cannot be larger."
    Cannot be larger than what?

    (2 votes)

    • wes.strubhar

      10 years agoPosted 10 years ago. Direct link to wes.strubhar's post “The concept, "cannot be l...”

      The concept, "cannot be larger" refers to the value of the answer. The result of the AND operation pushes values lower, since the truth table gives a zero for all cases except where both inputs are a 1. So it will output a zero for 3 out of 4 possible input combinations. More zeroes in the answer will be a smaller numeric value, and this is why it resulted in a darker output - zero is black in the color map.
      The concept is similar for the OR operation. Its truth table shows a result of a 1 in all cases except when both inputs are zero. This means 3 out of 4 possible cases will result in a 1 output, pushing the output toward favoring ones. All ones would be 255, which maps to white.

      (6 votes)

  • Joesufph

    4 years agoPosted 4 years ago. Direct link to Joesufph's post “Is XOR a word, or does it...”

    Is XOR a word, or does it stand for something

    (2 votes)

    • 1001programmer1001

      3 years agoPosted 3 years ago. Direct link to 1001programmer1001's post “I believe the X is short ...”

      I believe the X is short for eXclusive, then it is an "exclusive or" check or XOR.

      (2 votes)

  • Alexander Wu

    8 years agoPosted 8 years ago. Direct link to Alexander Wu's post “How do you read the "XOR"...”

    How do you read the "XOR"? "Ex or" or "ksor" or what?

    (2 votes)

    • Jim E

      8 years agoPosted 8 years ago. Direct link to Jim E's post “It's short for Exclusive ...”

      It's short for Exclusive OR, so "Ex or" xor "eksor" would be pretty close.

      (4 votes)

  • ☺☻☺Natth4545☺☻☺

    8 years agoPosted 8 years ago. Direct link to ☺☻☺Natth4545☺☻☺'s post “How could I make bianary ...”

    How could I make bianary addition with only Xor oporators? I was making a computer in Mario Maker and I need to know.

    (3 votes)

  • dmkgigi

    9 years agoPosted 9 years ago. Direct link to dmkgigi's post “So is possible to use XOR...”

    So is possible to use XOR and OR at the same time to get a different color since it say there is 16 million possible colors?

    (3 votes)

XOR bitwise operation (article) | Ciphers | Khan Academy (2024)

FAQs

What is a bitwise XOR operation? ›

A bitwise XOR is a binary operation that takes two bit patterns of equal length and performs the logical exclusive OR operation on each pair of corresponding bits. The result in each position is 1 if only one of the bits is 1, but will be 0 if both are 0 or both are 1.

Why is XOR extremely important in cybersecurity? ›

The primary reason XOR is so useful in cryptography is because it is "perfectly balanced"; for a given plaintext input 0 or 1, the ciphertext result is equally likely to be either 0 or 1 for a truly random key bit.

What is the operation of XOR? ›

XOR is a bitwise operator, and it stands for "exclusive or." It performs logical operation. If input bits are the same, then the output will be false(0) else true(1).

Can we use operators other than bit XOR for binary version of one time pad? ›

The answer is yes, and it's extremely important to understand why. Recall from the previous article that AND has a 75% chance of outputting 0 and a 25% chance of outputting a 1. While OR has a 25% chance of outputting 0 and 75% chance of outputting 1.

How to solve XOR bitwise? ›

For Bitwise Xor, for each bit where one input is 1 and the other 0, the output is 1. If both bits are 1 or both are 0, the output is 0 for the bit. This is a Bitwise And, Or, and Xor example.

What is XOR in simple terms? ›

(eXclusive OR) A Boolean logic operation that is widely used in cryptography as well as in generating parity bits for error checking and fault tolerance. XOR compares two input bits and generates one output bit. The logic is simple. If the bits are the same, the result is 0.

Why is XOR bad for hashing? ›

The general property you want from a hashing function is for things that are similar or that go together in some sense should hash far apart, unless they are equal. This is a property that xor gives cos it is combining them in a way that doesn't preserve any meaning of the bits relative to each other.

What are the disadvantages of XOR encryption? ›

Potential Drawbacks of XOR Symmetric Encryption

Key Management: Maintaining and updating encryption keys can become complex in large-scale systems. Known Plaintext Attacks: XOR encryption may be vulnerable to known plaintext attacks if the attacker obtains both the plaintext and corresponding ciphertext.

When would you use XOR? ›

XOR can also be viewed as addition modulo 2. As a result, XOR gates are used to implement binary addition in computers. A half adder consists of an XOR gate and an AND gate. The gate is also used in subtractors and comparators.

What is a real life example of XOR? ›

A fun example of an XOR Gate would be a game show buzzer. If two contestants buzz in, only one of them, the first to buzz, will activate the circuit. The other contestant will be “locked out” from buzzing.

What is the application of XOR gate in real life? ›

XOR gate is used extensively in error detection circuits, computational logic comparators and arithmetic logic circuits. The Exclusive OR gate gives an output only if its two inputs are dissimilar, namely if one of them is high (one) and the other is low (zero).

What is the rule of XOR? ›

Definition. “XOR” an abbreviation for “Exclusively-OR.” The simplest XOR gate is a two-input digital circuit that outputs a logical “1” if the two input values differ, i.e., its output is a logical “1” if either of its inputs are 1, but not at the same time (exclusively).

Is XOR reversible? ›

Yes, XOR's reversible nature allows it to be used for both encryption and decryption. Applying the same XOR operation with the original key to encrypted data will decrypt it.

How do you decrypt using XOR? ›

To encrypt, we simply XOR a plaintext message M with our secret key K so that M⊕K = E. To decrypt we simply XOR the encrypted message E with the same key, E⊕K = M. Conveniently, this means the same operation (or program, in our case) can be used to both encipher and decipher (or encrypt and decrypt).

What does XOR do in cryptography? ›

XOR allows you to easily encrypt and decrypt a string, the other logic operations don't.

What does the XOR instruction do? ›

The XOR instruction performs a bit wise Exclusive OR operation between corresponding bits in the two operands and places the result in the first operand.

Why is XOR used? ›

XOR is used in many encryption algorithms because it doesn't leak information and can recover the original message after encryption. Further, XOR is faster than most arithmetic operations as it runs fewer instructions and mostly uses a single CPU register for execution.

What does the XOR of two numbers give? ›

As we can see, if both bits are similar, then the XOR equals to zero. Otherwise, the result equals to one. Put differently, the bitwise XOR operation equals zero in case the number of ones is even and equals one in case the number of ones is odd.

What is the reverse of bitwise XOR? ›

To reverse an XOR cipher, you would need to perform the XOR operation again with the same key that was used to encrypt the original message. The XOR operation is a bitwise operation that takes two inputs and outputs a new value that is the result of applying the operation to each bit in the inputs.

References

Top Articles
The Science Behind Bacon
Ukraine says it seized as much land in a week as Russia so far this year. Here’s what we know | CNN
Dainty Rascal Io
Kreme Delite Menu
Lexi Vonn
Fat People Falling Gif
Citibank Branch Locations In Orlando Florida
Ret Paladin Phase 2 Bis Wotlk
The Daily News Leader from Staunton, Virginia
Mohawkind Docagent
30% OFF Jellycat Promo Code - September 2024 (*NEW*)
Swimgs Yung Wong Travels Sophie Koch Hits 3 Tabs Winnie The Pooh Halloween Bob The Builder Christmas Springs Cow Dog Pig Hollywood Studios Beach House Flying Fun Hot Air Balloons, Riding Lessons And Bikes Pack Both Up Away The Alpha Baa Baa Twinkle
Roblox Character Added
The Many Faces of the Craigslist Killer
PGA of America leaving Palm Beach Gardens for Frisco, Texas
Planets Visible Tonight Virginia
Cvs Learnet Modules
Oppenheimer Showtimes Near Cinemark Denton
Theresa Alone Gofundme
Best Uf Sororities
Labby Memorial Funeral Homes Leesville Obituaries
The Old Way Showtimes Near Regency Theatres Granada Hills
Ford F-350 Models Trim Levels and Packages
Morse Road Bmv Hours
Ontdek Pearson support voor digitaal testen en scoren
6 Most Trusted Pheromone perfumes of 2024 for Winning Over Women
Hannaford Weekly Flyer Manchester Nh
Hesburgh Library Catalog
Tuw Academic Calendar
Catchvideo Chrome Extension
Access a Shared Resource | Computing for Arts + Sciences
How To Improve Your Pilates C-Curve
Florence Y'alls Standings
3473372961
Graphic Look Inside Jeffrey Dresser
Gwen Stacy Rule 4
Tgh Imaging Powered By Tower Wesley Chapel Photos
Unlock The Secrets Of "Skip The Game" Greensboro North Carolina
Skip The Games Ventura
October 31St Weather
Daily Jail Count - Harrison County Sheriff's Office - Mississippi
Raisya Crow on LinkedIn: Breckie Hill Shower Video viral Cucumber Leaks VIDEO Click to watch full…
Can You Buy Pedialyte On Food Stamps
Ludvigsen Mortuary Fremont Nebraska
15 Best Things to Do in Roseville (CA) - The Crazy Tourist
About My Father Showtimes Near Amc Rockford 16
Amc.santa Anita
Memberweb Bw
Squalicum Family Medicine
Das schönste Comeback des Jahres: Warum die Vengaboys nie wieder gehen dürfen
Room For Easels And Canvas Crossword Clue
Noaa Duluth Mn
Latest Posts
Article information

Author: Barbera Armstrong

Last Updated:

Views: 6343

Rating: 4.9 / 5 (79 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Barbera Armstrong

Birthday: 1992-09-12

Address: Suite 993 99852 Daugherty Causeway, Ritchiehaven, VT 49630

Phone: +5026838435397

Job: National Engineer

Hobby: Listening to music, Board games, Photography, Ice skating, LARPing, Kite flying, Rugby

Introduction: My name is Barbera Armstrong, I am a lovely, delightful, cooperative, funny, enchanting, vivacious, tender person who loves writing and wants to share my knowledge and understanding with you.