moved crypt helper to base