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