zoukankan
html css js c++ java
SQLDBCompare2.4 序列号代码
private
void
button1_Click(
object
sender, EventArgs e)
{
textBox1.Text
=
GenerateNewKey(
"
$BE$T$
"
,
102
,
false
,
500
);
}
public
static
string
GenerateNewKey(
string
strSecurityCode,
int
nProductCode,
bool
bTrial,
int
nTrialDays)
{
if
(
!
strSecurityCode.Equals(
"
$BE$T$
"
))
{
return
""
;
}
string
str
=
Guid.NewGuid().ToString().Replace(
"
-
"
,
""
);
string
str2
=
""
;
if
(bTrial)
{
str2
=
"
2
"
+
nTrialDays.ToString(
"
D3
"
)
+
"
00000000
"
+
nProductCode.ToString(
"
D3
"
);
}
else
{
str2
=
"
1123ABCDEFGH
"
+
nProductCode.ToString(
"
D3
"
);
}
char
[] chArray
=
(str
+
"
$
"
+
str2).ToCharArray();
byte
[] inArray
=
new
byte
[chArray.Length];
for
(
int
i
=
0
; i
<
chArray.Length; i
++
)
{
inArray[i]
=
(
byte
)chArray[i];
}
string
strKey
=
Convert.ToBase64String(inArray);
string
str4
=
GetStringCheckSumValue(strKey).ToString(
"
D3
"
);
return
(strKey
+
str4);
}
public
static
int
GetStringCheckSumValue(
string
strKey)
{
int
i1
=
0
;
byte
b2
=
1
;
for
(
int
i2
=
0
; i2
<
strKey.Length; i2
++
)
{
byte
b1
=
(
byte
)strKey[i2];
for
(
int
i3
=
0
; i3
<
8
; i3
++
)
{
if
((b1
&
(b2
<<
(i3
&
31
)))
==
0
)
i1
++
;
}
}
return
i1;
}
查看全文
相关阅读:
C. Uncle Bogdan and Country Happiness solution
B
A
Problem of Precision solution
hdu-2255 D
hdu1325 Is It A Tree? solution
一体化办公系统
dx:ASPxGridView 批量删除
linq 多表查询出现‘查询包含对不同数据上下文上所定义项的引用。’
DevExpress学习笔记之ASPxMenu
原文地址:https://www.cnblogs.com/lovebanyi/p/927869.html
最新文章
K8S系列-1.离线部署K8S集群
Docker系列-8.容器数据存储
Docker系列-7.容器间通信
Docker系列-6.企业级Registry镜像仓库
Docker系列-5.分发镜像
Docker系列-4.构建镜像
N多系统单点登录,实现、解决方案
Loki 部署使用
Docker 常用命令
为什么不应该在分页中使用OFFSET和LIMIT
热门文章
springboot 外部配置文件spring.config.location 为什么不生效?
电脑添加多个SSH key
springboot Jar包开启远程调试
Javascript 中 数组遍历 forin和forof 的区别
ELK安装 docker-compose.yml
elasticsearch7.6 安装 并且开启外网访问,真的好累。
Gifts Fixing solution
Boats Competition solution
Binary String To Subsequences solution
Remove SmallestSmallest solution
Copyright © 2011-2022 走看看