lowbyte1
Goto Top

Brutforce - Algorithmus in C mit Slavasoft QuickHashS.lib Library (MS C-Cpp) Update 4 Release - For Multicore Cpu

XOR-BASE
http://vpn23.homelinux.org

Eine mögliche Implementierung eines Bruteforce Algorithmus, für ( in meinem Fall) Hash's zu (finden)
Dieser Algorithmus Arbeitet mit Multiblen Threads.Um optimale Geschwindikeit zu erreichen.

Der eigentliche Algorithmus ist mit verschachtelten for() schleifen implementiert wie sie sehen können.
Dabei hat dieser Algorithmus (in meinen Augen) die einzige schwäche das er auf eine Zeichen breite von 15 beschränkt ist.
Was sich aber mit ein bisschen Tiparbeit easy erweitern lässt.

Dieser Algorithmus ist speziell für Multicore Systeme geschriben, da er mit multiblen Threads arbeitet und somit Multicore CPU's Optimal auslastet. Und somit eine hohe Geschwindikeit erreicht wird.


BF & Dictionary Hash Finder(Cracker) 1.11 by LB

//=========================================================================
//
// File    : (BruteForce - Dictionary - Hybrid) Hash splitter v1.0.11
//
// Author  : Lowbyte
//                           
// Create  : 03.03.2009, 03:27,  Long*****
//
// Last Up : 29.05.2009, 07:46,  Long******
//
// Prog.L  : C
//
// Project : 0020N
//
// THX     : Jonny,Sebastian,Michaela,Ruben
//=========================================================================

#include <windows.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <time.h>
#include <math.h>
#include <stdlib.h>
#include "console.h" 
#include "QuickHash.h" 

#define MAX_T	30

#pragma comment( lib, "QuickHashS.lib" ) 

__inline int BF_(int width);
int BF(int sw);
int DIC(void);
unsigned char memory_reduction(unsigned char a_ptr ,unsigned char b_ptr);
unsigned char convchartohex(unsigned char c);
void (*calcstr) ( void* pDest, const char* pSrc );
struct TABLE alpha_splitter(int sizeofalpha ,int thrinst);
DWORD WINAPI STATUS(LPVOID ThreadIns);
DWORD WINAPI THREAD0(LPVOID r);

unsigned char chartable[100];
unsigned char *chartable0={"ABCDEFGHIJKLMNOPQRSTUVWXYZ ",  
						     "abcdefghijklmnopqrstuvwxyz ",  
							 "1234567890",  
							 "1234567890!\"#$%&'()*+,-./:;<=>?@^_`{| }",  
							 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ",  
							 "abcdefghijklmnopqrstuvwxyz!\"#$%&'()*+,-./:;<=>?@^_`{|} ",  
							 "abcdefghijklmnopqrstuvwxyz1234567890 "};  

unsigned char *Hash_Name={"MD2","MD4","MD5","SHA1","SHA2_256","SHA2_384","SHA2_512","RIPEMD128",  
				   "RIPEMD160","RIPEMD256","RIPEMD320","PANAMA","TIGER"};  

int Hash_Size={16,16,16,20,32,48,64,16,20,32,40,32,24};


HANDLE HStat;
DWORD StatId;
HANDLE ThreadH[30][15];
DWORD ThreadID[30][15];


unsigned char hash_buf[250];
unsigned char tmp_hash_buf[250];
unsigned char table[250];
unsigned char output_hash[130];
unsigned char teil_pwd_buf[100];

unsigned char strbuf[31][31][250];

unsigned char tmpbuf[31][31][100];
unsigned char digesthex[31][31][100];

long long count[30][30]={0};
long long counter=0;

/* Split tables */

struct TABLE {

	int START[30];
	int END[30];

} splitpos;

long long len=0;
int stab;
int SIZEH=0;
int DIGESTSIZE=0;
char hashname[15];
int modflag;
int ctable;
long slen;
long elen;
long elem;
int HYBRID=0;
int thrinstanz=0;

FILE *fileptr;

int main()
{

	int op=0;

	/* console style */
	setColor(8);

	do
	{
		system("title LB                                                                         Powered by - Longvalley Computer Club -");  
		printf("\n - Hash splitter v1.0.11 -\n\n");  
		printf("Options:\n");  

		printf("\n1. Brute-Force [ATK]");  
		printf("\n2. Dictionary [ATK]");  
		printf("\n3. Hybrid Brute-Force [ATK]");  
		printf("\n0. Exit\n\n");  

		printf("Input:");  
		fflush(stdin);
		scanf("%1i" ,&op);  

		switch(op) {

			case 1: BF(0);
					break;
			case 2: DIC();
					break;
			case 3:	BF(1);
					break;
			case 0: return 0;

		   default: printf("Wrong input !\n");  
					_sleep(2000);
					cls();
					break;
		}
		cls();
	}
	while(1);

	return 0;
}



