13.07.2015 Views

ДИПЛОМНА РАБОТА - Св. Климент Охридски

ДИПЛОМНА РАБОТА - Св. Климент Охридски

ДИПЛОМНА РАБОТА - Св. Климент Охридски

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Софийски Университет "<strong>Св</strong>. <strong>Климент</strong> <strong>Охридски</strong>" , Факултет по Математика и ИнформатикаМагистърска програма : З И К С Мprivate byte[,] iSbox; // inverse Substitution boxprivate byte[,] w; // key schedule array.private byte[,] Rcon; // Round constants.private byte[,] State; // State matrixpublic Aes(KeySize keySize, byte[] keyBytes){SetNbNkNr(keySize);this.key = new byte[this.Nk * 4]; // 16, 24, 32 byteskeyBytes.CopyTo(this.key, 0);in wBuildSbox();BuildInvSbox();BuildRcon();KeyExpansion(); // expand the seed key into a key schedule and store} // Aes constructorpublic void Cipher(byte[] input, byte[] output) // encipher 16-bitinput{// state = inputthis.State = new byte[4,Nb]; // always [4,4]for (int i = 0; i < (4 * Nb); ++i){this.State[i % 4, i / 4] = input[i];}AddRoundKey(0);for (int round = 1; round

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!