GOST was a Soviet Union (Now Russian) standard of cryptography. GOST stands for “Gosudarstvennyi Standard Soyuza SSR” or Government Standard of the Union of Soviet Socialist Republics, which is equal to FIPS in USA.
GOST cipher is a 64-bit block cipher with 256 key and 32 rounds. It uses feistel structure, SBOX based substitution, Circular left shift by 11, 32 bit addition, 32 bit bitwise XOR and 32-bit register to register swapping with simple key scheduling. If code size matter, GOST can be implemented on microcontroller such PIC16F84 with less than 256 lines of code and less than 64 bytes of RAM. But if speed matter, you can modify the code to go faster but with larger code size. Again, it depends on your purposes.
I got the specification of GOST from here. But it contains missing thing such SBOX. Here i just took DES SBOX to fill the missing chain, of course to make the cipher works. Although this way sounds funny and speculative, the most important thing is that actually GOST cipher works on any SBOX table including DES. Here, i cannot guarantee that my code fully compatible with original GOST cipher. But, since nobody know the real SBOX table for GOST cipher, lets make just our life easier and assume that it is true. Dont confuse yourself🙂 .
For more confidential things, you can modify SBOX table and create your own customizable GOST cipher and have fun.
If you use microcontroller with larger program memory space , you can cut unnecessary steps by combining 2 4-bit SBOX become a 8-bit SBOX. By doing that, we can speed up the code and neglect code size. Later on, i will port the code to PIC16F877.
Below is the screenshot that i took from MPLAB 5.20.