fix endian issues and add encryption tests
fix endian issues and add encryption tests