using System.Security.Cryptography; using System.Text; namespace FindAndDrive.Domain.Helpers; public static class ApiKeyHelper { public static string GenerateApiKey() { using var provider = new RNGCryptoServiceProvider(); var bytes = new byte[32]; provider.GetBytes(bytes); return Convert.ToBase64String(bytes) .Replace("/", "") .Replace("+", "") .Replace("=", ""); } public static string HashString(string input) { using var hash = SHA256.Create(); var enc = Encoding.UTF8; var result = hash.ComputeHash(enc.GetBytes(input)); return Convert.ToHexString(result); } }