S
shapper
Hello,
I need to create a Key from a user's username, created date and email.
I am sending that key by email so the user can click it to approve its
account.
I was creating the key as follows:
Sash sash = new Sash(new SHA256Managed(), 10);
Byte[] salt = Encoding.UTF8.GetBytes("80c2f9ce-
b8a4-4623-93b1-6771073e6a09");
Byte[] key = Encoding.UTF8.GetBytes(String.Concat(user.Username,
user.Email, user.Created.ToString()));
Byte[] hash = sash.CalculateHash(key, salt);
sash.Dispose();
return Convert.ToBase64String(hash);
Sash is a class that hashes a string with a salt.
I was doing that I get the following url:
http://domain.com/User/Approve/1/Key/WY7mDccz5Fp8kJQyocVXzubvlUp1/jNYTNTkmszFKKU=
That has two problems:
1. The "=" in the end is not considered part of the url
2. The / in the url "breaks" the url ...
So I would need something to create the key maybe only with numbers
and letters.
What do you advice me to do?
Thanks,
Miguel
I need to create a Key from a user's username, created date and email.
I am sending that key by email so the user can click it to approve its
account.
I was creating the key as follows:
Sash sash = new Sash(new SHA256Managed(), 10);
Byte[] salt = Encoding.UTF8.GetBytes("80c2f9ce-
b8a4-4623-93b1-6771073e6a09");
Byte[] key = Encoding.UTF8.GetBytes(String.Concat(user.Username,
user.Email, user.Created.ToString()));
Byte[] hash = sash.CalculateHash(key, salt);
sash.Dispose();
return Convert.ToBase64String(hash);
Sash is a class that hashes a string with a salt.
I was doing that I get the following url:
http://domain.com/User/Approve/1/Key/WY7mDccz5Fp8kJQyocVXzubvlUp1/jNYTNTkmszFKKU=
That has two problems:
1. The "=" in the end is not considered part of the url
2. The / in the url "breaks" the url ...
So I would need something to create the key maybe only with numbers
and letters.
What do you advice me to do?
Thanks,
Miguel