CRC16_generic (FUN) ¶ FUNCTION CRC16_generic : WORD Function calculates the checksum CRC16 of the “MemoryBlock” in a generalized manner. Typical input parameter: CRC16 standard : wCRCInit := 16#0000 wPoly := 16#8005 xReflectInput := TRUE xReflectOutput := TRUE wXORout := 16#0000 CRC16-CCITT : wCRCInit := 16#FFFF wPoly := 16#1021 xReflectInput := FALSE xReflectOutput := FALSE wXORout := 16#0000 CRC16-Modbus : wCRCInit := 16#FFFF wPoly := 16#8005 xReflectInput := TRUE xReflectOutput := TRUE wXORout := 16#0000 Example: sTest : STRING ( 10 ) := '123456789' ; -> MEM.CRC16_generic ( ADR ( sTest ), 9 , 16#1021 , FALSE , FALSE , 16#0000 ) = 16#29B1 InOut: Scope Name Type Comment Return CRC16_generic WORD function returns generalized CRC16 of “MemoryBlock” Input pMemoryBlock POINTER TO BYTE address of memory Block uiLength UINT length of MemoryBlock in byte wCRCInit WORD initial value for CRC value wPoly WORD polynom value for CRC algorithm xReflectInput BOOL reflect input data bytes xReflectOutput BOOL reflect CRC before final XOR wXORout WORD final XOR value before output
CRC16_standard (FUN) ¶ FUNCTION CRC16_standard : WORD Function calculates the default CRC16 checksum. Example: sTest : STRING ( 10 ) := '123456789' ; -> MEM.CRC16_standard ( ADR ( sTest ), 9 ) = 16#BB3D InOut: Scope Name Type Comment Return CRC16_standard WORD function returns the default CRC16 checksum of “MemoryBlock” Input pMemoryBlock POINTER TO BYTE address of memory Block uiLength UINT length of MemoryBlock in byte
CRC32 (FUN) ¶ FUNCTION CRC32 : DWORD Function calculates the CRC32 checksum used in PKZIP, AUTODIN II, Ethernet, FDDI. Example: sTest : STRING ( 10 ) := '123456789' ; -> MEM.CRC32 ( ADR ( sTest ), 9 ) = 16#CBF43926 InOut: Scope Name Type Comment Return CRC32 DWORD function returns the CRC32 checksum of “MemoryBlock” Input pMemoryBlock POINTER TO BYTE address of memory Block uiLength UINT length of MemoryBlock in byte
MD5 (FB) ¶ FUNCTION_BLOCK MD5 Function calculates the MD5 checksum of given “MemoryBlock” with “udiNumberOfBytes” bytes. The used algorithm of MD5 Message-Digest is descibed in RFC1321. Prefix: “memmd5”. Example: sTest : string := 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' -> abyDigest [0] = 16#D1 abyDigest [1] = 16#74 abyDigest [2] = 16#AB abyDigest [3] = 16#98 abyDigest [4] = 16#D2 abyDigest [5] = 16#77 abyDigest [6] = 16#D9 abyDigest [7] = 16#F5 abyDigest [8] = 16#A5 abyDigest [9] = 16#61 abyDigest [10] = 16#1C abyDigest [11] = 16#2C abyDigest [12] = 16#9F abyDigest [13] = 16#41 abyDigest [14] = 16#9D abyDigest [15] = 16#9F InOut: Scope Name Type Comment Input xExecute BOOL rising edge starts calculation of “abyDigest” pMemoryBlock POINTER TO BYTE address of memory block udiNumberOfBytes UDINT number of bytes of memory block Output xDone BOOL calculation of abyDigest done xBusy BOOL calculation busy abyDigest ARRAY [0..15] OF BYTE MD5 digest Structure: Finale (Action) Init (Action) Update (Action)
MD5.Finale (ACT) ¶ MD5 finalization. Ends an MD5 message-digest operation and writes the the message digest.
MD5.Init (ACT) ¶ MD5 initialization. Begins an MD5 operation and writes a new context.
MD5.Update (ACT) ¶ MD5 block update operation. Continues an MD5 message-digest operation, processes another message block and updates the context.
Internal functions ¶ MD5_FF (Function) MD5_GG (Function) MD5_HH (Function) MD5_II (Function) MD5_Transform (Function)
MD5_FF (FUN) ¶ FUNCTION MD5_FF : DWORD MD5 transformations for rounds 1, 2, 3, and 4. InOut: Scope Name Type Return MD5_FF DWORD Input dwA DWORD dwB DWORD dwC DWORD dwD DWORD dwX DWORD dwS UINT dwT DWORD
MD5_GG (FUN) ¶ FUNCTION MD5_GG : DWORD MD5 transformations for rounds 1, 2, 3, and 4. InOut: Scope Name Type Return MD5_GG DWORD Input dwA DWORD dwB DWORD dwC DWORD dwD DWORD dwX DWORD dwS UINT dwT DWORD