Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8824331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:35:10+00:00 2026-06-14T06:35:10+00:00

So I have a problem where I want to xor various hex strings, convert

  • 0

So I have a problem where I want to xor various hex strings, convert them to regular english strings, then re-convert them to hex strings. I’m not really familiar with working with hex or xor in any meaningful way, however. Do I need to convert the hex to binary or unicode before I perform a bitwise xor operation? If so, how do I retrieve the hex values once that is done? I’ve been looking into using str.encode(‘hex’) and str.decode(‘hex’), but I keep getting errors saying that I am using non-hexadecimal characters. In short, I’m totally lost.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T06:35:11+00:00Added an answer on June 14, 2026 at 6:35 am

    Python has an XOR operator for integers: ^. Here’s how you could use it:

    >>> hex(int("123abc", 16) ^ int("def456", 16))
    '0xccceea'
    

    EDIT: testing with long hex strings as per your comment:

    >>> def hexor(hex1, hex2):
    ...     """XOR two hex strings."""
    ...     xor = hex(int(hex1, 16) ^ int(hex2, 16))
    ...     return xor[2:].rstrip("L")  # get rid of "0x" and maybe "L"
    ... 
    >>> import random
    >>> a = "".join(random.choice("0123456789abcdef") for i in range(200))
    >>> b = "".join(random.choice("0123456789abcdef") for i in range(200))
    >>> a
    '8db12de2f49f092620f6d79d6601618daab5ec6747266c2eea29c3493278daf82919aae6a72
    64d4cf3dffd70cb1b6fde72ba2a04ac354fcb871eb60e088c2167e73006e0275287de6fc6133
    56e44d7b0ff8378a0830d9d87151cbf3331382b096f02fd72'
    >>> b
    '40afe17fa8fbc56153c78f504e50a241df0a35fd204f8190c0591eda9c63502b41611aa9ac2
    27fcd1a9faea642d89a3a212885711d024d2c973115eea11ceb6a57a6fa1f478998b94aa7d3e
    993c04d24a0e1ac7c10fd834de61caefb97bcb65605f06eae'
    >>> hexor(a, b)
    'cd1ecc9d5c64cc47733158cd2851c3cc75bfd99a6769edbe2a70dd93ae1b8ad36878b04f0b0
    43281e94053d689c3f5e45392af75b13702e7102fa3e0a990ca0db096fcff60db1f672561c0d
    cfd849a945f62d4dc93f01ecaf30011c8a6849d5f6af293dc'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have problem with encoding data in Oracle database. I want to xor string
I have smalll problem i want to convert unicode into Multi byte is there
Hi i have a problem i want to test if my string is not
I have this problem: I want to generate a new source code file from
I am using GWT/JAVA for development. I have following problem: I want to remove
I have a problem and I want to implement the MVC pattern to my
I have a problem when I want to sending data using byte format in
I have problem, when I want add Node to my GUI from other Thread.
I have problem with fancybox. I want to write a function that will run
I have problem with HTTP headers, they're encoded in ASCII and I want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.