Onionr/pow-csharp/onionrpow-cli/Program.cs

33 lines
994 B
C#
Raw Normal View History

2020-09-19 21:01:22 +00:00
using System;
using System.Text;
2020-09-20 21:13:46 +00:00
using System.IO;
using System.Collections.Generic;
2020-09-19 21:01:22 +00:00
using onionrpow;
namespace onionrpow_cli
{
class Program
{
static void Main(string[] args)
{
2020-09-20 21:13:46 +00:00
2020-09-23 21:21:43 +00:00
TimeSpan t = DateTime.UtcNow - new DateTime(1970, 1, 1);
int secondsSinceEpoch = (int)t.TotalSeconds;
2020-09-20 21:13:46 +00:00
using (Stream stdin = Console.OpenStandardInput())
{
var data = new List<byte>();
byte[] buffer = new byte[60000];
int bytes;
while ((bytes = stdin.Read(buffer, 0, buffer.Length)) > 0) {
//stdout.Write(buffer, 0, bytes);
data.AddRange(buffer);
}
2020-09-23 00:36:08 +00:00
onionrpow.OnionrPow.compute(data.ToArray(), 2);
2020-09-20 21:13:46 +00:00
}
2020-09-23 21:21:43 +00:00
TimeSpan t2 = DateTime.UtcNow - new DateTime(1970, 1, 1);
Console.WriteLine((int)t2.TotalSeconds - secondsSinceEpoch);
2020-09-19 21:01:22 +00:00
}
}
}