/* Dictionary ATK function */

int DIC(void)
{

	WIN32_FIND_DATA data;
	HANDLE h;
	struct stat attr;
	char tmp[126];
	char hash_buf[250];
	int mod;
	size_t table_len=0;
	size_t pass_len=0;
	long i=0;
	int rc=0;
	int d_flag=0;
	int f_flag=0;
	int s;
	int j ,m ,c; 
	int flag=0;

	cls();
	printf("\nDICTIONARY HASH SPLITTER v1.0.11 by lb\n");  
	printf("\n");  
	printf("0 -MD2       7 -RIPEMD128 \n");  
	printf("1 -MD4       8 -RIPEMD192 \n");  
	printf("2 -MD5       9 -RIPEMD256 \n");  
	printf("3 -SHA1     10 -RIPEMD320 \n");  
	printf("4 -SHA256   11 -PANAMA    \n");  
	printf("5 -SHA384   12 -TIGER     \n");  
	printf("6 -SHA512                 \n");  

	printf("\nInput mod:");  
	scanf("%2i", &mod);  

	/* Entsprechende adresse dem pointer zuweisen */
	switch(mod)
	{
		case 0 : calcstr=SL_MD2_CalculateStr; break;
		case 1 : calcstr=SL_MD4_CalculateStr; break;
		case 2 : calcstr=SL_MD5_CalculateStr; break;
		case 3 : calcstr=SL_SHA1_CalculateStr; break;
		case 4 : calcstr=SL_SHA256_CalculateStr; break;
		case 5 : calcstr=SL_SHA384_CalculateStr; break;
		case 6 : calcstr=SL_SHA512_CalculateStr; break;
		case 7 : calcstr=SL_RIPEMD128_CalculateStr; break;
		case 8 : calcstr=SL_RIPEMD160_CalculateStr; break;
		case 9 : calcstr=SL_RIPEMD256_CalculateStr; break;
		case 10: calcstr=SL_RIPEMD320_CalculateStr; break;
		case 11: calcstr=SL_PANAMA_CalculateStr; break;
		case 12: calcstr=SL_TIGER_CalculateStr; break;
	}

	/* Define digest size */
	DIGESTSIZE = Hash_Size[mod];

	fflush(stdin);
	printf("\nInput Hash:");  
	fgets(&hash_buf ,130 ,stdin);
	hash_buf[(strlen(hash_buf)-1)]='\0';  

	/* Memory reduction */
	for(j=0,m=0;(j<DIGESTSIZE);j++) {
		c = memory_reduction(hash_buf[m] ,hash_buf[m+1]);
		tmp_hash_buf[j]=c;
		m +=2;
	}
	tmp_hash_buf[DIGESTSIZE]='\0';  

	strcpy(&output_hash ,&hash_buf);
	strcpy(hash_buf ,tmp_hash_buf);

	do
	{
		rc=0;
		printf("\nInput dictionary or dictionaries of the path (FQPN):");  
		fflush(stdin);
		fgets(&table ,250 ,stdin);
		table_len=strlen(table);
		table[(table_len)-1]='\0';  
		for(s=(int)strlen(table)-1;(s>0);s--){
			if(table[s]=='\\'){  
				d_flag=1;
			}
			if(d_flag==1)
			break;
		}
		if(table[strlen(table)-4] == '.'){  
			f_flag=1;
		}

		if( !((f_flag == 1) || (d_flag == 1)) ){
			printf("wrong input !");  
			_sleep(2000);
			cls();
			rc=1;
		}
	}
	while(rc);

	if(d_flag==1) {

		strcat(table ,"\\*");  

		h = FindFirstFile(table, &data);
		do
		{

			if(! strcmp(data.cFileName,".") ) {  
				flag=1;
			}
			if(! strcmp(data.cFileName,"..") ) {  
				flag=1;
			}
		
			if(flag!=1) {

				strcpy(&tmp ,&table);
				strcpy(&tmp[strlen(tmp)-1] ,"\\");  
				strcat(tmp ,data.cFileName);
				stat(tmp, &attr);

				if(attr.st_mode & S_IFDIR ) {
					;
				}else if(attr.st_mode & S_IFREG) {

					printf("%s\n", data.cFileName);  
					fileptr = fopen(tmp ,"r+");  
					if(fileptr==NULL){
						printf("\nKann File nicht oeffnen / finden ...\n");  
						getchar();
						return 0;
					}

					while( fgets(&tmpbuf ,250 ,fileptr) ){
						pass_len = strlen(&tmpbuf);
						tmpbuf[pass_len-1]='\0';  

						/* Hashing */
						(*calcstr)( &digesthex, &tmpbuf);

						i++;

						if( ! strncmp(&hash_buf ,&digesthex ,DIGESTSIZE) ) {
							printf("\nLine:%li Cracked Hash :%s - Password :%s\n",i ,&output_hash , &tmpbuf );  
							getchar();
							return 0;
						}

					}

					fclose(fileptr);
				}

			}

		flag=0;

		}
		while( FindNextFile(h ,&data) );
		FindClose(h);
		printf("\nNot find ...\n");  
		_sleep(3000);
		cls();

	} else {
		printf("%s\n", data.cFileName);  
		fileptr = fopen(table ,"r+");  
		if(fileptr==NULL){
			printf("\nKann File nicht oeffnen / finden ...\n");  
			getchar();
			return 0;
		}

		while( fgets(&tmpbuf ,250 ,fileptr) ){
			pass_len = strlen(&tmpbuf);
			tmpbuf[pass_len-1]='\0';  

			/* Hashing */
			(*calcstr)( &digesthex, &tmpbuf);

			i++;

			if( ! strncmp(&hash_buf ,&digesthex ,DIGESTSIZE) ) {
				printf("\nLine:%li Cracked Hash :%s - Password :%s\n",i ,&output_hash , &tmpbuf );  
				getchar();
				return 0;
			}

		}

		fclose(fileptr);

		printf("\nNot found ...\n");  
		getchar();

	}

	return 0;
}




