GOSTFrom CryptoDox, The Online Encyclopedia on Cryptography and Information SecurityGOST is a 64-bit block cipher from the former Soviet Union. It uses a 256 bit key and some additional secret information in form of SBOX permutations. The details of the algorithm were published in 1990 as the Soviet Standard - GOST 28147-89. The algorithm provides flexible security (bad SBOXes can compromise the plain text) and can be implemented in both hardware and software. GOST is a Feistel network of 32 rounds. Its round function is very simple: add a 32-bit subkey modulo 232, put the result through a layer of S-boxes, and rotate that result left by 11 bits. The result of that is the output of the round function. In the diagram to the left, one line represents 32 bits.
Source CodeGOST in 417 bytes of PERLThe following code snippet shows a Perl implementation of GOST[1] #!/usr/bin/perl -s sub F{$u=0;grep$u|=$S[$_][$_[0]>>$_*4&15]<<$_*4,reverse 0..7;$u<<11|$u>>21} sub R {int$_[0]*rand}sub N{vec$_[0],$_[1]/4,32}$e=join'',<>;@b=@t=0..15; for(;$i<length $p;$i+=4){srand($s^=N$p,$i)}while($c<8){ grep{push@b,splice@b,R(9),5}@t;$R[$c]=R( 2**32);@{$S[$c++]}=@b}@h=0..7; @o=reverse@h;while($a<length$e){$v=N$e,$a;$w=N$e,( $a+=8)-4; grep$q++%2?$v^=F$w+$K[$_]:($w^=F$v+$K[$_]) ,$d?(@h,(@o)x3):((@h)x3,@o); $_.=pack N2,$w,$v}print ReferencesExternal Links
|



