College Papers

#include pow(2,i))//pangkat { cout<<"1"; code = code -

#include #include #include #include #include #include using namespace std;class Enkrip//class{ public : unsigned char plain19, cipher19, key19, gkey19;//variabelbool isGeneratedKey = false; void kodeAsciiKeBinner(int code)//fungsi untuk ascii ke binner{       for (int i=7; i>=0; i–)    {        if(code >= pow(2,i))//pangkat        {            cout<<"1";            code = code - pow(2,i);        }        else            cout<<"0";    }} void generateKey()//menyimpan kunci{    isGeneratedKey = true;    int keylen = strlen((char*)key);    for(int i = 0; i<18; i++)    {        gkeyi = keyi % keylen;    }    cout< “<<(int)cipheri<<" --> “;//        kodeAsciiKeBinner((int)cipheri);//        cout< “<<(int)plaini<<" --> “;        kodeAsciiKeBinner((int)plaini);        cout< “<<(int)plaini<<" --> “;        kodeAsciiKeBinner((int)plaini);        cout< “<<(int)cipheri<<" --> “;        kodeAsciiKeBinner((int)cipheri);        cout<