Such codes are known as [fully homomorphic encryption][1] (FHE) because once you can add and multiply then you can calculate arbitrary function. FHE is a big challenge and it still does not have a simple solution. You can find even [workshops][2] devoted FHE. [1]: https://en.wikipedia.org/wiki/Homomorphic_encryption [2]: https://homomorphicencryption.org/