SHA2Lib provides a SHA-2 digest generation FB for Sysmac Studio. OMRON's Sysmac Studio is required to view and execute the code.
Sysmac Studio Version 1.60
git clone
this repository or download the zip.- Reference "SHA2Lib.slr" in your project.
Also check "SHA2LibExample.smc2".
git clone
this repository or download the zip.- Open "SHA2LibExample.smc2" in Sysmac Studio.
- Check "POU/Program/README".
- Build the project.
- Execute on simulator or actual machine.
"SHA2LibExample.smc2" includes "SHA2Lib.slr".
SHA2Lib provides SHA-2 digest generation FB. FB generates a digest from an input sequence of bytes.
CASE iState OF
0:
iMessage := 'abc'; // ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad
iBinMessageSize := StringToAry(In:=iMessage,
AryOut:=iBinMessage[0]);
iBinMessageHead := 0;
iSHA256StreamDigest(Execute:=FALSE,
Stream:=iBinMessage,
StreamHead:=iBinMessageHead);
Inc(iState);
1:
WHILE NOT iSHA256StreamDigest.Done DO
iSHA256StreamDigest(Execute:=TRUE,
Stream:=iBinMessage,
StreamHead:=iBinMessageHead,
StreamSize:=iBinMessageSize,
HashStr=>iHashStr);
END_WHILE;
Inc(iState);
END_CASE;
I recommend checking the hash value of the acquired Sysmac Studio project.
file | sha256 |
---|---|
SHA2Lib.slr | 24eb0ce5a686a9abc1acf75a8771ae83c045fe64065ca6bc973aba9c1a16eb0e |
SHA2LibExample.scm2 | 69850dc8b24f7b2726c4080705a07000e47255231db5949134459e1fc4fc1189 |