title: Python: ValueError: invalid literal for int() with base 10:'\x00
body: <p>I am making a client-server program implementing the Diffie-Hellman algorithm</p>
  
  <p>Client:</p>
  
  <pre><code>from __future__ import print_function
  import math
  import socket
  
  host = "localhost"
  port = 1200
  s = socket.socket(socket.AF_INET,   socket.SOCK_STREAM)
  s.connect((host, port))
  
  print("Connected with Server")
  
  sharedPrime = 23    # p
  sharedBase = 5      # g
  
  aliceSecret = 6     # a
  
  s.send(bytes(aliceSecret))
  bobSecret=s.recv(1024)
  
  # Alice Sends Bob A = g^a mod p
  A = (sharedBase**aliceSecret) % sharedPrime
  
  s.send(bytes(A))
  B=s.recv(1024)
  
  B=B.decode()
  # Alice Computes Shared Secret: s = B^a mod p
  aliceSharedSecret = (int(B)** aliceSecret) % sharedPrime
  print( "Alice Shared Secret: ", aliceSharedSecret )
  </code></pre>
  
  <p>The server code is basically the same, except it handles "Bob's" side of the algorithm. My problem starts at this line:</p>
  
  <pre><code>aliceSharedSecret = (int(B)** aliceSecret) % sharedPrime
  </code></pre>
  
  <p>Which gives me this error:</p>
  
  <pre><code>invalid literal for int() with base 10: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
  </code></pre>
  
  <p>I've gone back to see what "B" actually is and it's just blank. What am I doing wrong?</p>