pb一次加密再次解密

随便写了一个,输入参数uid,pwd。  
  根据uid加密pwd,第一次调用加密,第二次调用解密。  
  比如:  
  string   uid,pwd  
  uid   =   'admin888'  
  pwd   =   '888admin'  
  pwd   =   gf_encryption(uid,pwd)     //代入uid和pwd,返回加密了的pwd  
  messagebox(uid,pwd)  
  pwd   =   gf_encryption(uid,pwd)     //代入uid和加密的pwd,返回解密的pwd  
  messagebox(uid,pwd)  
   
  =======================================================  
  global   type   gf_encryption   from   function_object  
  end   type  
   
  forward   prototypes  
  global   function   string   gf_encryption   (string   uid,   string   pwd)  
  end   prototypes  
   
  global   function   string   gf_encryption   (string   uid,   string   pwd);  
   
  if   isnull(uid)   or   uid   =   ''   then   return   ''  
  if   len(pwd)   >   8   then   return   ''  
  if   isnull(pwd)   or   pwd   =   ''   then   return   ''  
   
  int   encryptcode,i  
  String   newpwd  
  char   lc_uid[],lc_pwd[]  
  char   c[]  
  encryptcode   =   0  
  if   isnull(uid)   or   uid   =   ''   then   return   ''  
  if   len(pwd)   >   8   then   return   ''  
  if   isnull(pwd)   or   pwd   =   ''   then   return   ''  
   
  lc_uid   =   uid  
  lc_pwd   =   pwd  
  for   i   =   1   to   len(uid)  
      encryptcode   +=   asc(lc_uid[i])*i  
  next  
  for   i   =   1   to   8  
  c[i]   =   '0'  
  next  
   
  for   i   =   1   to   len(pwd)  
      c[i]   =   char(156   -   asc(lc_pwd[i])   +   (mod(i*encryptcode   +   len(pwd),8)))  
  next  
   
  newpwd   =   ''  
  for   i   =   1   to   len(pwd)  
  newpwd   =   newpwd   +   c[i]  
  next  
  return   newpwd  
  end   function   
    
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值