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

📄 cod_differ.bas

📁 包含几十个加密解密类和压缩解压缩类,DES,LZW,Huffman
💻 BAS
字号:
Attribute VB_Name = "Cod_Differ"

' **********************************************************************
'  描  述:21种加密54种压缩 算法模块 海阔天空收集整理
'  Play78.com : 网站导航,源码之家,绝对开源
'  海阔天空整理,有问题请上www.paly78.com 提
'  网址:http://www.play78.com/
'  QQ:13355575
'  e-mail:hglai@eyou.com
' **********************************************************************
Option Explicit

'This coder calculates the difference between two codes
'if the first code = 20 and the second code = 15 then then difference
'between those two = -5
'because negative numbers can't be stored in a byte and the range
'can go from -128 to +127, the 0 is stored as 128 so the
'value -5 will become -5+128=123
'  0 = -128
'127 = -1
'128 = 0
'129 = 1
'255 = 127

Public Sub Difference_Coder(ByteArray() As Byte)
    Dim X As Long
    Dim LastCode As Integer
    Dim NewCode As Integer
    Dim OutStream() As Byte
    LastCode = ByteArray(0)
    For X = 1 To UBound(ByteArray)
        NewCode = LastCode - ByteArray(X)
        If NewCode < -128 Then NewCode = NewCode + 256
        If NewCode > 127 Then NewCode = NewCode - 256
        NewCode = 128 + NewCode
        LastCode = ByteArray(X)
        ByteArray(X) = NewCode
    Next
End Sub

Public Sub Difference_DeCoder(ByteArray() As Byte)
    Dim X As Long
    Dim LastCode As Integer
    Dim NewCode As Integer
    Dim OutStream() As Byte
    LastCode = ByteArray(0)
    For X = 1 To UBound(ByteArray)
        NewCode = ByteArray(X) - 128
        LastCode = LastCode - NewCode
        If LastCode < 0 Then LastCode = LastCode + 256
        If LastCode > 255 Then LastCode = LastCode - 256
        ByteArray(X) = LastCode
    Next
End Sub

⌨️ 快捷键说明

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