Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

CommonFunctions.cs 671B

123456789101112131415161718192021222324
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Security.Cryptography;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace ProRestaurant.Classes
  8. {
  9. public class CommonFunctions
  10. {
  11. public static string GetHashSHA256(string text)
  12. {
  13. SHA256Managed crypt = new SHA256Managed();
  14. string hash = string.Empty;
  15. byte[] crypto = crypt.ComputeHash(Encoding.UTF8.GetBytes(text), 0, Encoding.UTF8.GetByteCount(text));
  16. foreach (byte bit in crypto)
  17. {
  18. hash += bit.ToString("x2");
  19. }
  20. return hash;
  21. }
  22. }
  23. }