Advertisement
Guest User

Untitled

a guest
Nov 25th, 2014
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. private string GetSHA1HashData(string data)
  2. {
  3. SHA1 sha1 = SHA1.Create();
  4.  
  5. byte[] hashData = sha1.ComputeHash(Encoding.Default.GetBytes(data));
  6.  
  7. StringBuilder returnValue = new StringBuilder();
  8.  
  9. for (int i = 0; i < hashData.Length; i++)
  10. {
  11. returnValue.Append(hashData[i].ToString());
  12. }
  13.  
  14. return returnValue.ToString();
  15. }
  16.  
  17. private string GetMacAddress()
  18. {
  19. string macAddresses = string.Empty;
  20.  
  21. foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
  22. {
  23. if (nic.OperationalStatus == OperationalStatus.Up)
  24. {
  25. macAddresses += nic.GetPhysicalAddress().ToString();
  26. break;
  27. }
  28. }
  29.  
  30. return macAddresses;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement