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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:03:11+00:00 2026-06-12T01:03:11+00:00

I am trying to XOR two large binary values. However, echo ${hashArray[1]} echo ${hashArray[2]}

  • 0

I am trying to XOR two large binary values. However,

echo ${hashArray[1]}
echo ${hashArray[2]}
echo $((${hashArray[1]} ^ ${hashArray[2]}))

gives:

10100100000111101011100001101110000110000100001000000111001001100010110000010010111101100110111001111100010010000000010101110111

00001110110000010110101101011011100101101000011100011101001101101010000100110001001110101101111100010001111010100011010000000100

4018181242766406943

Why does echo $((${hashArray[1]} ^ ${hashArray[2]})) output a decimal number? Shouldn’t it be another large binary value?

  • 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-12T01:03:13+00:00Added an answer on June 12, 2026 at 1:03 am

    Do it “bitwise” like that:

    #!/bin/bash
    
    a="101"
    b="011"
    
    out=""
    for ((i=0; i < ${#a}; i++ )); do
       out=${out}$((${a:$i:1} ^ ${b:$i:1}))
    done
    
    echo ${a} ^ ${b} = $out
    

    output:

    101 ^ 011 = 110
    

    edit: The inputs need to have the same length!

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

Sidebar

Related Questions

I'm trying to XOR binary values but for some unknown reason I'm losing the
I am trying to find the pseudocode for the XOR encryption algorithm. However I've
I am trying to XOR two bitmap files (their byte arrays) to produce a
I am wanting to xor (^) two values and pass the result to an
Here I am trying to swap two characters in a string using XOR operation.
I'm trying to implement XOR in javascript in the following way: // XOR validation
Trying to build out an exception if move.UserId does not equal currentUserId then Redirect
Trying to copy the msdn refernce here doesn't work and gives an error I
I've been trying to make a basic XOR header file for use in some
I am trying to create a truth table for the function F=(A&B) XOR (C&D').

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.