/* Brute-force ATK function */

int BF(sw)
{

	int j ,m ,c ,f ,a ,y ,s;
	clock_t start, end;



	/* ---------------------------------Menu------------------------------------ */  
	cls();

	if(sw == 0) {
		printf("\nBRUTE-FORCE HASH SPLITTER v1.0.11 by LB\n\n");  
	} else {
		printf("\nHYBRID BRUTE-FORCE HASH SPLITTER v1.0.11 by LB\n\n");  
	}

	printf("Hash mod's:");		            printf("\t\t\tAlphabet's:\n\n");		  

	printf("0 -MD2       7 -RIPEMD128 ");		printf("\t0 - A-Z space\n");  
	printf("1 -MD4       8 -RIPEMD192 ");		printf("\t1 - a-z space\n");  
	printf("2 -MD5       9 -RIPEMD256 ");		printf("\t2 - 0-9\n");  
	printf("3 -SHA1     10 -RIPEMD320 ");		printf("\t3 - 0-9 sonderzeichen\n");  
	printf("4 -SHA256   11 -PANAMA    ");		printf("\t4 - A-Z a-z space\n");  
	printf("5 -SHA384   12 -TIGER     ");		printf("\t5 - a-z sonderzeichen\n");  
	printf("6 -SHA512                 ");		printf("\t6 - a-z 0-9 space\n");  

	if(sw==1) {

		/* Input teil Password */
		fflush(stdin);
		printf("\nInput teil Password:");  
		fgets(&teil_pwd_buf ,100 ,stdin);
		teil_pwd_buf[(strlen(teil_pwd_buf)-1)]='\0';  
		/* Teil Password in temp Buffer kopieren */
		for(s=0;(s<=30);s++) {
			for(a=0;(a<=30);a++) {
				strcpy(&strbuf[s][a] ,&teil_pwd_buf);
			}
		}
		/* Hybrid mod flag setzen */
		HYBRID = 1;
	}

	/* Input Algorithm mod */
	do
	{
		printf("\nInput Algorithm mod:");  
		scanf("%2i", &modflag );  
		fflush(stdin);
		if(!(modflag < 13)) {
			printf("\nWrong input !\n");  
			_sleep(1000);
		}
	}
	while(!(modflag < 13));

	/* Define digestsize */
	strcpy(&hashname, Hash_Name[modflag]);
	SIZEH=Hash_Size[modflag];

	/* Input hash */
	do
	{
		fflush(stdin);
		printf("\nInput Hash:");  
		fgets(&hash_buf ,130 ,stdin);
		hash_buf[(strlen(hash_buf)-1)]='\0';  
		if(!(SIZEH==(strlen(hash_buf)-SIZEH)) ) {
			printf("\nWrong input !\n");  
			printf("The length of the %s Hash must be exactly %i Byte long !\n",&hashname ,SIZEH);  
		}
	}
	while(!(SIZEH==(strlen(hash_buf)-SIZEH)) );

	/* Memory reduction */
	for(j=0,m=0;(j<SIZEH);j++) {
		c = memory_reduction(hash_buf[m] ,hash_buf[m+1]);
		tmp_hash_buf[j]=c;
		m +=2;
	}
	tmp_hash_buf[SIZEH]='\0';  

	strcpy(&output_hash ,&hash_buf);
	strcpy(hash_buf ,tmp_hash_buf);

	/* Input alphabet */
	do
	{
		printf("\nInput Alphabet (0-6):");  
		scanf("%1i", &ctable );  
		fflush(stdin);
		if(!(ctable < 7)) {
			printf("\nWrong input !\n");  
			_sleep(1000);
		}
	}
	while(!(ctable < 7));

	/* Input start width */
	do
	{
		printf("\nStart bei WORD breite (MAX 15):");  
		scanf("%2i",&slen);  
		fflush(stdin);
		if(!(slen <= 15)) {
			printf("\nWrong input !\n");  
			_sleep(1000);
		}
	}
	while(!(slen <= 15));

	/* Input end width */
	do
	{
		printf("\nEnde bei WORD breite (MAX 15):");  
		scanf("%2i",&elen);  
		fflush(stdin);
		if( !((elen <= 15) && (elen>=slen))) {
			printf("\nWrong input !\n");  
			_sleep(1000);
		}
	}
	while( !((elen <= 15) && (elen>=slen)) );

	/* Input thread instanzen */
	do
	{
		printf("\nInput Thread instanzen (MAX 30 & <= ALPHA_LEN):");  
		scanf("%2i",&thrinstanz);  
		fflush(stdin);
		if( !( (thrinstanz<=MAX_T) && (thrinstanz <= (int)strlen(chartable0[ctable]))) ) {
			printf("\nWrong input !\n");  
			_sleep(1000);
		}
	}
	while( !( (thrinstanz <= MAX_T) && (thrinstanz <= (int)strlen(chartable0[ctable])) ) );

	cls();

	/*-------------------------------------------------------------------------- */

	/* Entsprechende Adresse dem Pointer zuweisen */
	switch(modflag)
	{
		case 0 : calcstr=SL_MD2_CalculateStr; break;
		case 1 : calcstr=SL_MD4_CalculateStr; break;
		case 2 : calcstr=SL_MD5_CalculateStr; break;
		case 3 : calcstr=SL_SHA1_CalculateStr; break;
		case 4 : calcstr=SL_SHA256_CalculateStr; break;
		case 5 : calcstr=SL_SHA384_CalculateStr; break;
		case 6 : calcstr=SL_SHA512_CalculateStr; break;
		case 7 : calcstr=SL_RIPEMD128_CalculateStr; break;
		case 8 : calcstr=SL_RIPEMD160_CalculateStr; break;
		case 9 : calcstr=SL_RIPEMD256_CalculateStr; break;
		case 10: calcstr=SL_RIPEMD320_CalculateStr; break;
		case 11: calcstr=SL_PANAMA_CalculateStr; break;
		case 12: calcstr=SL_TIGER_CalculateStr; break;
	}
	
	/* Copy alphabet */
	strcpy(&chartable ,chartable0[ctable]);

	/* Get size of table */
	stab = (int)strlen(chartable);

	/* Alpha splitten	*/
	splitpos = alpha_splitter( (int)strlen( *(chartable0+ctable) ) ,thrinstanz);
	
	/* Cursor off */
	cursorOff();

	/* Start Thread Status */
	HStat = CreateThread(NULL ,0 ,&STATUS ,(LPVOID)(long long)elen ,0 ,&StatId );

	_sleep(500);

	/* Zeitmessung start*/
	start = clock();

	/* Start BF Algo. */
	for(f=slen;(f<=elen);f++) {
		for(y=0;(y<thrinstanz);y++) {
			ThreadH[y][f] = CreateThread(NULL ,0 ,THREAD0 ,(LPVOID) (long long) f ,0 ,&ThreadID[y][f]);
		}
	}
	
	/* Elemente und Position im Array berechnen */
	if((elen - slen) == 0){
		elem = 1;
	}  else {
		elem = ((elen-slen)+1);
	}

	/* Warten auf alle Objekte */
	for(y=0;(y<thrinstanz);y++) {
		WaitForMultipleObjects( elem ,&ThreadH[y][slen] ,TRUE ,INFINITE );
	}

	/* Zeitmessung ende */
	end = clock();

	/* Terminate stat thread */
	_sleep(2000);
	TerminateThread(HStat,0);
	_sleep(1000);

	/* Handle Release */
	for(f=(slen);(f<=elen);f++) {
		for(y=0;(y<thrinstanz);y++) {
			CloseHandle(ThreadH[y][f]);
		}
	}
	CloseHandle(HStat);

	/* Calculate count */
	counter = 0;
	for(y=0;(y<thrinstanz);y++) {
		for(f=slen;(f<=elen);f++) {
			counter += count[y][f];
		}
	}

	/* Output */
	printf("\n\n --Process completed-- \n");  
	printf("\nAlgorithm     : %s",&hashname);  
	printf("\nAlphabet      : %s", &chartable);  
	printf("\nWord width    : %i-%i",slen ,elen);  
	printf("\nAlpha-Threads : %i",thrinstanz);  
	printf("\nCombinations  : %Li",counter);  
	printf("\nTime          : %.2fSec",(float)(end-start) / CLOCKS_PER_SEC);  

	/* Var counter reset */
	for(y=0;(y<thrinstanz);y++) {
		for(f=0;(f<30);f++) {
			count[y][f] = 0;
		}
	}
	counter = 0;
	HYBRID = 0;

	/* Cursor on */
	cursorOn();

	getchar();
	return 0;

}



