Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.IO;
- using System.Text;
- using System.Security.Cryptography;
- /**
- * This one is SHA1 Checker, the one I use to verify DCP PackingList
- * You can use it (or modify it) freely to meet your own needs.
- *
- * Usually tools like EasyDCP only load PKL_*.xml to search for main
- * mxf files, plus another XML starting with CPL_.
- *
- * Computing SHA1 for those mxf is the longest process, so it won't hurt
- * even if we compute all files refer to by the PKL.
- *
- * Unlike MD5, SHA1 required by DCP uses base64 encoding string,
- * so we must use the following call to convert the bytes returned by
- * SHA1::ComputeHash().
- *
- * On Linux you can use a simple command like the following without
- * the need for extra program like this one:
- *
- * sha1sum [filename].mxf | xxd -r -p | base64
- *
- * But we can also use these codes with Mono and put a nice UI if you want.
- * :)
- */
- class SHATest64
- {
- static void Main(string[] args)
- {
- string appName = System.Diagnostics.Process.GetCurrentProcess().ProcessName;
- if (args.Length == 0)
- {
- Console.WriteLine(appName + " [filename]");
- return;
- }
- SHA1 sha = SHA1.Create();
- if (File.Exists(args[0]))
- {
- FileStream fs = File.OpenRead(args[0]);
- byte[] data = sha.ComputeHash(fs);
- string strBase64 = System.Convert.ToBase64String(data);
- Console.Write("Base64 SHA1 Hash: ");
- ConsoleColor fg = Console.ForegroundColor;
- Console.ForegroundColor = ConsoleColor.Yellow;
- Console.Write(strBase64 + "\n");
- Console.ForegroundColor = fg;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement