add encrypt_amagic function