Advertisement
Guest User

Untitled

a guest
Feb 10th, 2019
1,737
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.25 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3. using System.Text;
  4. using System.Security.Cryptography;
  5.  
  6. namespace OtogiStillDec
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             if (args.Length == 0) {
  13.                 Console.WriteLine(@"usage: OtogiStillDec.exeにドラッグ&ドロップ又はコマンドラインで引数にファイルパス指定(複数可)");
  14.                 return;
  15.             }
  16.  
  17.             var aesManager = new AesManaged() {
  18.                 KeySize = 128,
  19.                 BlockSize = 128,
  20.                 Mode = CipherMode.CBC,
  21.                 Padding = PaddingMode.PKCS7,
  22.                 IV = Encoding.UTF8.GetBytes("nekonekonyannyan"),
  23.                 Key = Encoding.UTF8.GetBytes("kms1kms2kms3kms4")
  24.             };
  25.             ICryptoTransform decryptor = aesManager.CreateDecryptor();
  26.             for (int i = 0; i < args.Length; i++) {
  27.                 if (File.Exists(args[i])) {
  28.                     byte[] bytes = File.ReadAllBytes(args[i]);
  29.                     File.WriteAllBytes(args[i], decryptor.TransformFinalBlock(bytes, 0, bytes.Length));
  30.                     Console.WriteLine($"Decrypted {Path.GetFileName(args[i])}");
  31.                 }
  32.             }
  33.            
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement