As a recent programming exercise I wrote a golang library that allows encoding/decoding arbitrary data in DNA segments.
The encoding algorithm is based on the method described in this Nature paper: http://www.nature.com/nature/journal/v494/n7435/full/nature11875.html . Pseudo code and details can be found here: http://www.nature.com/nature/journal/vaop/ncurrent/extref/nature11875-s2.pdf
1 2 3
The resulting string is a valid DNA sequence.
Sequences can be decoded back to human readable text the same way:
1 2 3
Source on github: https://github.com/zacg/dna