**Yes**, we can construct a cipher homomorphic with respect to the concatenation operation (noted $\mathbin\|$ ). In short, we make the encryption of a concatenation the concatenation of the encryptions. Start from any ([CPA][1] or [CCA][2]-)secure cipher capable of enciphering into a fixed-size cryptogram a single-symbol plaintext (e.g. octet or bit depending on granularity thought). Note $E$ that encryption function, with $c=E(k,r,q)$ the result of the encryption under key $k$ with random/nonce $r$ of the single symbol $q$, and $D$ the decryption function $c\mapsto D(c)$ such that $\forall k,\forall r,\forall q,D(k,E(k,r,q))=q$ (for asymmetric ryptography $k$ can be a public/private key pair with the public key used for encryption), Also assume a public pseudo-random permutation $r\mapsto P(r)$. Then extend $E$ by stating that when $q$ is the concatenation of more than one symbol, it is broken as $q=\hat q\mathbin\|\tilde q$ with $\hat q$ the first symbol of $q$ and $\tilde q$ the rest, and $E(k,r,q)=E(k,r,\hat q)\mathbin\|E(k,P(r),\tilde q)$. Correspondingly extend $D$ by stating that if $c$ is wider than the (constant-width) encryption of a single symbol, it is broken into $c=\hat c\mathbin\|\tilde c$, with $\hat c$ just wide enough for a single symbol, and $D(k,c)=D(k,\hat c)\mathbin\|D(k,\tilde c)$. Using that operator $\|$ is associative, that construction $E$ can be shown (CPA or CCA-)secure as the original is (we use that applying the PRP $P$ iteratively on random/nounce $r$ generates a pseudo-random sequence); and has the property thought in the question, with $g$ concatenation. $E$ can for example be AES-CTR with random IV $r$ at the beginning of the ciphertext; or [RSAES-OAEP][3] (with symbol a byte, or with encryption of a bit defined as encryption of the byte `00` or `FF` depending of the bit's value). $P$ can be any PRP independent of $E$. One drawback of that simple construction is that it expands ciphertext size considerably. However, that can be fixed by a more complex construction. [1]: https://en.wikipedia.org/wiki/Ciphertext_indistinguishability#Indistinguishability_under_chosen-plaintext_attack_(IND-CPA) [2]: https://en.wikipedia.org/wiki/Ciphertext_indistinguishability#Indistinguishability_under_chosen_ciphertext_attack/adaptive_chosen_ciphertext_attack_(IND-CCA1,_IND-CCA2) [3]: https://www.emc.com/collateral/white-papers/h11300-pkcs-1v2-2-rsa-cryptography-standard-wp.pdf#page=16