コード例 #1
0
        public string CalcHash()
        {
            string data = "";

            data += Date0.Ticks + PreviousHash + (int)Type;
            data += SenderHash + RecieverHash + VotingNumber + Info;

            return(CommonHelpers.CalcHash(data));
        }
コード例 #2
0
 static public bool Login(string password)
 {
     if (PublicKey != null && PrivateKeyCrypted != null && PasswordHash != null)
     {
         if (PasswordHash == CommonHelpers.CalcHash(password))
         {
             PrivateKey = CryptoHelper.Decrypt(PrivateKeyCrypted, password);
             return(true);
         }
     }
     return(false);
 }
コード例 #3
0
        public string CalcHash()
        {
            string data = "";

            data += Date0.Ticks + PreviousHash + Number;

            foreach (var tr in Transactions)
            {
                data += tr;
            }

            return(CommonHelpers.CalcHash(data));
        }
コード例 #4
0
        static public void Register(string publicKey, string privateKey, string password)
        {
            string privateKeyCrypted = Convert.ToBase64String(CryptoHelper.Encrypt(Encoding.UTF8.GetBytes(privateKey), password));
            string passwordHash      = CommonHelpers.CalcHash(password);


            prefEditor.PutString("publicKey", publicKey);
            prefEditor.PutString("privateKeyCrypted", privateKeyCrypted);
            prefEditor.PutString("passwordHash", passwordHash);

            prefEditor.PutString("createOwnBlocks", true.ToString());
            prefEditor.PutString("theme", 0.ToString());
            prefEditor.PutString("trackers", Trackers);
            prefEditor.PutString("peerDiscovery", true.ToString());
            prefEditor.PutString("useLanLocalIP", true.ToString());

            prefEditor.Commit();
        }