コード例 #1
0
ファイル: test.c プロジェクト: odzhan/tinycrypt
int main() {
    uint8_t data[16];
    int     equ;

    memcpy(data, plain, 16);
    belt(key, data);
    equ = (memcmp(data, cipher, 16)==0);
    printf("Bel-T test : %s\n", equ ? "OK" : "FAILED");
    return 0;
}
コード例 #2
0
ファイル: MainCode.cpp プロジェクト: Carraca/LAIG1
void display(void)
{
	// ****** declaracoes internas 'a funcao display() ******
	
	float temp;

	// ****** fim de todas as declaracoes da funcao display() ******

	
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 
	setCamera();
	
	// permissao de atribuicao directa de cores
	// para objectos que nao tem material atribuido, como
	// e' o caso dos eixos e da esfera que simboliza a fonte de luz...
	/*glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
	glEnable(GL_COLOR_MATERIAL);*/

	// Actualizacao da posicao da fonte de luz...
	light0_position[0] = light0x;	// por razoes de eficiencia, os restantes 
	light0_position[1] = light0y;	// parametros _invariaveis_ da LIGHT0 mantem os valores
	light0_position[2] = light0z;	// definidos na funcao de inicializacao
	glLightfv(GL_LIGHT0, GL_POSITION, light0_position);

	// ... e da esfera que a simboliza
	/*glColor3f(1.0,1.0,0.0);		// cor amarela
	gluQuadricOrientation( glQ, GLU_INSIDE);
	glPushMatrix();
	glTranslated(light0x,light0y,light0z);
	gluSphere(glQ, symb_light0_radius, symb_light0_slices, symb_light0_stacks);
    glPopMatrix();
	gluQuadricOrientation( glQ, GLU_OUTSIDE);

	glDisable(GL_COLOR_MATERIAL);*/
	
	glCallList(DP_GEOMETRY);
	glCallList(DP_MACHINE);
	
	glPushMatrix();

	if(st==ST2){
		glTranslated(centerX,0,centerZ);
		glRotated(ang,0,1,0);
		glTranslated(-centerX,0,-centerZ);
	}
	else if(st==ST5){
		glTranslated(centerX,0,centerZ);
		glRotated(-ang,0,1,0);
		glTranslated(-centerX,0,-centerZ);
	}

	glTranslated(robotXa,0,robotZa);
	if(st==ST3||st==ST4||st==ST5)
		glRotated(90,0,1,0);

	light1_position[0] = light1x;	 
	light1_position[1] = light1y;	
	light1_position[2] = light1z;	

	glLightf(GL_LIGHT1, GL_SPOT_CUTOFF, light1_cone_radius);
	glLightfv(GL_LIGHT1, GL_SPOT_DIRECTION, light1_spot_direction);
	glLightfv(GL_LIGHT1, GL_POSITION, light1_position);

	if(n_newspapers>0){
		glPushMatrix();
		glTranslated(0,paperYf,0);
		paper();
		glPopMatrix();
	}
	glCallList(DP_ROBOT);
	glPopMatrix();

	glPushMatrix();
	glTranslated(printingMachineX,0,printingMachineZ+conveyorZ+machineZ);
	belt(conveyorX,conveyorY,conveyorZ);
	drawNewspapers(newspapersX,newspapersY,newspapersZi,newspapersZf);
	glPopMatrix();

	if(st==ST01){
		glPushMatrix();
		glTranslated(newspaperX,0,newspaperZ);
		drawNewspaper(newspapersX,newspapersY,newspaperZi,newspaperZf);
		glPopMatrix();
	}

	if(st==ST02){
		glPushMatrix();
		glTranslated(newspaperX,paperYa,paperZa);
		paper();
		glPopMatrix();
	}

	glPushMatrix();
	glTranslated(platenX,platenY,platenZ);
	glRotated(-platen_ang,1.0,0.0,0.0);
	platen();
	glPopMatrix();

	glPushMatrix();
	glTranslated(guillotinePosX,guillotineYa,guillotinePosZ);	
	guillotine(guillotineX,guillotineY);
	glPopMatrix();

	showCameraNumber();

	glEnable(GL_NORMALIZE);
	// swapping the buffers causes the rendering above to be shown
	glutSwapBuffers();
	// glFlush(); included in the above glutSwapBuffers()
}