Replace deprecated crypto functions