I cant create this code with instinct but I need to THINK of it...
#include<stdio.h>
// The number of columns comprising a state in AES. This is a constant in AES. Value=4
#define Nb 4
// The number of rounds in AES Cipher. It is simply initiated to zero. The actual value is recieved in the program.
int Nr=0;
// The number of 32 bit words in the key. It is simply initiated to zero. The actual value is recieved in the program.
int Nk=0;
// in - it is the array that holds the plain text to be encrypted.
// out - it is the array that holds the output CipherText after encryption.
// state - the array that holds the intermediate results during encryption.
unsigned char in[16], out[16], state[4][4];
// The array that stores the round keys.
unsigned char RoundKey[240];
// The Key input to the AES Program
unsigned char Key[32];
// This function produces Nb(Nr+1) round keys. The round keys are used in each round to encrypt the states.
void KeyExpansion()
{
int i,j;
unsigned char temp[4],k;
// The first round key is the key itself.
for(i=0;i<Nk;i++)
{
RoundKey[i*4]=Key[i*4];
RoundKey[i*4+1]=Key[i*4+1];
RoundKey[i*4+2]=Key[i*4+2];
RoundKey[i*4+3]=Key[i*4+3];
}
// All other round keys are found from the previous round keys.
while (i < (Nb * (Nr+1)))
{
for(j=0;j<4;j++)
{
temp[j]=RoundKey[(i-1) * 4 + j];
}
if (i % Nk == 0)
{
// This function rotates the 4 bytes in a word to the left once.
// [a0,a1,a2,a3] becomes [a1,a2,a3,a0]
// Function RotWord()
{
k = temp[0];
temp[0] = temp[1];
temp[1] = temp[2];
temp[2] = temp[3];
temp[3] = k;
}
// SubWord() is a function that takes a four-byte input word and
// applies the S-box to each of the four bytes to produce an output word.
// Function Subword()
{
temp[0]=getSBoxValue(temp[0]);
temp[1]=getSBoxValue(temp[1]);
temp[2]=getSBoxValue(temp[2]);
temp[3]=getSBoxValue(temp[3]);
}
// This function adds the round key to state.
// The round key is added to the state by an XOR function.
void AddRoundKey(int round)
{
int i,j;
for(i=0;i<4;i++)
{
for(j=0;j<4;j++)
{
state[j][i] ^= RoundKey[round * Nb * 4 + i * Nb + j];
}
}
}
// The SubBytes Function Substitutes the values in the
// state matrix with values in an S-box.
void SubBytes()
{
int i,j;
for(i=0;i<4;i++)
{
for(j=0;j<4;j++)
{
state[i][j] = getSBoxValue(state[i][j]);
}
}
}
// The ShiftRows() function shifts the rows in the state to the left.
// Each row is shifted with different offset.
// Offset = Row number. So the first row is not shifted.
void ShiftRows()
{
unsigned char temp;
// Rotate first row 1 columns to left
temp=state[1][0];
state[1][0]=state[1][1];
state[1][1]=state[1][2];
state[1][2]=state[1][3];
state[1][3]=temp;
// Rotate second row 2 columns to left
temp=state[2][0];
state[2][0]=state[2][2];
state[2][2]=temp;
// Rotate third row 3 columns to left
temp=state[3][0];
state[3][0]=state[3][3];
state[3][3]=state[3][2];
state[3][2]=state[3][1];
state[3][1]=temp;
}
// xtime is a macro that finds the product of {02} and the argument to xtime modulo {1b}
#define xtime(x) ((x<<1) ^ (((x>>7) & 1) * 0x1b))
// MixColumns function mixes the columns of the state matrix
// The method used may look complicated, but it is easy if you know the underlying theory.
// Refer the documents specified above.
void MixColumns()
{
int i;
unsigned char Tmp,Tm,t;
for(i=0;i<4;i++)
{
t=state[0][i];
Tmp = state[0][i] ^ state[1][i] ^ state[2][i] ^ state[3][i] ;
Tm = state[0][i] ^ state[1][i] ; Tm = xtime(Tm); state[0][i] ^= Tm ^ Tmp ;
Tm = state[1][i] ^ state[2][i] ; Tm = xtime(Tm); state[1][i] ^= Tm ^ Tmp ;
Tm = state[2][i] ^ state[3][i] ; Tm = xtime(Tm); state[2][i] ^= Tm ^ Tmp ;
Tm = state[3][i] ^ t ; Tm = xtime(Tm); state[3][i] ^= Tm ^ Tmp ;
}
}
// Cipher is the main function that encrypts the PlainText.
void Cipher()
{
int i,j,round=0;
//Copy the input PlainText to state array.
for(i=0;i<4;i++)
{
for(j=0;j<4;j++)
{
state[j][i] = in[i*4 + j];
}
}
// Add the First round key to the state before starting the rounds.
AddRoundKey(0);
// There will be Nr rounds.
// The first Nr-1 rounds are identical.
// These Nr-1 rounds are executed in the loop below.
for(round=1;round<Nr;round++)
{
SubBytes();
ShiftRows();
MixColumns();
AddRoundKey(round);
}
// The last round is given below.
// The MixColumns function is not here in the last round.
SubBytes();
ShiftRows();
AddRoundKey(Nr);
// The encryption process is over.
// Copy the state array to output array.
for(i=0;i<4;i++)
{
for(j=0;j<4;j++)
{
out[i*4+j]=state[j][i];
}
}
}
void main()
{
int i;
// Receive the length of key here.
while(Nr!=128 && Nr!=192 && Nr!=256)
{
printf(“Enter the length of Key(128, 192 or 256 only): "
scanf("%d”,&Nr);
}
// Calculate Nk and Nr from the received value.
Nk = Nr / 32;
Nr = Nk + 6;
// Part 1 is for demonstrative purpose. The key and plaintext are given in the program itself.
// Part 1: ********************************************************
// Uncomment Part 2 if you need to read Key and PlainText from the keyboard.
// Part 2: ********************************************************
/*
//Clear the input buffer
flushall();
//Recieve the Key from the user
printf(“Enter the Key in hexadecimal: "
for(i=0;i<Nk*4;i++)
{
scanf("%x”,&Key[i]);
}
printf(“Enter the PlainText in hexadecimal: "
for(i=0;i<Nb*4;i++)
{
scanf("%x”,&in[i]);
}
*/
// ********************************************************
// The KeyExpansion routine must be called before encryption.
KeyExpansion();
// The next function call encrypts the PlainText with the Key using AES algorithm.
Cipher();
// Output the encrypted text.
printf("\nText after encryption:\n”;
for(i=0;i<Nk*4;i++)
{
printf("%02x ",out[i]);
}
printf("\n\n”;
}
---
“Great new ideas usually come from very small teams... don’t give up so easily." — John Kaster —
You need to keep in mind that your brain runs on instinct. Your brain, when making a code, wants to have an end result. Your instincts then tell you a code that would work and lead to your end result. The same thing works with finding food. You are hungry. Your instincts tell you to get food, and how to get it.
I think he is getting at the life is too complex type things. He needed to design that, it didn’t just appear...At least I guess thats what he is trying
ChibiDiscoDhaos wrote:
I think he is getting at the life is too complex type things. He needed to design that, it didn’t just appear...At least I guess thats what he is trying
He is saying there is no such thing as instinct, because he thought up of that code.
ChibiDiscoDhaos wrote:
I think he is getting at the life is too complex type things. He needed to design that, it didn’t just appear...At least I guess thats what he is trying
He is saying there is no such thing as instinct, because he thought up of that code.
If Itachi actually believes that humans don’t have instincts then I have no choice but to declare him legally retarded. No modern full grown human being that doesn’t have a learning disability or irregularity of some sort would actually think humans don’t have instincts.
---
the21gamer wrote:
fuck that load of bullshit. i dont care if the enemy dies. not fighting back is stupid
NEREVAR117 wrote:
You do have instincts, but everything you do doesn’t run off of it.
I’m gonna have to disagree with you.
I’m pretty sure I know what you’re gonna say, and if so then I already see you’re point. I just don’t believe everything you do is running off what instincts tell you to do. Certain things such as finding food and other animalistic traits, sure. But every day life IMO isn’t governed by it.
NEREVAR117 wrote:
You do have instincts, but everything you do doesn’t run off of it.
I’m gonna have to disagree with you.
I’m pretty sure I know what you’re gonna say, and if so then I already see you’re point. I just don’t believe everything you do is running off what instincts tell you to do. Certain things such as finding food and other animalistic traits, sure. But every day life IMO isn’t governed by it.
I kinda do find it to run on istinct. What goes through our minds everyday is to survive. We do these actions because instinctually, we know it will have us survive.
Thinking is a real action, but it is caused by instinct though, so really, I just find thinking to be an instinct. Alot of people would disagree with me though.