fix performance in tests by accepting fun as encrypt