Beispiel #1
0
        public void Digest(ReadOnlySpan <byte> data, Span <byte> result, params object[] extra)
        {
            Contract.Requires <ArgumentException>(data.Length == 80, $"{nameof(data)} length must be exactly 80 bytes");
            Contract.Requires <ArgumentException>(result.Length >= 32, $"{nameof(result)} must be greater or equal 32 bytes");

            fixed(byte *input = data)
            {
                fixed(byte *output = result)
                {
                    LibMultihash.neoscrypt(input, output, (uint)data.Length, profile);
                }
            }
        }
        public byte[] Digest(byte[] data, params object[] extra)
        {
            Assertion.RequiresNonNull(data, nameof(data));
            Assertion.Requires <ArgumentException>(data.Length == 80, $"{nameof(data)} length must be exactly 80 bytes");

            var result = new byte[32];

            fixed(byte *input = data)
            {
                fixed(byte *output = result)
                {
                    LibMultihash.neoscrypt(input, output, (uint)data.Length, profile);
                }
            }

            return(result);
        }