Skip to content
/ MD5Lib Public

MD5 implements in Sysmac Studio.

License

Notifications You must be signed in to change notification settings

kmu2030/MD5Lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MD5Lib

MD5Lib provides a MD5 digest generation FB for Sysmac Studio. OMRON's Sysmac Studio is required to view and execute the code.

Environment

Sysmac Studio Version 1.60

How to use "MD5Lib.slr"

  1. git clone this repository or download the zip.
  2. Reference "MD5Lib.slr" in your project.

Also check "MD5LibExample.smc2".

How to use "MD5LibExample.smc2"

  1. git clone this repository or download the zip.
  2. Open "MD5LibExample.smc2" in Sysmac Studio.
  3. Check "POU/Program/README".
  4. Build the project.
  5. Execute on simulator or actual machine.

"MD5LibExample.smc2" includes "MD5Lib.slr".

Explanation

MD5Lib provides MD5 digest generation FB. FB generates a digest from an input sequence of bytes.

CASE iState OF
    0:
        iMessage := 'abc'; // 900150983cd24fb0d6963f7d28e17f72
        iBinMessageSize := StringToAry(In:=iMessage,
                                       AryOut:=iBinMessage[0]);
        iBinMessageHead := 0;
        iMD5StreamDigest(Execute:=FALSE,
                         Stream:=iBinMessage,
                         StreamHead:=iBinMessageHead);

        Inc(iState);
    1:
        WHILE NOT iSHA1StreamDigest.Done DO
            iMD5StreamDigest(Execute:=TRUE,
                             Stream:=iBinMessage,
                             StreamHead:=iBinMessageHead,
                             StreamSize:=iBinMessageSize,
                             HashStr=>iHashStr);
        END_WHILE;
		
        Inc(iState);
END_CASE;

File hash

I recommend checking the hash value of the acquired Sysmac Studio project.

file sha256
MD5Lib.slr e5cc06eb60064fcb8424250985e517f98dd4a151374fabe85d02fbc92254d442
MD5LibExample.scm2 cd6ce3e08caa88e2517777bafd0c1e258eb24952c924d9daa5f872d084e93efd