Ejemplo n.º 1
0
        /// <inheritsdoc />
        public override bool Verify(ReadOnlySpan <byte> input, ReadOnlySpan <byte> signature)
        {
            Debug.Assert(!_disposed);

            Span <byte> hash = stackalloc byte[_hashSizeInBytes];

            _hashAlgorithm.ComputeHash(input, hash);
            return(CryptographicOperations.FixedTimeEquals(signature, hash));
        }
Ejemplo n.º 2
0
        /// <inheritsdoc />
        public override bool TrySign(ReadOnlySpan <byte> input, Span <byte> destination, out int bytesWritten)
        {
            Debug.Assert(!_disposed);

            _hashAlgorithm.ComputeHash(input, destination);
            bytesWritten = destination.Length;
            return(true);
        }