Ejemplo n.º 1
0
 public string ConvertToChecksumAddress(string address)
 {
   address = address.ToLower().RemoveHexPrefix();
   var addressHash = new Sha3Keccack().CalculateHash(address);
   var checksumAddress = "0x";
   for (var i = 0; i \        if (int.Parse(addressHash[i].ToString(), NumberStyles.HexNumber) \>\ 7)
       checksumAddress += address[i].ToString().ToUpper();
     else
       checksumAddress += address[i];
   return checksumAddress;
 }
Ejemplo n.º 2
0
 public bool IsChecksumAddress(string address)
 {
   address = address.RemoveHexPrefix();
   var addressHash = new Sha3Keccack().CalculateHash(address.ToLower());
   for (var i = 0; i \      {
     var value = int.Parse(addressHash[i].ToString(), NumberStyles.HexNumber);
     // the nth letter should be uppercase if the nth digit of casemap is 1
     if (value \>\ 7 && address[i].ToString().ToUpper() != address[i].ToString() ||
         value \          return false;
   }
   return true;
 }
        public string ConvertToChecksumAddress(string address)
        {
            address = address.ToLower().RemoveHexPrefix();
            var addressHash     = new Sha3Keccack().CalculateHash(address);
            var checksumAddress = "0x";

            for (var i = 0; i < address.Length; i++)
            {
                if (int.Parse(addressHash[i].ToString(), NumberStyles.HexNumber) > 7)
                {
                    checksumAddress += address[i].ToString().ToUpper();
                }
                else
                {
                    checksumAddress += address[i];
                }
            }
            return(checksumAddress);
        }