working random key encryption