modelSHA1

Model that verifies the SHA1 encryption C function

Extends from Modelica.Icons.Example (Icon for runnable examples).

Information

This validation function tests the C implementation of the SHA1 encryption for the following strings:

  • "abc"
  • "" (an empty string)
  • "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
  • "1.23e+4"
  • "a" repeated 509 times.

If the encrypted strings are identical to the expected (known) encryption results, the cmpAll boolean variable will be true.

Parameters

TypeNameDefaultDescription
StringstrIn1"abc"First test string
StringstrIn2""Second test string
StringstrIn3"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"Third test string
StringstrIn4"1.23e+4"Fourth test string
StringstrIn5Modelica.Utilities.Strings.repeat(509, string = "a")Fifth test string
StringstrEx1"a9993e364706816aba3e25717850c26c9cd0d89d"Encryption result of first string
StringstrEx2"da39a3ee5e6b4b0d3255bfef95601890afd80709"Encryption result of second string
StringstrEx3"84983e441c3bd26ebaae4aa1f95129e5e54670f1"Encryption result of third string
StringstrEx4"bdd220adb45b392f17915af70ed8a006c382b983"Encryption result of fourth string
StringstrEx5"edff7a135c2e06d4c8084e61b4516c901bd5fcd0"Encryption result of fifth string

Components

TypeNameDefaultDescription
Booleancmp1
Booleancmp2
Booleancmp3
Booleancmp4
Booleancmp5
BooleancmpAll

Revisions

  • January 13, 2019, by Michael Wetter:
    Reduced string length for issue 1081.
  • May 30, 2018, by Alex Laferrière:
    First implementation.