S-des Key Generation Code In C

Posted on by

The license entitlement certificate must be redeemed online or via fax in order to obtain the license activation key(s).HP Smart Array Advanced Pack (SAAP) consists of a group of firmware that provides additional and advanced feature functionality within the Smart Array Controllers that requires a license key for activation. Hp license key These licensed features provides an easy key activation to enable features such as added RAID protection, drive erase and performance optimization and more.NOTE: Smart Array Advanced Pack is hosted on the Smart Array Controller hardware and can be enabled on the HP Smart Array P212, P410, P410i, and P411 controllers with a Battery Backed Write Cache module or a Flash Backed Write Cache module.

C-3 We now examine the elements of S-DES in more detail. C.2 S-DES Key Generation S-DES depends on the use of a 10-bit key shared between sender and receiver. From this key, two 8-bit subkeys are produced for use in particular stages of the encryption and decryption algorithm. Figure C.2 depicts the stages followed to produce the subkeys. Step6: As we know S-DES has two round and for that we also need two keys, one key we generate in the above steps (step 1 to step 5). Now we need to generate a second bit and after that we will move to encrypt the plain text or message. It is simple to generate the second key. Simply, go in step 4 copy.

An Algorithm to implement Simplified-DES encryption
Simplified-DES.cpp
S-des Key Generation Code In C
// Algorithm to implement simplified - DES encryption
#include<bits/stdc++.h>
usingnamespacestd;
string Permutation(vector<int> array, string inp){
string out = '';
for(int i=0;i<array.size();i++)
out += inp[array[i]-1];
return out;
}
classS_DES{
public:
string KEY,K1,K2,IPOut,InvIPOut;
string F1Out;
string INPUT,OUTPUT;
voidinitialize(string key){
if(key.size()!=10){
cout<<'nInValid Key-Length '<<key<<''<<key.size();
exit(1);
}
KEY = key;
Keys_Generation();
}
voidKeys_Generation(){
cout<<'Enter P10 permutation array: ';
vector<int> P10(10,0);
for(int i=0;i<10;i++)
cin>>P10[i];
string P10_output = Permutation(P10,KEY);
cout<<'P10 output while generating key: '<<P10_output<<endl;
string P10_left = P10_output.substr(0,5), P10_right = P10_output.substr(5,5);
string pl = LShift(P10_left,1), pr = LShift(P10_right,1);
string plpr = pl+pr;
cout<<'Enter P8 permutation array: ';
vector<int> P8(10,0);
for(int i=0;i<8;i++)
cin>>P8[i];
K1 = Permutation(P8,plpr);
cout<<'K1: '<<K1<<endl;
string pl1=LShift(pl,2), pr1=LShift(pr,2);
plpr = pl1+pr1;
K2 = Permutation(P8,plpr);
cout<<'K2: '<<K2<<endl;
}
string LShift(string input,int n){
string output = input;
char firstbit;
while(n--){
firstbit = output[0];
output = output.substr(1,output.size()-1);
output += firstbit;
}
return output;
}
voidDES_Encryption(){
IP();
string LIP = IPOut.substr(0,4);
string RIP = IPOut.substr(4,4);
cout<<'IP output: '<<IPOut<<endl;
Function_F(LIP,RIP,1);
cout<<'Fn Output: '<<F1Out<<endl;
string L1 = F1Out.substr(0,4), R1 = F1Out.substr(4,4);
Function_F(R1,L1,2);
cout<<'Fn Output second time: '<<F1Out<<endl;
InvIP(F1Out);
cout<<'Encrypted Cipher-string: '<<InvIPOut<<endl;
}
/*Method to perform Initial-Permutation*/
voidIP(){
vector<int> IP_array(8,0);
cout<<'Enter initial Permutation array: ';
for(int i=0;i<8;i++)
cin>>IP_array[i];
IPOut = Permutation(IP_array,INPUT);
}
/*Method to perform Inverse of Initial-Permutation*/
voidInvIP(string input){
vector<int> InvIPArray(8,0);
cout<<'Enter Inverse initial Permutation: ';
for(int i=0;i<8;i++)
cin>>InvIPArray[i];
InvIPOut = Permutation(InvIPArray,input);
}
voidFunction_F(string linput,string rinput,int key)
{
cout<<'Enter E/P array: ';
vector<int> E_P(8,0);
for(int i=0;i<8;i++)
cin>>E_P[i];
string E_POutput = Permutation(E_P,rinput);
string EXOR_Output;
if(key 1)
EXOR_Output = EX_OR(E_POutput,K1);
else
EXOR_Output = EX_OR(E_POutput,K2);
string LEXOR = EXOR_Output.substr(0,4),REXOR = EXOR_Output.substr(4,4);
string SBOX0_Output=SBOX0(LEXOR);
string SBOX1_Output=SBOX1(REXOR);
string SBOX_Output = SBOX0_Output+SBOX1_Output;
cout<<'Enter P4 Operation array: ';
vector<int> P4(4,0);
for(int i=0;i<4;i++)
cin>>P4[i];
string P4_Output = Permutation(P4,SBOX_Output);
string fk_Output = EX_OR(P4_Output,linput);
F1Out = fk_Output + rinput;
}
string EX_OR(string a,string b){
string output = '';
for(int i=0;i<a.size();i++){
if(a[i] b[i])
output += '0';
else
output += '1';
}
return output;
}
string SBOX0(string l)
{
cout<<'Enter Input for S0n';
vector<int> temp(4,0);
vector<vector<int> > S0(4,temp);
for(int i=0;i<4;i++){
for(int j = 0;j<4;j++)
cin>>S0[i][j];
}
string bits[]={'00','01','10','11'};
string lrow = l.substr(0,1)+l.substr(3,1),lcol = l.substr(1,1)+l.substr(2,1);
string SO;
int i,lr,lc,b;
for(i=0;i<4;i++){
if(lrow bits[i])
lr=i;
if(lcol bits[i])
lc=i;
}
b=S0[lr][lc];
return bits[b];
}
string SBOX1(string l)
{
cout<<'Enter Input for S1n';
vector<int> temp(4,0);
vector<vector<int> > S0(4,temp);
for(int i=0;i<4;i++){
for(int j = 0;j<4;j++)
cin>>S0[i][j];
}
string bits[]={'00','01','10','11'};
string lrow = l.substr(0,1)+l.substr(3,1),lcol = l.substr(1,1)+l.substr(2,1);
string SO;
int i,lr,lc,b;
for(i=0;i<4;i++){
if(lrow bits[i])
lr=i;
if(lcol bits[i])
lc=i;
}
b=S0[lr][lc];
return bits[b];
}
};
intmain()
{
int i,n=10,choice;
string key;
S_DES S;
while(1){
cout<<'nWhat do you want to do.n1. Encryptionn2. ExitnnEnter the choice? ';
cin>>choice;
switch(choice){
case1:
cout<<'nEnter the 10-bits KEY: ';
cin>>key;
cout<<'nNotedown this key, as same key is used for Decryptionn';
S.initialize(key);
cout<<'Enter string to encrypt: ';
cin>>S.INPUT;
S.DES_Encryption();
break;
case2:
exit(0);
default:
cout<<'nWrong Choice Enter againnPress any key to return to Main Menu.';
break;
}
}
return0;
}
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment
Generation

