コード例 #1
0
/**
  * @brief decrypt the msg and save it to the buffer passed in
  */
void decryptor(char *_buffer, int _n, int _d)
{
	unsigned int i=0, j=0;
	char temp[BUFFESIZE];
	int build_temp[BUFFESIZE];
	char de_temp[BUFFESIZE];
	
	memset(temp, 0, BUFFESIZE);
	memset(build_temp, 0, BUFFESIZE);
	memset(de_temp, 0, BUFFESIZE);	
	
	strcpy(temp, _buffer);
	while(2*i < strlen(temp))
	{
		build_temp[i]	=	((temp[2*i] & 0x0f)<<4)	|	(temp[2*i+1]	&	0x0f);
		i++;
	}
	
	while(build_temp[j] != 0)
	{
		de_temp[j] = repeatsquare(build_temp[j], _d, _n);
		j++;
	}
	strcpy(_buffer, de_temp);
}
コード例 #2
0
ファイル: server2013.c プロジェクト: Mooophy/159334
/**
  * @brief decrypt the msg and save it to the buffer passed in
  */
void decryptor(char *_buffer, int _n, int _d)
{
	unsigned int i=0, j=0;
	char temp[BUFFESIZE];
	int build_temp[BUFFESIZE];
	char de_temp[BUFFESIZE];
	
	memset(temp, 0, BUFFESIZE);
	memset(build_temp, 0, BUFFESIZE);
	memset(de_temp, 0, BUFFESIZE);	
	
	strcpy(temp, _buffer);
	while(2*i < strlen(temp))
	{
		build_temp[i]	=	((temp[2*i] & 0x0f)<<4)	|	(temp[2*i+1]	&	0x0f);
		i++;
	}
	
	while(build_temp[j] != 0)
	{
		de_temp[j] = repeatsquare(build_temp[j], _d, _n);
		j++;
	}
	
	printf("@alan n=%d d=%d\n", _n, _d);
	printf("@alan lenth=%d\n",strlen(temp));
	printf("@alan the b(m)=%d\n",build_temp[0]);
	printf("@alan the d(b(m))=%s\n",de_temp );
}