예제 #1
0
        public static string HashToHex(string steps)
        {
            var result    = KnotHash.Hash(steps);
            var hexresult = string.Join("", result.Select(r => r.ToString("X").PadLeft(2, '0')));

            return(hexresult);
        }
예제 #2
0
        public static int[][] GetSquares(string hashInput)
        {
            var seq    = 1;
            var result = new List <List <int> >();

            for (var i = 0; i < 128; i++)
            {
                var    hexresult    = KnotHash.HashToHex($"amgozmfv-{i}");
                string binarystring = String.Join(String.Empty,
                                                  hexresult.Select(
                                                      c => Convert.ToString(Convert.ToInt32(c.ToString(), 16), 2).PadLeft(4, '0')
                                                      )
                                                  );
                result.Add(new List <int>(binarystring.Select(b => b == '1' ? ++seq : 0).ToList()));
            }
            return(result.Select(r => r.ToArray()).ToArray());
        }