public class EncryptAndDecryptFile
{
public static string outputFile;
static string password = @"12345678";
//加密
public static void EncryptFile(byte[] fileByte, string name)
{
try
{
UnicodeEncoding UE = new UnicodeEncoding();
byte[] key = UE.GetBytes(password);
//写入未加密视频文件
if (!System.IO.File.Exists(outputFile + "/" + name))
{
FileStream nFile = new FileStream(outputFile + "/" + name, FileMode.Create);
nFile.Write(fileByte, 0, fileByte.Length);
nFile.Dispose();
}
FileStream fsCrypt = new FileStream(Application.streamingAssetsPath + "/" + name.Substring(0, name.Length - 4), FileMode.Create);
RijndaelManaged RMCrypto = new RijndaelManaged();
CryptoStream cs = new CryptoStream(fsCrypt,
unity下载数据并加密保存到本地二进制文件的另一种写法
最新推荐文章于 2024-06-13 09:00:00 发布