implement function to encrypt arbitrary length ansistring