zoukankan      html  css  js  c++  java
  • Domino 加密密码 与C#版本对应

    Public Function Encrypt(strPWtoEncrypt As String) As String
    Dim strPword As String
    Dim bytCount As Byte
    Dim intTemp As Integer

    For bytCount = 1 To Len(strPWtoEncrypt)
    intTemp = Asc(Mid(strPWtoEncrypt, bytCount, 1))
    If bytCount Mod 2 = 0 Then
    intTemp = intTemp - bytEncrypt
    Else
    intTemp = intTemp + bytEncrypt
    End If

    intTemp = intTemp Xor (10 - bytEncrypt)
    strPword = strPword & Chr$(intTemp)
    Next bytCount
    'Some words cannot be used as file name
    Encrypt = strPword
    Encrypt = Replace(strPword, "\", "{01}")
    Encrypt = Replace(strPword, "/", "{02}")
    Encrypt = Replace(strPword, ":", "{03}")
    Encrypt = Replace(strPword, "*", "{04}")
    Encrypt = Replace(strPword, "?", "{05}")
    Encrypt = Replace(strPword, """", "{06}")
    Encrypt = Replace(strPword, "<", "{07}")
    Encrypt = Replace(strPword, ">", "{08}")
    Encrypt = Replace(strPword, "|", "{09}")

    End Function
    Public Function Decrypt(strPWtoDecrypt As String) As String
    Dim strPword As String
    Dim bytCount As Byte
    Private Const bytEncrypt = 5

    Dim intTemp As Integer

    strPWtoDecrypt = Replace(strPWtoDecrypt, "{01}", "\")
    strPWtoDecrypt = Replace(strPWtoDecrypt, "{02}", "/")
    strPWtoDecrypt = Replace(strPWtoDecrypt, "{03}", ":")
    strPWtoDecrypt = Replace(strPWtoDecrypt, "{04}", "*")
    strPWtoDecrypt = Replace(strPWtoDecrypt, "{05}", "?")
    strPWtoDecrypt = Replace(strPWtoDecrypt, "{06}", """")
    strPWtoDecrypt = Replace(strPWtoDecrypt, "{07}", "<")
    strPWtoDecrypt = Replace(strPWtoDecrypt, "{08}", ">")
    strPWtoDecrypt = Replace(strPWtoDecrypt, "{09}", "|")

    For bytCount = 1 To Len(strPWtoDecrypt)
    intTemp = Asc(Mid(strPWtoDecrypt, bytCount, 1)) Xor (10 - bytEncrypt)
    If bytCount Mod 2 = 0 Then
    intTemp = intTemp + bytEncrypt
    Else
    intTemp = intTemp - bytEncrypt
    End If

    strPword = strPword & Chr$(intTemp)
    Next bytCount

    Decrypt = strPword
    End Function

  • 相关阅读:
    性能测试-地铁模型分析
    如何测试网页登录页面
    软件测试修炼之道(转载)
    每当在测试之路迷茫的时候来看看这篇文章
    软件测试博客较好的网址(供参考)
    Spring扩展:替换IOC容器中的Bean组件 -- @Replace注解
    拯救老旧工程,记桥接SpringMVC与Stripes框架
    Netty实现WebSocket,URI参数问题
    高性能内存队列Disruptor--原理分析
    Idea中Smart Tomcat插件启动报NullPointerException问题
  • 原文地址:https://www.cnblogs.com/blackbean/p/2108191.html
Copyright © 2011-2022 走看看