byte * AES128::encrypt(byte *message) { int i; memcpy((void*)state, (const void*)message,16); initKey(); addRoundKey(); for(i = 0; i < 9; i++) { subBytes(); shiftRows(); mixColumns(); computeKey(pgm_read_byte(rcon + i)); addRoundKey(); } subBytes(); shiftRows(); computeKey(pgm_read_byte(rcon + i)); addRoundKey(); memcpy((void*)message,(const void*)state, 16); return message; }
scypherBase::scypherBase(byteBlock key) { initKey(key.getStr()); }
scypherBase::scypherBase(std::string key) { initKey(key); }
scypherBase::scypherBase() { std::string key; for (uint64_t i=0; i<16; i++) { key += '\x00'; } initKey(key); }
void scypherBase::setKey(std::string key) { initKey(key); }
void make_SubKey(char key[8]) { unsigned short key64[64]; byteTo64Int(key,key64); initKey(key64,keyset); }