好久沒發文了…
生為一専業懶的卜朧共…
再怎麼懶的發文…也要有兩把刷子…
財富、名聲、勢力-沒有全世界財富的Panda‧D‧卜朧共,他在臨行前的一句話,讓人們趨之若鶩、逃離大海!
「想要我的財寶嗎?想要的話可以全部給你,去找吧!我把所有的一切都放在那裡!」
我要成為海怪王
頑皮's
| Backup and restore commands | Description |
| backup[ -f file] -apk | -noapk] [-obb | -noobb] [-shared | -noshared] [-all] [-system | [-nosystem]package_names | Write an archive of the device's data to file. If you do not specify a file name, the default file is backup.adb. The package list is optional when you specify the -all and -shared options. The following describes the usages for the other options: -apk | -noapk: Back up or do not back up .apk files. The default value is -noapk. -obb | -noobb: Back up or do not back up .obb files. The default value is -noobb. -shared | -noshared: Back up or do not back up shared storage. The default value is -noshared. -all: Back up all installed apps. -system | -nosystem: Include or do not include system apps when backing up all installed apps (-all). The default value is -system. |
//Rextester.Program.Main is the entry point for your code. Don't change it.
//Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Security.Cryptography;
using System.IO;
namespace Rextester
{
public class Program
{
public static void Main(string[] args)
{
//string DESKEY="A1B2C3D4E56F7G8H1I2J3K4L5M6N7O8P1Q2R3S4T5U6V7W8X";
string DESKEY="A1B2C3D4E56F7G8H1I2J3K4L";
string txtSource="Hello, world!";
//Your code goes here
Console.WriteLine(txtSource);
string EncryptResult = Encrypt3DES(txtSource, DESKEY);
Console.WriteLine(EncryptResult);
string DecryptResult = Decrypt3DES(EncryptResult, DESKEY);
Console.WriteLine(DecryptResult);
}
/// <summary>
/// 使用3DES加密
/// </summary>
/// <param name="strSource"></param>
/// <param name="strKey">長度為24字元</param>
/// <returns></returns>
public static string Encrypt3DES(string strSource, string strKey)
{
TripleDESCryptoServiceProvider DES = new TripleDESCryptoServiceProvider();
//DES.Key = UTF8Encoding.UTF8.GetBytes(System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(strKey, "md5").Substring(0, 24));
DES.Key = UTF8Encoding.UTF8.GetBytes(strKey.Substring(0, 24));
DES.Mode = CipherMode.ECB;
//DES.Mode = CipherMode.CBC;
ICryptoTransform DESEncrypt = DES.CreateEncryptor();
byte[] Buffer = UTF8Encoding.UTF8.GetBytes(strSource);
return Convert.ToBase64String(DESEncrypt.TransformFinalBlock(Buffer, 0, Buffer.Length));
}
/// <summary>
/// 使用3DES解密
/// </summary>
/// <param name="strEncryptData"></param>
/// <param name="strKey">長度為24字元/param>
/// <returns></returns>
public static string Decrypt3DES(string strEncryptData, string strKey)
{
TripleDESCryptoServiceProvider DES = new TripleDESCryptoServiceProvider();
//DES.Key = UTF8Encoding.UTF8.GetBytes(System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(strKey, "md5").Substring(0, 24));
DES.Key = UTF8Encoding.UTF8.GetBytes(strKey.Substring(0, 24));
DES.Mode = CipherMode.ECB;
//DES.Mode = CipherMode.CBC;
DES.Padding = System.Security.Cryptography.PaddingMode.PKCS7;
ICryptoTransform DESDecrypt = DES.CreateDecryptor();
string result = "";
byte[] Buffer = Convert.FromBase64String(strEncryptData);
result = UTF8Encoding.UTF8.GetString(DESDecrypt.TransformFinalBlock(Buffer, 0, Buffer.Length));
return result;
}
}
}