parameters: (self, plaintext, output=None)
docstring: Encrypt data with the key set at initialization.
  
          The data to encrypt can be broken up in two or
          more pieces and `encrypt` can be called multiple times.
  
          That is, the statement:
  
              >>> c.encrypt(a) + c.encrypt(b)
  
          is equivalent to:
  
               >>> c.encrypt(a+b)
  
          This function does not add any padding to the plaintext.
  
          :Parameters:
            plaintext : bytes/bytearray/memoryview
              The piece of data to encrypt.
              The length must be multiple of the cipher block length.
          :Keywords:
            output : bytearray/memoryview
              The location where the ciphertext must be written to.
              If ``None``, the ciphertext is returned.
          :Return:
            If ``output`` is ``None``, the ciphertext is returned as ``bytes``.
            Otherwise, ``None``.
docstring_summary: Encrypt data with the key set at initialization.
docstring_tokens: Encrypt data with the key set at initialization .
function: def encrypt(self, plaintext, output=None):
          """Encrypt data with the key set at initialization.
  
          The data to encrypt can be broken up in two or
          more pieces and `encrypt` can be called multiple times.
  
          That is, the statement:
  
              >>> c.encrypt(a) + c.encrypt(b)
  
          is equivalent to:
  
               >>> c.encrypt(a+b)
  
          This function does not add any padding to the plaintext.
  
          :Parameters:
            plaintext : bytes/bytearray/memoryview
              The piece of data to encrypt.
              The length must be multiple of the cipher block length.
          :Keywords:
            output : bytearray/memoryview
              The location where the ciphertext must be written to.
              If ``None``, the ciphertext is returned.
          :Return:
            If ``output`` is ``None``, the ciphertext is returned as ``bytes``.
            Otherwise, ``None``.
          """
  
          if output is None:
              ciphertext = create_string_buffer(len(plaintext))
          else:
              ciphertext = output
              
              if not is_writeable_buffer(output):
                  raise TypeError("output must be a bytearray or a writeable memoryview")
          
              if len(plaintext) != len(output):
                  raise ValueError("output must have the same length as the input"
                                   "  (%d bytes)" % len(plaintext))
  
          result = raw_ecb_lib.ECB_encrypt(self._state.get(),
                                           c_uint8_ptr(plaintext),
                                           c_uint8_ptr(ciphertext),
                                           c_size_t(len(plaintext)))
          if result:
              if result == 3:
                  raise ValueError("Data must be aligned to block boundary in ECB mode")
              raise ValueError("Error %d while encrypting in ECB mode" % result)
          
          if output is None:
              return get_raw_buffer(ciphertext)
          else:
              return None
function_tokens: def encrypt ( self , plaintext , output = None ) : if output is None : ciphertext = create_string_buffer ( len ( plaintext ) ) else : ciphertext = output if not is_writeable_buffer ( output ) : raise TypeError ( "output must be a bytearray or a writeable memoryview" ) if len ( plaintext ) != len ( output ) : raise ValueError ( "output must have the same length as the input" "  (%d bytes)" % len ( plaintext ) ) result = raw_ecb_lib . ECB_encrypt ( self . _state . get ( ) , c_uint8_ptr ( plaintext ) , c_uint8_ptr ( ciphertext ) , c_size_t ( len ( plaintext ) ) ) if result : if result == 3 : raise ValueError ( "Data must be aligned to block boundary in ECB mode" ) raise ValueError ( "Error %d while encrypting in ECB mode" % result ) if output is None : return get_raw_buffer ( ciphertext ) else : return None