|
Post by xcoder on Dec 7, 2020 12:32:13 GMT -5
print "##############################################################################"
for i = 0 to 255 x$ = x$ + chr$(i) next i print x$ print a$ = Format85$(x$) print a$ b$ = unFormat85$(a$) print b$
End
function Format85$(dat$) Z85$ = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-:+=^!/*?&<>()[]{}@%$#" datLenMod = len(dat$) mod 4 if datLenMod then padding = 4 - datLenMod for x = 1 to padding dat$ = dat$ + chr$(0) next x for x = 1 to len(dat$) step 4 temp$ = mid$(dat$, x, 4) for y = 1 to 4 conv = (conv * 256) + asc(mid$(temp$, y, 1)) next y for convCount = 1 to 5 char = (conv mod 85) + 1 chunk$ = mid$(Z85$, char, 1) + chunk$ conv = int(conv / 85) next convCount Format85$ = Format85$ + chunk$ chunk$ = "" next x Format85$ = left$(Format85$, len(Format85$) - padding) end function
function unFormat85$(dat$) Z85$ = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-:+=^!/*?&<>()[]{}@%$#" padChr$ = right$(Z85$, 1) datLenMod = len(dat$) mod 5 if datLenMod then padding = 5 - datLenMod for x = 1 to padding dat$ = dat$ + padChr$ next x for x = 1 to len(dat$) step 5 temp$ = mid$(dat$, x, 5) for y = 1 to 5 t$ = mid$(temp$, y, 1) conv = (conv * 85) + (instr(Z85$, t$) - 1) next y for deconvCount = 1 to 4 char = conv mod 256 chunk$ = chr$(char) + chunk$ conv = int(conv / 256) next deconvCount unFormat85$ = unFormat85$ + chunk$ chunk$ = "" next x unFormat85$ = left$(unFormat85$, len(unFormat85$) - padding) end function
|
|