Advertisement
Guest User

lul

a guest
Sep 29th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.IO;
  8.  
  9. namespace sha1
  10. {
  11. class Program
  12. {
  13. const UInt32 H0 = 0x67452301;
  14. const UInt32 H1 = 0xefcdab89;
  15. const UInt32 H2 = 0x98badcfe;
  16. const UInt32 H3 = 0x10325476;
  17. const UInt32 H4 = 0xc3d2e1f0;
  18. private static List<BitArray> Msg;
  19. static void Main(string[] args)
  20. {
  21. if (args[0] != null)
  22. {
  23. Msg = new List<BitArray>();
  24. List<byte> fileBuff = File.ReadAllBytes(args[0]).ToList();
  25. int len = fileBuff.Count*8;
  26. fileBuff.Add((byte)0b10000000);
  27.  
  28. for(int i=0; i<fileBuff.Count/16;i++)
  29. {
  30. Msg.Add(new BitArray(SubArray<Byte>(fileBuff, i * 16, 16)));
  31. }
  32. }
  33. else Console.WriteLine("no file or bad file");
  34. }
  35.  
  36. public static T[] SubArray<T>(this T[] data, int index, int length)
  37. {
  38. T[] result = new T[length];
  39. Array.Copy(data, index, result, 0, length);
  40. return result;
  41. }
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement