Hej.Konvertera binärdata till Ascii85
Någon som vet hur jag kan konvertera denna funktion till ASP? Jag vill kunna läsa en bild binärt, konvertera den till Ascii Base-85 via funktionen och sedan spara den som en sträng.
Private Function ToASCII85(ByRef InBuf() As Byte) As String
Dim i As Byte
Dim m As Double
Dim q As Long
Dim l As Long
Dim k As Long
Dim j As Long
Dim lngLen As Long
Dim arrASCII() As Byte
lngLen = UBound(InBuf)
ReDim arrASCII(1 To Int(lngLen * 1.3) + 1)
k = 1
j = 1
While k <= lngLen
l = (lngLen - k) + 1
m = 0
For i = 1 To 4
If i > l Then Exit For
m = m + InBuf(k + i - 1) * (256 ^ (4 - i))
Next
If (m = 0) And (l = 4) Then
arrASCII(j) = Asc("z")
j = j + 1
Else
For i = 1 To 4
q = Int(m / 85 ^ (5 - i))
m = m - q * (85 ^ (5 - i))
arrASCII(j + i - 1) = 33 + q
Next
arrASCII(j + 5 - 1) = 33 + m
j = j + IIf(l < 4, l + 1, 5)
End If
k = k + 4
Wend
ReDim Preserve arrASCII(1 To j)
ToASCII85 = StrConv(arrASCII, vbUnicode) & "~>"
End Function