March 2018
Beginner to intermediate
410 pages
10h 40m
English
The user database will only contain our one user. We leave it to the reader to create a more dynamic user database:
private IUserSource users = new Users();
public class Users : IUserSource
{
public bool TryGetUser(string UserName, out IUser User)
{
if (UserName == "MIoT")
User = new User();
else
User = null;
return User != null;
}
}
We also define our salted hash function as follows, using the unique device identity as the salt:
private string CalcHash(string Password)
{
return Waher.Security.Hashes.ComputeSHA256HashString(
Encoding.UTF8.GetBytes(Password + ":" + this.deviceId));
}
Read now
Unlock full access