DWORD WINAPI THREAD0(r)
{ 
	BF_(r);
	ExitThread(0);
}



int BF_(int width)
{
	int r[15]={0};
	int sp[15]={0};
	static int spl[30]={0};
	register int i ,f;
	register int widthinc=0;

	widthinc = width;
	--widthinc;

	spl[widthinc]++;
	if( !(thrinstanz > spl[widthinc]) ) {
		spl[widthinc] = 0;
	}
	sp[widthinc] = spl[widthinc];

	for(r[14]=0;(r[14]<stab);r[14]++) {
	  for(r[13]=0;(r[13]<stab);r[13]++) {
		for(r[12]=0;(r[12]<stab);r[12]++) {
		  for(r[11]=0;(r[11]<stab);r[11]++) {
			for(r[10]=0;(r[10]<stab);r[10]++) {
			  for(r[9]=0;(r[9]<stab);r[9]++) {
				for(r[8]=0;(r[8]<stab);r[8]++) {
				  for(r[7]=0;(r[7]<stab);r[7]++) {
					for(r[6]=0;(r[6]<stab);r[6]++) {
					  for(r[5]=0;(r[5]<stab);r[5]++) {
						for(r[4]=0;(r[4]<stab);r[4]++) {
						  for(r[3]=0;(r[3]<stab);r[3]++) {
							for(r[2]=0;(r[2]<stab);r[2]++) {
							  for(r[1]=0;(r[1]<stab);r[1]++) {
								  for(r=0;(r<stab);r++) {

									/* Initialisieren - verlassen */
									if(r[widthinc]==0) r[widthinc] = splitpos.START[sp[widthinc]];
									if(r[widthinc]== splitpos.END[sp[widthinc]]) return 0;

									/* String (password) build */
									for(f=0;(f<width);f++){
										tmpbuf[sp[widthinc]][widthinc][f]  =  chartable[r[f]];
									}

									/* Hybrid mod */
									if(HYBRID == 1) {
										tmpbuf[sp[widthinc]][widthinc][(f)]='\0';  
										strcpy(&strbuf[sp[widthinc]][widthinc][strlen(teil_pwd_buf)] ,&tmpbuf[sp[widthinc]][widthinc]);
										strcpy(&tmpbuf[sp[widthinc]][widthinc] ,&strbuf[sp[widthinc]][widthinc]);
									}

									/* Callback hash funktion */
									(*calcstr)( &digesthex[sp[widthinc]][widthinc], &tmpbuf[sp[widthinc]][widthinc]);

									/* Binary Hash's vergleichen */ 
									if( ! strncmp(&hash_buf ,&digesthex[sp[widthinc]][widthinc], SIZEH) ) {
										_sleep(1000);
										TerminateThread(HStat,0);
										printf("\n\nCracked Hash :%s - Password :%s\n\n" ,&output_hash , &tmpbuf[sp[widthinc]][widthinc] );  
										/* Therminate all Threads */
										for(i=(slen-1);i<=elen;i++) {
											for(f=0;(f<=thrinstanz);f++) {
												if((i != width)){
							    					TerminateThread(ThreadH[f][i],0);
												}	
											}
										}
										for(i=0;(i<30);i++) {
											spl[i]=0;
										}
										return 0;
									}

									/* Counter increment */
									count[sp[widthinc]][width]++;

								  }
								  if(width==1) return 0;
								}
								if(width==2) return 0;
							  }
							  if(width==3) return 0;
						    }
							if(width==4) return 0;
					      }
						  if(width==5) return 0;
			    	    }
						if(width==6) return 0;
			         }
					  if(width==7) return 0;
				    }
					if(width==8) return 0;
				  }
				  if(width==9) return 0;
				}
				if(width==10) return 0;
            }
			  if(width==11) return 0;
          }
		   if(width==12) return 0;
        }
		 if(width==13) return 0;
      }
	   if(width==14) return 0;
	}
	return 0;
} 





