1 題目
功能:明碼序列號保護(hù)描述:使用明碼序列號保護(hù)
2 思路
采用明碼序列號保護(hù)是通過使用序列號對應(yīng)用程序進(jìn)行保護(hù)的最初級的方法通過使用序列號對程序進(jìn)行注冊,獲取使用程序某些功能的權(quán)限采用明碼序列號保護(hù)的方式是通過對用戶輸入的序列號與程序自動生成的合法序列號或內(nèi)置序列號進(jìn)行比較,采用這種方式并不是很安全,容易被截獲到合法的序列號。
3 代碼
#include <stdio.h>
#include <string.h>
/**
功能:明碼序列號保護(hù)
描述:使用明碼序列號保護(hù)
**/
intmain(intargc,charconst*argv[]) {
? char*ysn;? ? ? ? ? ? ? ? ? ? ? ? ? // 聲明字符指針
? char*sn;
? printf("\nPlease input the serial number:\n");? ? ? // 指定合法序列號
? sn="1001-1618-2903";
? scanf("%s",ysn);
if(!strcmp(ysn,sn))? ? ? ? ? ? ? // 進(jìn)行序列號比較
? printf("register succeed");? ? // 注冊成功
else
? printf("register lose");? ? ? // 注冊失敗
? exit();
}
示例結(jié)果:
$ gccex078.c-odemo
$ ./demo
Please input the serial number:
123
register lose
Please input the serial number:
1001-1618-2903
register succeed