Quote:
> Does anyone know where I can find the algorythm for base64
> encoding/decoding?
That would waste two bits of "bandwidth" from every byte - unless you
collapsed your data across byte boundaries.
Here goes:
MaxDigit = how ever many digits you want to allow (for example the
internal storage for an integer is a two digit base 256 number, Longs are
stored internally as four digit base 256 numbers)
Number = the number you want to convert (presumably it is decimal)
Base = 64
Function ConvertToBase$(Base, ByVal Number)
Dim NewNum$, Counter, DigitVal
CONST MaxDigit = 10 '(whatever you want, however keep overflows in mind)
NewNum$ = String$(MaxDigit, 0)
For Z = MaxDigit - 1 to 0 Step -1
Counter = 0
DigitVal = Base^Z
Do While Number => DigitVal
Number = Number - DigitVal
Counter = Counter + 1
Loop
Mid$(NewNum$, MaxDigit - Z, 1) = Chr$(Counter)
Next
' Number should = 0 at this point
' NewNum$ now contains your base x number
ConvertToBase$ = NewNum$
End Function
This routine uses the ASCII codes to represent the ordinal values 0 - 255.
-chris