⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 secpolicy.bas

📁 银行定储模拟程序
💻 BAS
字号:
Attribute VB_Name = "SecPolicy"
'将银行帐号的密码字符串通过加密算法保护,加强数据库安全!

Option Explicit

' Encipher the text using the pasword.
Public Function Cipher(ByVal From_Text As String) As String
Const MIN_ASC = 32  ' Space.
Const MAX_ASC = 126 ' ~.
Const NUM_ASC = MAX_ASC - MIN_ASC + 1
Dim to_text As String
Dim offset As Long
Dim str_len As Integer
Dim i As Integer
Dim ch As Integer

    ' Initialize the random number generator.
    offset = 8074700
    Rnd -1
    Randomize offset

    ' Encipher the string.
    str_len = Len(From_Text)
    For i = 1 To str_len
        ch = Asc(Mid$(From_Text, i, 1))
        If ch >= MIN_ASC And ch <= MAX_ASC Then
            ch = ch - MIN_ASC
            offset = Int((NUM_ASC + 1) * Rnd)
            ch = ((ch + offset) Mod NUM_ASC)
            ch = ch + MIN_ASC
            to_text = to_text & Chr$(ch)
        End If
    Next i
    Cipher = to_text
End Function
' Encipher the text using the pasword.
Public Function Decipher(ByVal From_Text As String) As String
Const MIN_ASC = 32  ' Space.
Const MAX_ASC = 126 ' ~.
Const NUM_ASC = MAX_ASC - MIN_ASC + 1
Dim to_text As String
Dim offset As Long
Dim str_len As Integer
Dim i As Integer
Dim ch As Integer

    ' Initialize the random number generator.
    offset = 8074700
    Rnd -1
    Randomize offset

    ' Encipher the string.
    str_len = Len(From_Text)
    For i = 1 To str_len
        ch = Asc(Mid$(From_Text, i, 1))
        If ch >= MIN_ASC And ch <= MAX_ASC Then
            ch = ch - MIN_ASC
            offset = Int((NUM_ASC + 1) * Rnd)
            ch = ((ch - offset) Mod NUM_ASC)
            If ch < 0 Then ch = ch + NUM_ASC
            ch = ch + MIN_ASC
            to_text = to_text & Chr$(ch)
        End If
    Next i
Decipher = to_text
End Function



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -