Replace deprecated crypto function