convert small c /c++ program to vb /vb.net

Completed Posted Nov 6, 2011 Paid on delivery
Completed Paid on delivery

i need this prgram in vb

#include <iostream>

using namespace std;

void encrypt(char* buf, unsigned int size){

buf[0] ^= 0xAB;

for(int i = 1; i < size; i++)

buf[i] ^= (buf[i-1] ^ (i-1)) & 0xff;

}

//buf must be of size 3308

#define CHFSIZE 3308

void make_chf(char* buf, char* name, char* username, char* password, char* host, unsigned short portt, unsigned short portu){

char* AREANAME = "Israel (972)";

unsigned short AREANUM = 972;

char* PROTNAME = "TCP/IP";

unsigned short PROTNUM = 2829;

memset(buf, 0, CHFSIZE);

memcpy(buf, "\xaa\xaa\x00\x00\xec\x0c\x00\x00\x01\x00\x01\x000\x0b\x00\x00", 16);

strcpy(buf+16, name);

encrypt(buf, 444);

char* body = buf+444;

strcpy(body+625, AREANAME);

memcpy(body+760, &AREANUM, 2);

body[765] = '\n';

strcpy(body+880, host);

memcpy(body+1255, &PROTNUM, 2);

strcpy(body+1257, PROTNAME);

strcpy(body+1322, "\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x02\x01\x01\x01\x01");

strcpy(body+1649, username);

strcpy(body+1778, password);

buf[2608] = '\x01';

memcpy(body+2710, &portt, 2);

memcpy(body+2712, &portu, 2);

encrypt(body, CHFSIZE-444);

}

int main(int argc, char** argv){

if(argc != 8){

cout << "makechf - Shahar Papini(c)\nUsage: " << argv[0] << " somename username password host tcpport updport outfile([url removed, login to view])" << endl;

return 0;

}

char* chf[CHFSIZE];

make_chf((char*)chf, argv[1], argv[2], argv[3], argv[4], atoi(argv[5]), atoi(argv[6]));

FILE* fOut = fopen(argv[7], "wb");

fwrite(chf, 1, CHFSIZE, fOut);

fclose(fOut);

return 0;

}

.NET ASP C Programming Software Architecture Visual Basic Visual Basic for Apps

Project ID: #3677600

About the project

1 proposal Remote project Active Nov 6, 2011

Awarded to:

vano101

See private message.

$19.15 USD in 3 days
(481 Reviews)
6.6