It appears that the strcat call was the culprit here and caused non-linear run-time growth of the encryption algorithm. Replacing it with memcpy fixed this.