#include "Randomcode.h"
//临时用法，后续再升级高级算法
/* * 加密规则如下:每位数字都加上5,相加后除以10的余数代替该数字,
	 * 再将第一位和第四位交换,第二位和第三位交换
	 * 固定的四位整数
*/

uint16_t Four_num_encrypt(uint16_t number)
{
	uint16_t temp_ask_code = 0;
	uint8_t one,two,three,four;
	uint8_t temp;
	one = (number / 1000 + 5) % 10;
	two = ((number % 1000) / 100 + 5) % 10;
	three = (((number % 1000) % 100) / 10 + 5) % 10;
	four = (((number % 1000) % 100) % 10 + 5) % 10;
	temp = one;
	one = four;
	four = temp;
	temp =  three;
	three = two;
	two = temp;
	temp_ask_code = one*1000+two *100+three *10 +four;
	return temp_ask_code;
}
