密码比较函数
时间:10-02
整理:3721RD
点击:
//密码检验
CRC = 0;
for(i=0;i<PasswordLength;i++)
{
if(PasswordTemp == Password)++CRC;
}
//输入新密码正确的处理
if(CRC == PasswordLength)
{
//==============================================
//写入新输入的密码
for(i=0;i<PasswordLength;i++)
{
WriteByteToAddress(Password,PasswordSaveAddr+i); //从密码保存基址开始写入密码.
Delay1ms(10);
}
//==============================================
//读出刚输入的密码进行校验,防止误输入.
CRC = 0;
for(i=0;i<PasswordLength;i++)
{
if(ReadByteByAddress(PasswordSaveAddr+i)== Password)++CRC;
}
//==============================================
//密码写入成功
if(CRC == PasswordLength) //写入成功
{
//提示信息:修改密码成功
GotoXY(0,0);
Print("==== succeed ===");
GotoXY(0,1);
Print(" Write succeed! ");
Delay1ms(2000);
}
我想问一下的是:CRC是循环冗余码校验,在这段程序中是如何进行密码检验的,谢谢
CRC = 0;
for(i=0;i<PasswordLength;i++)
{
if(PasswordTemp == Password)++CRC;
}
//输入新密码正确的处理
if(CRC == PasswordLength)
{
//==============================================
//写入新输入的密码
for(i=0;i<PasswordLength;i++)
{
WriteByteToAddress(Password,PasswordSaveAddr+i); //从密码保存基址开始写入密码.
Delay1ms(10);
}
//==============================================
//读出刚输入的密码进行校验,防止误输入.
CRC = 0;
for(i=0;i<PasswordLength;i++)
{
if(ReadByteByAddress(PasswordSaveAddr+i)== Password)++CRC;
}
//==============================================
//密码写入成功
if(CRC == PasswordLength) //写入成功
{
//提示信息:修改密码成功
GotoXY(0,0);
Print("==== succeed ===");
GotoXY(0,1);
Print(" Write succeed! ");
Delay1ms(2000);
}
我想问一下的是:CRC是循环冗余码校验,在这段程序中是如何进行密码检验的,谢谢