Bitcoin Forum
July 11, 2024, 07:02:37 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: [1]
1  Economy / Services / Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR on: January 23, 2014, 04:35:34 PM
I'm with BurtW on this.  BTW.. way more than $200 worth of effort in this thread already  Shocked
2  Economy / Services / Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR on: January 22, 2014, 11:35:35 PM
Expand the sum to long form?
Code:
x = ((((a+b)x2^31)mod 2^32)/2^(31))+((((a/2+b/2)x2^31)mod 2^32)/2^(30))+
((((a/(2^2)+b/(2^2))x2^31)mod 2^32)/2^(29))+((((a/(2^3)+b/(2^3))x2^31)mod 2^32)/2^(28))+
((((a/(2^2)+b/(2^2))x2^31)mod 2^32)/2^(27))+((((a/(2^3)+b/(2^3))x2^31)mod 2^32)/2^(26))+
((((a/(2^2)+b/(2^2))x2^31)mod 2^32)/2^(25))+((((a/(2^3)+b/(2^3))x2^31)mod 2^32)/2^(24))+
((((a/(2^2)+b/(2^2))x2^31)mod 2^32)/2^(23))+((((a/(2^3)+b/(2^3))x2^31)mod 2^32)/2^(22))+
((((a/(2^2)+b/(2^2))x2^31)mod 2^32)/2^(21))+((((a/(2^3)+b/(2^3))x2^31)mod 2^32)/2^(20))+
((((a/(2^2)+b/(2^2))x2^31)mod 2^32)/2^(19))+((((a/(2^3)+b/(2^3))x2^31)mod 2^32)/2^(18))+
((((a/(2^2)+b/(2^2))x2^31)mod 2^32)/2^(17))+((((a/(2^3)+b/(2^3))x2^31)mod 2^32)/2^(16))+
((((a/(2^2)+b/(2^2))x2^31)mod 2^32)/2^(15))+((((a/(2^3)+b/(2^3))x2^31)mod 2^32)/2^(14))+
((((a/(2^2)+b/(2^2))x2^31)mod 2^32)/2^(13))+((((a/(2^3)+b/(2^3))x2^31)mod 2^32)/2^(12))+
((((a/(2^2)+b/(2^2))x2^31)mod 2^32)/2^(11))+((((a/(2^3)+b/(2^3))x2^31)mod 2^32)/2^(10))+
((((a/(2^2)+b/(2^2))x2^31)mod 2^32)/2^(9))+((((a/(2^3)+b/(2^3))x2^31)mod 2^32)/2^(8))+
((((a/(2^2)+b/(2^2))x2^31)mod 2^32)/2^(7))+((((a/(2^3)+b/(2^3))x2^31)mod 2^32)/2^(6))+
((((a/(2^2)+b/(2^2))x2^31)mod 2^32)/2^(5))+((((a/(2^3)+b/(2^3))x2^31)mod 2^32)/2^(4))+
((((a/(2^2)+b/(2^2))x2^31)mod 2^32)/2^(3))+((((a/(2^3)+b/(2^3))x2^31)mod 2^32)/2^(2))+
((((a/(2^2)+b/(2^2))x2^31)mod 2^32)/2^(1))+((((a/(2^3)+b/(2^3))x2^31)mod 2^32)/2^(0))
3  Economy / Services / Re: [BOUNTY] 200$ for the first to provide purely mathematic expression of XOR on: January 22, 2014, 10:27:37 PM
Here's javascript code that works...

function xor32bit(a,b){
   var sum=0;
   var x,shift;
   var s32 = Math.pow(2,32);
   var s31 = Math.pow(2,31);

   for (n=0;n<32;n++){
      shift = Math.pow(2,n);
      // move current bits to b0 and add
      x= Math.floor(a/shift)+Math.floor(b/shift);
      // move to most significant bit to clear out left bits
      x*= s31;
      // mod to keep in 32 bits range
      x=x%s32;
      // divide to put back in right it position
      x=Math.floor(x/Math.pow(2,(31-n)));
      // add to sum
      sum+=x;
   }
   return sum;
}

console.log(xor32bit(0x12345678,0).toString(16));
console.log(xor32bit(0x12345678,0xffffffff).toString(16));

Equation is sum for n 0..31 (((a/2^n+b/2^n)x2^31)mod 2^32)/2^(31-n)

Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!