i want 128 bit key in my academic project. Can any one please tell me how to generate 128 bit key in c++.

Use 2 64 bit numbers in a class. What do you want to generate the key from?

Use 2 64 bit numbers in a class. What do you want to generate the key from?

I used unsigned int a [4];

but is there any key generator is there. Which generate 128 bit no.

That is fine, but generate a 128 bit number from what? What is the source of the number you wish to generate or do you just want a random value?

That is fine, but generate a 128 bit number from what? What is the source of the number you wish to generate or do you just want a random value?

yes any random value.

Well call rand() 4 times assigning the result of each call to your array of integers in sucession.

#include <stdlib.h>
#include <iostream>
#include <time.h>
using namespace std;


int main()
{
  int x[4];
  int _key;
  srand ( time(NULL) );
  
  for(int i=0;i<4;i++)
  {
    x[i] = rand();
    
   }

   cout<<"The key is:"<<x[3]<<"-"<<x[2]<<"-"<<x[1]<<"-"<<x[0]<<endl;

  return 0;
}

if you want to customize it to characters you can.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.