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 8155079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:33:54+00:00 2026-06-06T16:33:54+00:00

I am looking for a way that I can do bitwise operations (for crypto

  • 0

I am looking for a way that I can do bitwise operations (for crypto so mostly xor) on hex strings which could possibly be longer than I would want to fit in a Long. As an example I could have a lengthy hex literal I want to xor with other data. Below is an example of what I want to do and how I am doing it now but I believe at some limit the computer will hit it’s limit in what it can put in Long so how can I do this more robustly?

#assuming lengths of messages are correct and key length as well
old_hex = "top secret ascii message".encode('hex')
encoded = "09e1c5f70a65ac56e55ac519458e7e53f36" #a literal hex encoded string
key_hex = int(old_hex,16) ^ int(encoded,16) #this currently works because this fits in Long
new_hex = "my new message to send 2".encode('hex')
ans_hex = key_hex ^ int(new_hex,16)

print 'old message in hex: 0x'+old_hex
print 'found a key in hex: '+str(hex(key_hex))
print 'new message in hex: 0x'+new_hex
print 'new message encode: '+str(hex(ans_hex))

So I will want to do XORs on longer strings that this and I am afraid they will not fit in a Long variable so how can I get around this? Do I have to break the string up into smaller chunks and do each part through the operation?

  • 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-06T16:33:56+00:00Added an answer on June 6, 2026 at 4:33 pm

    I believe at some limit the computer will hit it’s limit in what it can put in Long

    Yes, there is a limit but that limit is huge. Eventually you will run out of memory, but the same could happen with strings. Python’s integer type will work fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking for a way that I can keep a database in one single
I'm looking for a way that I can take say, a 200x200 pixel image
I'm looking for a way that I can parse command line arguments into my
I am looking for a way that I can query a database with multiple
I'm looking for a way to create a data access layer that can either
Hey! i'm looking for some way that can help me in task like this:
I'm looking for a way that I can create a simple modal window (or
I'm currently looking for a way that I can build a scheduling system that
I am looking for a way to get the bitwise XOR of two images
I'm looking for any way that I can improve the selector performance of a

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.