Online Presence
KapNuz - Easy News For You
Awesome Hosting Plans
Advertise Here

GOST

From CryptoDox, The Online Encyclopedia on Cryptography and Information Security

Jump to: navigation, search

GOST 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.

Contents

Source Code

GOST in 417 bytes of PERL

The 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

References

  1. GOST in 417 bytes of Perl

External Links

  • GOST 28147-89 at Wikipedia
  • RFC 4490, Using the GOST 28147-89, GOST R 34.11-94, GOST R 34.10-94, and GOST R 34.10-2001 Algorithms with Cryptographic Message Syntax (CMS)

Cheap Gas - Loans - Loan - Credit Counseling