title: Is it possible to encrypt integers?
body: <p>So my program is a Stenography program, it inserts an image into another image, and I'm trying to encrypt the data before inserting it into the cover image. However, most encryption modules expect strings and I'm trying to pass integers.</p>
  
  <p>I've tried converting to string then encrypting, but the encryption is full of special characters and letters so converting back to integer for insertion is impossible. </p>
  
  <p>Anyone know if I can somehow encrypt an integer? It doesn't have to be very secure.</p>
  
  <p>I'm trying to add the encryption in here: </p>
  
  <pre><code>for i in range(0,3):
      #verify we have reached the end of our hidden file
      if count &gt;= len(Stringbits):
          #convert the bits to their rgb value and appened them
          for rgbValue in pixelList:
              pixelnumbers1 = int(''.join(str(b) for b in rgbValue), 2)
              #print pixelnumbers1
              rgb_Array.append(pixelnumbers1)
          pixels[x, y] = (rgb_Array[0], rgb_Array[1], rgb_Array[2])
          print "Completed"
          return imageObject.save(output)
  </code></pre>
  
  <p>I've been trying to encrypt <code>pixelnumbers1</code> then add it in. But <code>pixels[x, y]</code> requires an integer. </p>
  
  <p>Below is the rest of the code in-case: </p>
  
  <pre><code>def write(mainimage, secret, output):
      #string contains the header, data and length in binary
      Stringbits = dcimage.createString(secret)
      imageObject = Image.open(mainimage).convert('RGB')
      imageWidth, imageHeight = imageObject.size
      pixels = imageObject.load()
      rgbDecimal_Array = []
      rgb_Array = []
      count = 0
  
      #loop through each pixel
      for x in range (imageWidth):
          for y in range (imageHeight):
              r,g,b = pixels[x,y]
              #convert each pixel into an 8 bit representation
              redPixel = list(bin(r)[2:].zfill(8))
              greenPixel = list(bin(g)[2:].zfill(8))
              bluePixel = list(bin(b)[2:].zfill(8))
              pixelList = [redPixel, greenPixel, bluePixel]
  
              #for each of rgb
              for i in range(0,3):
                  #verify we have reached the end of our hidden file
                  if count &gt;= len(Stringbits):
                      #convert the bits to their rgb value and appened them
                      for rgbValue in pixelList:
                          pixelnumbers1 = int(''.join(str(b) for b in rgbValue), 2)
                          #print pixelnumbers1
                          rgb_Array.append(pixelnumbers1)
                      pixels[x, y] = (rgb_Array[0], rgb_Array[1], rgb_Array[2])
                      print "Completed"
                      return imageObject.save(output)
  
                  #If we haven't rached the end of the file, store a bit
                  else:
                      pixelList[i][7] = Stringbits[count]
                      count+=1
              pixels[x, y] = dcimage.getPixel(pixelList)
  </code></pre>