This is an implementation in C of DES (Data Encryption Standard).

It does not work correctly, see https://github.com/mimoo/DES/issues/6

This is to be used only for files that are multiples of 64 bits exactly. We used ECB as a mode of operation but haven't implemented any padding system (it is not the point, if you want to add it you can always fork the code!).

DES is a broken cypher and this work is intended for educational purpose.

Files

  • DES.c and DES.h contain the functions used in the DES algorithm.

  • main.c builds the algorithm and allows you to encrypt/decrypt an input file.

S-des Key Generation Code In C B

Use make to build desbox.

According to everything you require for your job, you can pick getting Office Online, Starter Edition, Home and Student, Standard or the most comprehensive edition, Professional Plus. Though you receive another edition of the Office package, you can find each additional application you’ll need as a single solution, such as InfoPath, SharePoint Designer, Visio or Lync.Whichever version you finally pick the compatibility with various languages, for example, Spanish, English as well as simplified Chinese leaves the package very versatile. Office 2010 professional plus activation key. The productivity package developed by Microsoft stands out within the competency as a result of its reliability in regards to performance, and professional productivity operates with only a single installer. Microsoft Office 2010 Key & ActivatorOffice 2010 Product Key package by Microsoft was made in various packs in line with the performance users’ search for.

  • genkey.c is a key generator that prevents weak keys. Use it if you don't have any key to use.

S-des Key Generation Code In C 10

Use make to build the keygen.