예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="seed"></param>
        /// <param name="security"></param>
        /// <param name="index"></param>
        /// <param name="checksum"></param>
        /// <param name="curl"></param>
        /// <returns></returns>
        public static string NewAddress(string seed, int security, int index, bool checksum, ICurl curl)
        {
            if (!InputValidator.IsValidSecurityLevel(security))
            {
                throw new ArgumentException(Constants.INVALID_SECURITY_LEVEL_INPUT_ERROR);
            }

            Signing signing = new Signing(curl);

            sbyte[] key          = signing.Key(Converter.ToTrits(seed), index, security);
            sbyte[] digests      = signing.Digests(key);
            sbyte[] addressTrits = signing.Address(digests);

            string address = Converter.ToTrytes(addressTrits);

            if (checksum)
            {
                address = address.AddChecksum();
            }

            return(address);
        }
예제 #2
0
        /// <summary>
        /// </summary>
        /// <param name="seed">Tryte-encoded seed. It should be noted that this seed is not transferred.</param>
        /// <param name="security">Secuirty level of private key / seed.</param>
        /// <param name="index">
        ///     Key index to start search from. If the index is provided, the generation of the address is not
        ///     deterministic.
        /// </param>
        /// <returns>trytes</returns>
        public string GetDigest(string seed, int security, int index)
        {
            var key = _signing.Key(Converter.ToTrits(seed, 243), index, security);

            return(Converter.ToTrytes(_signing.Digests(key)));
        }