我想给我的软件必须要登陆密码才能进入?如何存储密码好呢?

huiyan2004 2004-12-07 04:00:09
能否存储在EXE文件里?
还是有更好的方法呢?
...全文
157 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
jiangsky 2004-12-07
  • 打赏
  • 举报
回复
Up的朋友不错,我怎么看不懂呀!发现我在灿了
Fashionxu 2004-12-07
  • 打赏
  • 举报
回复
关键字 VB 加密/解密 汉字加密

全部代码入下:

Function UserCode(password As String) As String
'用户口令加密
Dim il_bit, il_x, il_y, il_z, il_len, i As Long
Dim is_out As String
il_len = LenB(password)
il_x = 0
il_y = 0
is_out = ""
For i = 1 To il_len
il_bit = AscB(MidB(password, i, 1)) 'b系列支持中文

il_y = (il_bit * 13 Mod 256) + il_x
is_out = is_out & ChrB(Fix(il_y)) '取整 int和fix区别: fix修正负数
il_x = il_bit * 13 / 256
Next
is_out = is_out & ChrB(Fix(il_x))

password = is_out
il_len = LenB(password)
il_x = 0
il_y = 0
is_out = ""
For i = 1 To il_len
il_bit = AscB(MidB(password, i, 1))
'取前4位值
il_y = il_bit / 16 + 64
is_out = is_out & ChrB(Fix(il_y))
'取后4位值
il_y = (il_bit Mod 16) + 64
is_out = is_out & ChrB(Fix(il_y))
Next
UserCode = is_out
End Function


Function UserDeCode(password As String) As String
'口令解密
Dim is_out As String
Dim il_x, il_y, il_len, i, il_bit As Long

il_len = LenB(password)
il_x = 0
il_y = 0
is_out = ""
For i = 1 To il_len Step 2
il_bit = AscB(MidB(password, i, 1))
'取前4位值
il_y = (il_bit - 64) * 16
'取后4位值
'dd = AscW(Mid(password, i + 1, 1)) - 64
il_y = il_y + AscB(MidB(password, i + 1, 1)) - 64
is_out = is_out & ChrB(il_y)
Next

il_x = 0
il_y = 0
password = is_out
is_out = ""

il_len = LenB(password)
il_x = AscB(MidB(password, il_len, 1))
For i = (il_len - 1) To 1 Step -1
il_y = il_x * 256 + AscB(MidB(password, i, 1))
il_x = il_y Mod 13
is_out = ChrB(Fix(il_y / 13)) & is_out
Next
UserDeCode = is_out
End Function



happy_sea 2004-12-07
  • 打赏
  • 举报
回复
加密后保存在注册表中是最好的方法。
bboos 2004-12-07
  • 打赏
  • 举报
回复
最简单,最有效,把密码存在文本文件中,把后缀名改了,再藏到系统目录下,估计很少有好事者去偷看你的密码。
wwqna 2004-12-07
  • 打赏
  • 举报
回复
注册表或是文件里面都行了。
creazyfish 2004-12-07
  • 打赏
  • 举报
回复
如果是单机版的话,只能存在ini文件中了,但是这样就没什么保密性可言了,除非对用户名密码进行加密处理,当然你也可以直接写在程序中,那样的话你写死了。

7,788

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