malloc buf for Encrypt replace of global variable