DWORD WINAPI STATUS(ThreadIns)
{
	register int t ,x ,f;
	long double stat=0;
	long double potenz=0;

	/* Set thread priority TIME_CRITICAL*/
	SetThreadPriority(HStat ,THREAD_PRIORITY_TIME_CRITICAL);

	/* Potenz berechnung */
	for(x=ThreadIns; (x>(slen-1)) ;x--) {
		potenz += (long long)pow((long double)strlen(chartable),(long double)x);
	}

	while(1) {

		/* Calculate counter */
		for(x=0;(x<thrinstanz);x++) {
			for(f=slen;(f<=elen);f++) {
				counter += count[x][f];
			}
		}

		/* STATUS Output */
		printf("\n\nProcessing %%\n\n");  
		stat = (long double)((long double) counter / potenz);
		printf("\nSTATUS %.2f%% : ", (float)(stat*100));  
		for(t=0;(t<(int)(((int)(stat*100))>>1));t++) {
			printf("%c", 219);  
		}
		for(t=(int)(((int)(stat*100))>>1);t<50;t++) {
			printf("%c", 177);  
		}

		counter=0;
		_sleep(1000);
		cls();	

	}

	return 0;

}


unsigned char memory_reduction(unsigned char a_ptr ,unsigned char b_ptr)
{
	unsigned char a ,b;

	a = convchartohex(a_ptr);
	b = convchartohex(b_ptr);

	return b|a<<4;


}


