Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.IO;
- namespace sha1
- {
- class Program
- {
- const UInt32 H0 = 0x67452301;
- const UInt32 H1 = 0xefcdab89;
- const UInt32 H2 = 0x98badcfe;
- const UInt32 H3 = 0x10325476;
- const UInt32 H4 = 0xc3d2e1f0;
- private static List<BitArray> Msg;
- static void Main(string[] args)
- {
- if (args[0] != null)
- {
- Msg = new List<BitArray>();
- List<byte> fileBuff = File.ReadAllBytes(args[0]).ToList();
- int len = fileBuff.Count*8;
- fileBuff.Add((byte)0b10000000);
- for(int i=0; i<fileBuff.Count/16;i++)
- {
- Msg.Add(new BitArray(SubArray<Byte>(fileBuff, i * 16, 16)));
- }
- }
- else Console.WriteLine("no file or bad file");
- }
- public static T[] SubArray<T>(this T[] data, int index, int length)
- {
- T[] result = new T[length];
- Array.Copy(data, index, result, 0, length);
- return result;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement