Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
IDENTIFICATION DIVISION.
PROGRAM-ID. KECCAK-Wrapper.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-KECCAK-RATE BINARY-LONG UNSIGNED.
01 WS-KECCAK-CAPACITY BINARY-LONG UNSIGNED.
01 WS-KECCAK-DELIMITED-SUFFIX BINARY-CHAR UNSIGNED.
01 WS-KECCAK-OUTPUT-BYTE-LEN BINARY-DOUBLE UNSIGNED.
LINKAGE SECTION.
01 LNK-KECCAK-RATE-POLYGLOT POINTER.
01 LNK-KECCAK-CAPACITY-POLYGLOT POINTER.
01 LNK-KECCAK-INPUT PIC X.
01 LNK-KECCAK-INPUT-BYTE-LEN BINARY-DOUBLE UNSIGNED.
01 LNK-KECCAK-DELIMITED-SUFFIX-POLYGLOT POINTER.
01 LNK-KECCAK-OUTPUT PIC X.
01 LNK-KECCAK-OUTPUT-BYTE-LEN-POLYGLOT POINTER.
PROCEDURE DIVISION USING LNK-KECCAK-RATE-POLYGLOT
LNK-KECCAK-CAPACITY-POLYGLOT
LNK-KECCAK-INPUT
LNK-KECCAK-INPUT-BYTE-LEN
LNK-KECCAK-DELIMITED-SUFFIX-POLYGLOT
LNK-KECCAK-OUTPUT
LNK-KECCAK-OUTPUT-BYTE-LEN-POLYGLOT.
CALL "polyglot_as_i32" USING
LNK-KECCAK-RATE-POLYGLOT
returning WS-KECCAK-RATE
END-CALL
CALL "polyglot_as_i32" USING
LNK-KECCAK-CAPACITY-POLYGLOT
returning WS-KECCAK-CAPACITY
END-CALL
CALL "polyglot_as_i8" USING
LNK-KECCAK-DELIMITED-SUFFIX-POLYGLOT
returning WS-KECCAK-DELIMITED-SUFFIX
END-CALL
CALL "polyglot_as_i64" USING
LNK-KECCAK-OUTPUT-BYTE-LEN-POLYGLOT
returning WS-KECCAK-OUTPUT-BYTE-LEN
END-CALL
CALL "KECCAK" USING
WS-KECCAK-RATE
WS-KECCAK-CAPACITY
LNK-KECCAK-INPUT
LNK-KECCAK-INPUT-BYTE-LEN
WS-KECCAK-DELIMITED-SUFFIX
LNK-KECCAK-OUTPUT
WS-KECCAK-OUTPUT-BYTE-LEN
END-CALL
EXIT.
END PROGRAM KECCAK-Wrapper.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.