unsigned char convchartohex(unsigned char c)
{

	if(c >= 'a' && c <= 'f'){  
		return 10 + (c - 'a');  
	}
	if(c >= '0' && c <= '9'){  
		return c - '0';  
	}
	return 0;
}




struct TABLE alpha_splitter(int sizeofalpha ,int thrinst)
{
	int split=0;
	int res=0;
	int s ,y;
	struct TABLE pos;

	/* Berechen aus Alphabetlänge und Threadinstanzen
	   den Teiler und Restwert
	*/
	split = (sizeofalpha / thrinst);
	res	  =	(sizeofalpha % thrinst);

	/* Struct var`s set zero */
	memset(&pos.START ,0 ,30);
	memset(&pos.END ,0 ,30);

	/* Initialisierung Start */
	for(y=1;(y<=thrinst);y++) {
		pos.START[y] = (pos.START[(y-1)] + split);
	}

	/* Restwert verteilen */
	for(y=2;(y<=res);y++) {
		for(s=y;(s<=(thrinst));s++) {
			pos.START[s] += 1;	
		}
	}

	/* Initialisierung Ende */
	for(y=0;(y<thrinst);y++) {
		pos.END[y]=pos.START[y+1];
	}

	/* Define START - END point */
	pos.START=0;
	pos.END[thrinst-1]=sizeofalpha;

	printf("\n\n");  
	for(s=0;(s<thrinstanz);s++) {
		printf("Start:%i - End:%i\n",pos.START[s] ,pos.END[s]);  
		_sleep(100);
	}

	return pos;
}

Content-ID: 110282

Url: https://administrator.de/contentid/110282

Ausgedruckt am: 23.11.2024 um 05:11 Uhr