parameters: (message, key, n, funcref)
return_statement: return encode64chops(cypher)
docstring: Chops the 'message' into integers that fit into n,
      leaving room for a safebit to be added to ensure that all
      messages fold during exponentiation.  The MSB of the number n
      is not independant modulo n (setting it could cause overflow), so
      use the next lower bit for the safebit.  Therefore reserve 2-bits
      in the number n for non-data bits.  Calls specified encryption
      function for each chop.
  
      Used by 'encrypt' and 'sign'.
docstring_summary: Chops the 'message' into integers that fit into n,
      leaving room for a safebit to be added to ensure that all
      messages fold during exponentiation.  The MSB of the number n
      is not independant modulo n (setting it could cause overflow), so
      use the next lower bit for the safebit.  Therefore reserve 2-bits
      in the number n for non-data bits.  Calls specified encryption
      function for each chop.
docstring_tokens: Chops the message into integers that fit into n leaving room for a safebit to be added to ensure that all messages fold during exponentiation . The MSB of the number n is not independant modulo n ( setting it could cause overflow ) so use the next lower bit for the safebit . Therefore reserve 2 - bits in the number n for non - data bits . Calls specified encryption function for each chop .
function: def chopstring(message, key, n, funcref):
      """Chops the 'message' into integers that fit into n,
      leaving room for a safebit to be added to ensure that all
      messages fold during exponentiation.  The MSB of the number n
      is not independant modulo n (setting it could cause overflow), so
      use the next lower bit for the safebit.  Therefore reserve 2-bits
      in the number n for non-data bits.  Calls specified encryption
      function for each chop.
  
      Used by 'encrypt' and 'sign'.
      """
  
      msglen = len(message)
      mbits = msglen * 8
      #Set aside 2-bits so setting of safebit won't overflow modulo n.
      nbits = bit_size(n) - 2             # leave room for safebit
      nbytes = nbits / 8
      blocks = msglen / nbytes
  
      if msglen % nbytes > 0:
          blocks += 1
  
      cypher = []
      
      for bindex in range(blocks):
          offset = bindex * nbytes
          block = message[offset:offset+nbytes]
          value = bytes2int(block)
          cypher.append(funcref(value, key, n))
  
      return encode64chops(cypher)
function_tokens: def chopstring ( message , key , n , funcref ) : msglen = len ( message ) mbits = msglen * 8 #Set aside 2-bits so setting of safebit won't overflow modulo n. nbits = bit_size ( n ) - 2 # leave room for safebit nbytes = nbits / 8 blocks = msglen / nbytes if msglen % nbytes > 0 : blocks += 1 cypher = [ ] for bindex in range ( blocks ) : offset = bindex * nbytes block = message [ offset : offset + nbytes ] value = bytes2int ( block ) cypher . append ( funcref ( value , key , n ) ) return encode64chops ( cypher )