Skip to content

SHA-3 implements in Sysmac Studio.

License

Notifications You must be signed in to change notification settings

kmu2030/SHA3Lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SHA3Lib

SHA3Lib provides a SHA-3 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 "SHA3Lib.slr"

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

Also check "SHA3LibExample.smc2".

How to use "SHA3LibExample.smc2"

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

"SHA3LibExample.smc2" includes "SHA3Lib.slr".

Explanation

SHA3Lib provides SHA-3 digest generation FB. FB generates a digest from an input sequence of bytes.

CASE iState OF
    0:
        iMessage := 'abc'; // 3a985da74fe225b2045c172d6bd390bd855f086e3e9d525b46bfe24511431532
        iBinMessageSize := StringToAry(In:=iMessage,
                                       AryOut:=iBinMessage[0]);
        iBinMessageHead := 0;
        iSHA3_256StreamDigest(Execute:=FALSE,
                              Stream:=iBinMessage,
                              StreamHead:=iBinMessageHead);
		
        Inc(iState);
    1:
        WHILE NOT iSHA3_256StreamDigest.Done DO
            iSHA3_256StreamDigest(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
SHA3Lib.slr 498f251975221684ba3ea79092ba3fb86e0202e2bc9ab49ea107ee478d333ab2
SHA3LibExample.scm2 d6b54a3be3d648f71a9ee4c9f59b907d102410c9d479ec3620b43e27346ca53f