Error-correcting codes are normally employed in storage devices to guarantee the integrity of data in the presence of errors. This paper presents two schemes where error-correcting codes are used for entirely different purposes. In the first part of the paper, a new coding paradigm is proposed to improve the write performance of multi-level flash devices. By slightly relaxing the accuracy of cell programming, significant speed-up can be achieved. The resulting write inaccuracies are then corrected by codes that are tailored for the appropriately restricted error model. In the second part, new low-complexity codes are proposed to protect the security of sensitive data in the presence of imperfect physical erasure processes. Codes that have optimal encoding and decoding complexities are constructed to allow fast storing and retrieval of secret data, and guarantee unconditional security of data against an adversary with access to parts of the secret that failed to erase.