http://dpaste.dzfl.pl/3bbdecfefa5cI'm not sure about some of that. Bad casts w.r.t. immutability etc.How about: http://dpaste.dzfl.pl/706ab2db9ce1I would keep the encryption inside a template to prevent users from assigning it to a variable without triggering CTFE.
Why would that be a problem?