/// <summary> /// Generates a new address /// </summary> /// <param name="seed">The tryte-encoded seed. It should be noted that this seed is not transferred.</param> /// <param name="security">The secuirty level of private key / seed.</param> /// <param name="index">The index to start search from. If the index is provided, the generation of the address is not deterministic.</param> /// <param name="checksum">The adds 9-tryte address checksum</param> /// <param name="curl">The curl instance.</param> /// <returns>An String with address.</returns> public static string NewAddress(string seed, int security, int index, bool checksum, ICurl curl) { if (security < 1) { throw new ArgumentException("invalid security level provided"); } Signing signing = new Signing(curl); int[] key = signing.Key(Converter.ToTrits(seed), index, security); int[] digests = signing.Digests(key); int[] addressTrits = signing.Address(digests); string address = Converter.ToTrytes(addressTrits); if (checksum) { address = Checksum.AddChecksum(address); } return(address); }
/// <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))); }