Skip to content

SHA-1 implements in Sysmac Studio.

License

Notifications You must be signed in to change notification settings

kmu2030/SHA1Lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SHA1Lib

SHA1Lib provides a SHA-1 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 "SHA1Lib.slr"

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

Also check "SHA1LibExample.smc2".

How to use "SHA1LibExample.smc2"

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

"SHA1LibExample.smc2" includes "SHA1Lib.slr".

Explanation

SHA1Lib provides SHA-1 digest generation FB. FB generates a digest from an input sequence of bytes.

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

        Inc(iState);
    1:
        WHILE NOT iSHA1StreamDigest.Done DO
            iSHA1StreamDigest(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
SHA1Lib.slr dfb82a7266a20b7443af8c7d252caf16b403a634a8dca721c32465aea2e40549
SHA1LibExample.scm2 5494b284d17f314bc17b3cc68605618eff1db73f04d42fcfb0bd20122b16e0eb