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;
 }
 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;
 }