Esempio n. 1
0
        public void Crytonote_Hash_Fast()
        {
            var blobConverted = "0106a2aaafd505583cf50bcc743d04d831d2b119dc94ad88679e359076ee3f18d258ee138b3b42580100a4b1e2f4baf6ab7109071ab59bc52dba740d1de99fa0ae0c4afd6ea9f40c5d87ec01".HexToByteArray();
            var result        = LibCryptonote.CryptonightHashFast(blobConverted).ToHexString();

            Assert.Equal("ddc0e3a33b605ce39fa2d16a98d7634e33399ab1e4b56b3bdd3414b655fe9a98", result);
        }
Esempio n. 2
0
        private PooledArraySegment <byte> ComputeBlockHash(byte[] blobConverted)
        {
            // blockhash is computed from the converted blob data prefixed with its length
            var bytes = new[] { (byte)blobConverted.Length }
            .Concat(blobConverted)
            .ToArray();

            return(LibCryptonote.CryptonightHashFast(bytes));
        }
Esempio n. 3
0
        private void ComputeBlockHash(byte[] blobConverted, Span <byte> result)
        {
            // blockhash is computed from the converted blob data prefixed with its length
            var bytes = new[] { (byte)blobConverted.Length }
            .Concat(blobConverted)
            .ToArray();

            LibCryptonote.CryptonightHashFast(bytes, result);
        }
Esempio n. 4
0
        private void ComputeBlockHash(ReadOnlySpan <byte> blobConverted, Span <byte> result)
        {
            // blockhash is computed from the converted blob data prefixed with its length
            Span <byte> block = stackalloc byte[blobConverted.Length + 1];

            block[0] = (byte)blobConverted.Length;
            blobConverted.CopyTo(block.Slice(1));

            LibCryptonote.CryptonightHashFast(block, result);
        }
Esempio n. 5
0
 private static void TouchNativeLibs()
 {
     Console.WriteLine(LibCryptonote.CryptonightHashSlow(Encoding.UTF8.GetBytes("test"), 0).ToHexString());
     Console.WriteLine(LibCryptonote.CryptonightHashFast(Encoding.UTF8.GetBytes("test")).ToHexString());
     Console.WriteLine(new Blake().Digest(Encoding.UTF8.GetBytes("test"), 0).ToHexString());
 }
Esempio n. 6
0
 public void Cryptonote_FastHash_Should_Throw_On_Null_Argument()
 {
     Assert.Throws <ArgumentNullException>(() => LibCryptonote.CryptonightHashFast(null));
 }
Esempio n. 7
0
        public void Cryptonote_FastHash_Should_Match()
        {
            var result = LibCryptonote.CryptonightHashFast(testValue).ToHexString();

            Assert.Equal("80ad002b1c333a29913d9edb5340412b121c0e9045e59fa9b2aabb53f9dcc92d", result);
        }