public int AnswerSaltRequest(Message message) { SaltRequest req = (SaltRequest) message; salt = generator.Next(); //Notification.Diagnostic(this, "Generated salt:" + salt.ToString()); PeerHandle.Send(new SaltResponse(salt)); return PHASE_NEXT; }
public int AnswerSaltResponse(Message message) { SaltResponse response = (SaltResponse) message; Entropy saltedPassword = new Entropy(user.password.hashCode); //Notification.Diagnostic(this, "Retrived salt:" + response.salt.ToString()); //Notification.Diagnostic(this, "Clear password:"******"Sending salted password:" + saltedPassword.ToString()); PeerHandle.Send( new UserAuthorization(user.login, saltedPassword)); return PHASE_NEXT; }
public Entropy Next() { Entropy result = new Entropy(); byte[] array = new byte[Entropy.BytesCount]; byte[] converted = null; int rand; int i; for (i = 0; i < array.Length; ++i) { if (i%4 == 0) { rand = random.Next(); converted = System.BitConverter.GetBytes(rand); } array[i] = converted[i%4]; } result.AddBytesArray(array); return result; }
public SaltResponse(Entropy salt) { pSalt = salt; }
public UserAuthorization(string login, Entropy saltedPassword) : base(login) { pSaltedPassword = saltedPassword; }
public Password(UInt64 passwordHash) { hash = new Entropy(); hash.value = passwordHash; }
public Password(string value) { hash = new Entropy(); hashString(value); }
public Entropy(Entropy entropy) { pValue = entropy.value; }
public void Salt(Entropy salt) { pValue = pValue^salt.pValue; }