示例#1
0
        public void CryptoHash_MessageHashing_Should_Success()
        {
            //Arrange
            String message = "test";

            Byte[] bMessage = Encoding.UTF8.GetBytes(message);
            Byte[] hsh1     = new Byte[TweetNaCl.HashBytes];
            Byte[] hsh2     = new Byte[TweetNaCl.HashBytes];

            var firstResult  = 0;
            var secontResult = 0;

            //Act
            firstResult  = TweetNaCl.CryptoHash(hsh1, bMessage, bMessage.Length);
            secontResult = TweetNaCl.CryptoHash(hsh2, bMessage, bMessage.Length);

            //Assert
            Assert.AreNotEqual(firstResult, -1, "First hashing call for message generation failed.");
            Assert.AreNotEqual(secontResult, -1, "Second hashing call for message generation failed.");
            Assert.AreEqual(hsh1, hsh2, "hash for message are not equal.");
        }