'=========================================================================== ' Subject: ENCODE AND DECODE FILES Date: 01-28-99 (17:03) ' Author: Randall L. Glass Code: PB ' Origin: rlglass@yahoo.com Packet: PB.ABC '=========================================================================== ' Encode ' By Randall L Glass ' Copyright 1998 'You may do anything you want with this program as long as you give me 'credit in the aknowledgments section of the program 'This program is as is.No claims are made for it defint a-z shared code$ rem goto DecodeIt cls input "Enter input FileName ";InFileName$ input "Enter output FileName ";OutFileName$ input "Enter Key Number";KeyNumber& randomize KeyNumber& page$ = "" dim page$(25) open InFileName$ for input as #1 open OutFileName$ for binary as #2 LineNo = 0 do Incr LineNo line input #1,ThisLine$ ln? = len(ThisLine$) Encode ThisLine$ put #2,,ln? put$ #2,ThisLine$ loop until eof(1) ExitNo? = 255 put #2,,ExitNo? close #1,#2 end DecodeIt: input "Press Enter to Start";k$ cls randomize 456977 open "ShareWar.dat" for binary as #1 row = 0 do get #1,,linelen? if linelen? = 255 then exit do get$ #1,linelen?,ThisLine$ decode ThisLine$,74 incr row locate row,6 print ThisLine$; loop until loc(1) >= lof(1) close #1 end sub encode(thisline$) ln = len(thisline$) codeline$ = "" for i = 1 to ln LineAsc? = asc(mid$(thisline$,i,1)) EncodeNo? = rnd*256 +LineAsc? codeline$ = codeline$ + chr$(EncodeNo?) next i ThisLine$ = CodeLine$ END SUB sub decode(ThisLine$,StringLen) codeline$ = string$(StringLen," ") ln = len(thisline$) stringseg& = strseg(ThisLine$) stringptr& = strptr(ThisLine$) def seg = stringseg& for i = 0 to ln-1 LineAsc? = peek(stringptr&+i) EncodeNo? = LineAsc? - rnd*256 mid$(codeline$,i+1,1) = chr$(EncodeNo?) next i ThisLine$ = CodeLine$ DEF SEG END SUB