Recommendation for lightweight algorithm for partial message encryption I have designed a specific client and server program, which sends a file  from client to server in 32k chunks. I want to encrypt only part of the data. More specifically: in each 32k chunk passing from client to server I want to encrypt only 500 bytes. This, in a non-continuous way (meaning: partial encryptionhere and there in the chunk of 32k, totally forming 500 bytesof encrypted data within the 32k block). Here client is a constrained sensor and server is an Arduino board used for Internet of Things concept, to save of energy of the constrained device(client) i want to encrypt only parts of data.

Are there any lightweight(here refers to C.P.U consumption) cryptographic algorithms or methods which offer  the option to set an “offset” and a parameter defining how much partial data we want to encrypt?

For example encrypt (bufptr, random_num, ENCRYPT_LENGTH); where bufptr is a 32k chunk with information, random_num is the random number smaller than the bufptr pointing to the bufptr, ENCRYPT_LENGTH is the length we want to encrypt (like 20 bytes from the number pointed by the random_num).
It's trivial to code your own wrapper function if you really want to use such API. Here is a Python-inspired pseudo code:

def mywrapper(data, offset, encspecs):
    subdata = data[0:offset]
    ciphertext = whatever_enc_function(subdata, encspecs)
    return ciphertext

encspecs = ... 
plaintext = "...etc"
ciphertxt = mywrapper(plaintext, offset, encspecs)
cipher_plain_mixed = ciphertxt + plaintext[offset:]


But either way, it's not an algorithmic/methodology problem as much as it is an implementation.

Side note: I sense that you are about to allow for replay attacks, or other similar ones. Make sure to include a unique initialization vector (e.g. a simple counter or timestamp) that is always different, so that you never (extremely rarely) get same cipher again even when the content plaintext is repeated. This prevents an attacker from fraudulently re-sending a previously captured block of encrypted data.