public void SaveState() { List <string[]> array_list = new List <string[]>(); array_list.Add(new string[] { LastUpdateDateTime.ToString(), "", "", "", "" }); foreach (TradingCalenderEvent trading_calender_event in event_list) { array_list.Add(new string[] { trading_calender_event.EventTimeUTC.ToString(), trading_calender_event.Symbol, trading_calender_event.Description, trading_calender_event.IsAllDay.ToString(), ToolsString.DictionaryToString(trading_calender_event.Tags) }); } ToolsIOCSV.WriteCSVFile(database_path, ToolsCollection.ConvertToArray2D(array_list)); }
public static BigInteger mpz_shash( String input) { /* hash the input */ String digest = h(input); /* convert the digest to a hexadecimal encoded string */ String hex_digest = ToolsString.ConvertToStringHex(digest); /* convert the hexadecimal encoded string to an mpz-integer */ return(BigInteger.Parse(hex_digest, System.Globalization.NumberStyles.HexNumber)); }
public void LoadState() { string [,] table = ToolsIOCSV.ReadCSVFile(database_path); LastUpdateDateTime = DateTimeUTC.Parse(table[0, 0]); for (int index_0 = 1; index_0 < table.GetLength(0); index_0++) { event_list.Add(new TradingCalenderEvent( DateTimeUTC.Parse(table[index_0, 0]), table[index_0, 1], table[index_0, 2], bool.Parse(table[index_0, 3]), ToolsString.StringToDictionary(table[index_0, 4]))); } }
/* * Hashing of the public inputs (aka Fiat-Shamir heuristic) with h(), * e.g. to make some proofs of knowledge non-interactive. */ public static BigInteger mpz_shash( BigInteger [] array) { String acc = ""; /* concatenate all the arguments */ for (int i = 0; i < array.Length; i++) { acc += ToolsString.ConvertToStringHex(array[i].ToString()) + "|"; } /* hash arguments */ return(mpz_shash(acc)); }
public static BigInteger ReverseDigits( BigInteger value) { return(BigInteger.Parse(ToolsString.Reverse(value.ToString()))); }
public static BigInteger mpz_shash( BigInteger value) { return(mpz_shash(ToolsString.ConvertToStringHex(value.ToString()) + "|")); }
// hash function h() (collision-resistant?) public static String h( String input) { return(ToolsString.ConvertToString(s_algoritm.ComputeHash(ToolsString.ConvertToBytes(input)))); }