title: Bit shifting with hex in Python
body: <p>I am trying to understand how to perform bit shift operations in Python. Coming from C#, it doesn't work in the same way.</p>
  
  <p>The C# code is;</p>
  
  <pre><code>var plain=0xabcdef0000000; // plaintext
  var key=0xf0f0f0f0f123456; // encryption key
  
  var L = plain;
  var R = plain&gt;&gt;32;
  </code></pre>
  
  <p>The output is; </p>
  
  <pre><code>000abcdef0000000 00000000000abcde
  </code></pre>
  
  <p>What is the equivilent in Python? I have tried;</p>
  
  <pre><code>plain = 0xabcdef0000000
  key = 0xf0f0f0f0f123456
  
  print plain
  
  left  = plain
  right = plain &gt;&gt; 32
  
  print hex(left)
  print hex(right)
  </code></pre>
  
  <p>However, it doesn't work. The output is different in Python. The 0's padding are missing. Any help would be appreciated!</p>