Anonymous user
Main step of GOST 28147-89: Difference between revisions
→{{header|REXX}}: used a more readable DO index variable, changed comments and whitespace, used a template for output.
(Added Kotlin) |
(→{{header|REXX}}: used a more readable DO index variable, changed comments and whitespace, used a template for output.) |
||
Line 679:
=={{header|REXX}}==
{{trans|BBC BASIC}}
<lang rexx>/*REXX
numeric digits 12 /* ┌── a list of 4─bit S─box values used by */
/* ↓ the Central Bank of Russian Federation.*/
/* [
do r=0 for 8; do c=0 for 16; !.r.c
z=0
do j=0 for 4; jj=j + j; jjp=jj + 1 /*calculate the array'a "subscripts". */
▲#.1=x2d(43b0421); #.2=x2d(4320430); key=x2d(0e2c104f9); z=0
cm=$ // 16; cd=$ % 16
▲ do while k<2147483648; k = k + p; end
end /*i*/ /* [↑] encryption algorithm for S-box.*/▼
/* [↓] encryption algorithm round. */▼
▲ do i=0 for 4; $=x2d(right(d2x(k%2**(i*8)), 2))
k
say
{{out|output|:}}
▲ z=z + (!.ii.cm + 16*!.iip.cd) * 2**(i*8)
▲ end /*i*/ /* [↑] encryption algorithm S-box*/
▲ /* [↓] encryption algorithm round*/
▲ /*stick a fork in it, we're done.*/</lang>
<pre>
</pre>
|