using System; using System.Collections.Generic; using System.Security.Cryptography; using System.Text; namespace CoviDokClientX.Models { public class User { public string Id { get; set; } public string FirstName { get; set; } public string LastName { get; set; } public Role Role { get; set; } public string Email { get; set; } public string Password { get; set; } public DateTime RegistrationDate { get; set; } public string PictureId { get; set; } private static byte[] GetHash(string inputString) { using (HashAlgorithm algorithm = SHA512.Create()) return algorithm.ComputeHash(Encoding.UTF8.GetBytes(inputString)); } public static string GetHashString(string inputString) { StringBuilder sb = new StringBuilder(); foreach (byte b in GetHash(inputString)) sb.Append(b.ToString("X2")); return sb.ToString(); } public bool CheckPassword(string Candidate) { return GetHashString(Candidate) == Password; } } public enum Role { Doctor, Assistant, Parent, Child } }