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;
        }
Example #3
0
        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;
        }
Example #4
0
 public SaltResponse(Entropy salt)
 {
     pSalt = salt;
 }
 public UserAuthorization(string login, Entropy saltedPassword)
     : base(login)
 {
     pSaltedPassword = saltedPassword;
 }
Example #6
0
 public Password(UInt64 passwordHash)
 {
     hash = new Entropy();
     hash.value = passwordHash;
 }
Example #7
0
 public Password(string value)
 {
     hash = new Entropy();
     hashString(value);
 }
Example #8
0
 public Entropy(Entropy entropy)
 {
     pValue = entropy.value;
 }
Example #9
0
 public void Salt(Entropy salt)
 {
     pValue = pValue^salt.pValue;
 }