Main step of GOST 28147-89: Difference between revisions

→‎{{header|RPL}}: improved code
(added RPL)
(→‎{{header|RPL}}: improved code)
Line 1,307:
» '<span style="color:blue">KBOXINIT</span>' STO
« { x}
'''WHILE''' #0h ≠ '''REPEAT'''
« 'K87' x SRB SRB SRB #255d AND B→R 1 + GET SLB SLB SLB
'K65' x SRB SRB OVER #255d AND B→RSWAP 1OVER + GETSWAP SLB SLB ORSRB
'''END''' SWAP DROP
'K43' x SRB #255d AND B→R 1 + GET SLB OR
» » '<span style="color:blue">FB→LIST</span>' STO
'K21' x #255d AND B→R 1 + GET OR
RLB RL RL RL
» » '<span style="color:blue">F</span>' STO
« { } « SWAP SLB OR » → input key result cast
« key REVLIST cast STREAM
input 1 4 SUB REVLIST cast STREAM + <span style="color:blue">FB→LIST</span>
{ K21 K43 K65 K87 }
input 5 8 SUB REVLIST cast STREAM XOR
SWAP B→R 1 4ADD GET '''START'''
input 5 8 SUB REVLIST cast STREAM XOR
DUP #255d AND 'result' SWAP STO+
RLB RL RL RL <span style="color:blue">B→LIST</span>
SRB
'''NEXT'''input 5 8 SUB XOR DROP
result input 1 4 SUB +
» » '<span style="color:blue">MAINSTEP</span>' STO
Line 1,334 ⟶ 1,332:
1: { # 1Fh # 88h # CFh # 7h # 21h # 4h # 3Bh # 4h }
</pre>
 
=={{header|Rust}}==
<syntaxhighlight lang="rust">use std::convert::TryInto;
1,150

edits