加密ini文件内容,急等

hwh88888 2004-10-05 09:29:52
我把数据库一些配置及一些参数放在ini配置文件里面,但是不想用户能看到,比如登录密码等信息,请问可以对其内容进行加密吗?在线急等!
...全文
143 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
hwh88888 2004-10-05
  • 打赏
  • 举报
回复
谢谢两位
flappySoft 2004-10-05
  • 打赏
  • 举报
回复
string ls_password
string ls_password
int j
ls_password=''
for j=1 to len(password) //用户密码加密
ls_password=ls_password+char(asc(mid(Trim(password),j,1))-2*j)
next
ls_password = trim(ls_password)

return ls_password

int j
ls_password=''
for j=1 to len(password) //用户密码解密
ls_password=ls_password+char(asc(mid(Trim(password),j,1))+2*j)
next
ls_password = trim(ls_password)
return ls_password
Fancy_Free 2004-10-05
  • 打赏
  • 举报
回复
用ASCII码转换,自己随便用个算法,就可以了!这就加密了!

楼主的想法可能是想加密SA密码,简单的加密字符串函数就可以了

可以参考一下

string ls_password,ls_pubkey
long li_temp,li_len,ll_asc1,ll_asc2

function f_password(string fs_password,character fc_status)
//判断密码长度
li_len=len(fs_password)
if li_len>= 15 then
fs_password=left(fs_password,15)
else
fs_password=fs_password+space (15 - li_len)
end if

ls_password=""

CHOOSE CASE fc_status
CASE 'Z'//加密
for li_temp = 1 to 15
ll_asc1 = asc(mid(fs_password,li_temp,1))
ls_password = ls_password + char( ll_asc1 + 2 )
next

CASE 'U'//解密
for li_temp = 1 to 15
ll_asc1 = asc(mid(fs_password,li_temp,1))
ls_password = ls_password + char(ll_asc1 - 2)
next
CASE ELSE
messagebox("提示","用法错误,Z为加密,U为解密!")
return ""
END CHOOSE
return ls_password
我的SA密码放在ini文件中,先加密明文,然后写回ini文件,就成了乱码了,以后每次都可以调用函数解密,连接数据库了

1,075

社区成员

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

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