Example #1
0
        public void Sha3Of224BitsShouldProduceAValidHashResultForTheGivenMessage(string expected, string message)
        {
            // Arrange
            string actual;
            SHA3   algorithm = SHA3.CreateKeccak224();

            // Act
            actual = ComputeHash(algorithm, message);

            // Assert
            Assert.Equal(expected, actual);
        }
Example #2
0
        public void Sha3Of224BitsShouldProduceAValidHashResultForTheGivenSequence(string expected, string sequenceString, int sequenceLength)
        {
            // Arrange
            string actual;
            SHA3   algorithm = SHA3.CreateKeccak224();

            // Act
            actual = ComputeHash(algorithm, string.Concat(Enumerable.Repeat(sequenceString, sequenceLength)));

            // Assert
            Assert.Equal(expected, actual);
        }
Example #3
0
 public String GetSHA3_Keccak224(Param p)
 {
     byte[] h;
     if (p.Fs != null)
     {
         h = SHA3.CreateKeccak224().ComputeHash(p.Fs);
     }
     else
     {
         h = SHA3.CreateKeccak224().ComputeHash(Settings.GetEncoding().GetBytes(p.ValueToHash));
     }
     return(BitConverter.ToString(h));
 }