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