I would like to combine date and user email to one base64 string, which now works like this:
public string GenerateUniqueToken(string email)
{
byte[] time = BitConverter.GetBytes(DateTime.UtcNow.ToBinary());
byte[] key = Encoding.ASCII.GetBytes(email);
string encoded = Convert.ToBase64String(time.Concat(key).ToArray());
return criptographyService.Encrypt(encoded);
}
I would like to parse it now so that I only get an email from the decoded string, but I am getting everything together:
public string TokenUserValid(string token)
{
string decrypted = criptographyService.Decrypt(token);
byte[] data = Convert.FromBase64String(decrypted);
return Encoding.Default.GetString(data);
}
I get it in the form like this:
\�����[email protected]