ROT13.EXE
To those people searching for a program to convert/encode a file to a rot13 format such as that used for firefox configuration files. There is a downloadable file below "rot13.zip" that contains the rot13.exe program to do your conversion. It is very smalll program and it was compiled using a compiler made and sold by Powerbasic that creates compac effiecient fast executable code. It was created from source code contributed to this forum by some forum members. Powerbasic is a very easy to learn compiler for creating dos and windows programs. If you always wanted to create your own programs and really do not know where to start or want something that less hard on the learning curve. Then get yourself a Powerbasic compiler and you can do things you never thought you could. Here is just an example. Like Tom pointed out below, there is not a need for assemble code to produce the great results, functions are built into the Powerbasic compiler for handling text in many different ways, but if you wish to include assemble language into your program along with easy to learn basic language, the Powerbasic compiler will let you do it easily. I love to program with the Powerbasic compiler that creates console type programs, the programs that are not graphical, but there is also a Powerbasic compiler that produces graphic user displays(GUI programs). The code is almost the exact same for both compiliers used, and both compilers produce small fast executable files(an exe file). This forum list so much code examples and friendly member help, you would think your best friend is helping you out. I am just a computer user probably like yourself, except for my english writing are terrible, needing help to produce my own custom made executable programs. Well Powerbasic products have made my dreams come true of getting things my way, the way i want them without a lot of fuss. So discover Powerbasic and join this forum so you can benefit from the experience and free consulting of its members, and we can learn from you as well.
This section of the Powerbasic forum (Source Code) is for listing of source code only and not for general communicating, but i thought a few people out there might find this information from a search program, like google, off the internet and i just wanted to tell you about a great and easy to use programming product that you will not have to sell your kids to purchase.
OK, back on to my original posting of this program.
I really cannot see the need to encode a text file to another text file but that seems to be what has to be done to alter some of the firefox browser settings. This is plumb crazy to have to save a file in such a format. Men really are from Mars.
i originally had both Borje's and Peter's name given credit during the running of this program but i removed it, thinking they not approve of having their names on this program for some kind of liability reasons.
But hey, thanks Borje and Peter.
Here is some of your work at work.
the main work of source comes from two listing at
added:
and i never did get the results i was trying to get out of firefox, i just found a addon to do my dirty work of securing the browser that worked better than anything i tried after 24 hours plus of work. the addon i needed was called "public fox", give it a try, it works more than great.
the first program i compiled to do the rot13 never did work proper and i could not duplicate the problem, i checked the rot13 output to some web pages that could convert the text and they where different, but after i copied the code a second time from http://www.pbcrypto.com/view.php?algorithm=rot13 , it all works now. Then i recopied the code from the powerbasic forum post as listed above and it all worked then. Who knows what happened, i do not, i am sure i must of done a copy and paste wrong and it does not matter now. I do love the capability on the forum of being able to upload a list and exe to the forum and it would of came in handy in previous early years when this forum was put on the internet, but all things where new then on the internet. What a developing experience we all had then and for some still today.
And thanks Tom for the show of the new rot13 work, the replace command is a real winner and will be a flexible function to simplify all kinds of neat work with strings.
To those people searching for a program to convert/encode a file to a rot13 format such as that used for firefox configuration files. There is a downloadable file below "rot13.zip" that contains the rot13.exe program to do your conversion. It is very smalll program and it was compiled using a compiler made and sold by Powerbasic that creates compac effiecient fast executable code. It was created from source code contributed to this forum by some forum members. Powerbasic is a very easy to learn compiler for creating dos and windows programs. If you always wanted to create your own programs and really do not know where to start or want something that less hard on the learning curve. Then get yourself a Powerbasic compiler and you can do things you never thought you could. Here is just an example. Like Tom pointed out below, there is not a need for assemble code to produce the great results, functions are built into the Powerbasic compiler for handling text in many different ways, but if you wish to include assemble language into your program along with easy to learn basic language, the Powerbasic compiler will let you do it easily. I love to program with the Powerbasic compiler that creates console type programs, the programs that are not graphical, but there is also a Powerbasic compiler that produces graphic user displays(GUI programs). The code is almost the exact same for both compiliers used, and both compilers produce small fast executable files(an exe file). This forum list so much code examples and friendly member help, you would think your best friend is helping you out. I am just a computer user probably like yourself, except for my english writing are terrible, needing help to produce my own custom made executable programs. Well Powerbasic products have made my dreams come true of getting things my way, the way i want them without a lot of fuss. So discover Powerbasic and join this forum so you can benefit from the experience and free consulting of its members, and we can learn from you as well.
This section of the Powerbasic forum (Source Code) is for listing of source code only and not for general communicating, but i thought a few people out there might find this information from a search program, like google, off the internet and i just wanted to tell you about a great and easy to use programming product that you will not have to sell your kids to purchase.
OK, back on to my original posting of this program.
I really cannot see the need to encode a text file to another text file but that seems to be what has to be done to alter some of the firefox browser settings. This is plumb crazy to have to save a file in such a format. Men really are from Mars.
i originally had both Borje's and Peter's name given credit during the running of this program but i removed it, thinking they not approve of having their names on this program for some kind of liability reasons.
But hey, thanks Borje and Peter.
Here is some of your work at work.
the main work of source comes from two listing at
added:
and i never did get the results i was trying to get out of firefox, i just found a addon to do my dirty work of securing the browser that worked better than anything i tried after 24 hours plus of work. the addon i needed was called "public fox", give it a try, it works more than great.
the first program i compiled to do the rot13 never did work proper and i could not duplicate the problem, i checked the rot13 output to some web pages that could convert the text and they where different, but after i copied the code a second time from http://www.pbcrypto.com/view.php?algorithm=rot13 , it all works now. Then i recopied the code from the powerbasic forum post as listed above and it all worked then. Who knows what happened, i do not, i am sure i must of done a copy and paste wrong and it does not matter now. I do love the capability on the forum of being able to upload a list and exe to the forum and it would of came in handy in previous early years when this forum was put on the internet, but all things where new then on the internet. What a developing experience we all had then and for some still today.
And thanks Tom for the show of the new rot13 work, the replace command is a real winner and will be a flexible function to simplify all kinds of neat work with strings.
Code:
'compiler pbcc50 a Powerbasic compiler 'this program creates a rot13 encoded file from a text file ' or if the file is encoded, it decodes it 'it creates a file with the same name but with a added extension of ".rot13" 'this code was created almost entirely by Borje Hagsten and Peter P Stephensen 'i just pieced the two together ' the source comes from two listing at 'http://www.powerbasic.com/support/forums/Forum6/HTML/001173.html 'i could not find a easy program to do this conversion so here it is 'my need for it was to create some files needed to alter firefox browser setting. This listing and program might get powerbasic some hits. #COMPILE EXE "ROT13.EXE" #DIM ALL #REGISTER NONE FUNCTION asmROT13(a$) AS STRING IF LEN(a$) = 0 THEN EXIT FUNCTION #REGISTER NONE LOCAL ln AS LONG ln = LEN(a$) ' get string's len into ln ! cmp ln, 0 ; does the string have a length? ! je Exit13Loop ; exit if zero ! mov eax, a$ ; eax = pointer to string handle ! mov eax, [eax] ; eax = pointer to string data Bgn13Loop: ! mov edx, [eax] ; move current char into edx ! cmp ln, 0 ; exit when ln = zero ! jne Continue13Loop ! jmp Exit13Loop ; jump out on end of string Continue13Loop: ! cmp dl, 65 ; CASE 65 TO 90 ! jb NoRot ; if dl < 65 then get next character ! cmp dl, 90 ! jbe Rot13Upper ; if dl <= 90 ! cmp dl, 97 ; CASE 97 TO 122 ! jb NoRot ; if dl < 97 then next character ! cmp dl, 122 ! jbe Rot13Lower ; if dl <= 122 ! jmp NoRot ; CASE ELSE - get next character Rot13Lower: ! add dl, 13 ; Rotate 13 steps forward ! cmp dl, 122 ! ja AdjChar ; if dl became > 122 ! mov [eax], dl ; else write changed char back into a$ ! jmp NoRot Rot13Upper: ! add dl, 13 ; Rotate 13 steps forward ! cmp dl, 90 ! ja AdjChar ; if dl became > 90 ! mov [eax], dl ; else write changed char back into a$ ! jmp NoRot AdjChar: ! sub dl, 26 ! mov [eax], dl ; else write changed char back into a$ ! jmp NoRot NoRot: ! inc eax ! dec ln ; decrease the ln (length) counter ! jmp bgn13Loop Exit13Loop: FUNCTION=a$ END FUNCTION DECLARE FUNCTION GetFile(BYVAL File AS STRING, Buffer AS STRING) AS LONG DECLARE FUNCTION PutFile(BYVAL File AS STRING, Buffer AS STRING) AS LONG FUNCTION ROT13(File AS STRING,newfile AS STRING)AS LONG DIM newbuffer AS STRING LOCAL pl AS LONG POINTER LOCAL Buffer AS STRING LOCAL n AS LONG, i AS LONG IF GetFile(File, Buffer) = 0 THEN EXIT FUNCTION newbuffer=asmROT13(buffer) PutFile NewFile, newbuffer FUNCTION = 1 END FUNCTION '=============================== FUNCTION PBMAIN FUNCTION=1 DIM tempfile AS STRING tempfile=TRIM$(COMMAND$) REPLACE $DQ WITH "" IN tempfile tempfile=TRIM$(tempfile) IF LEN(tempfile)=0 THEN STDOUT "place a file name on the command tail" STDOUT "program encodes a file to and from rot13 format" STDOUT "output name will have an extension of .rot13 added to it" EXIT FUNCTION END IF IF ISFILE(tempfile)=0 THEN STDOUT "no file found -- "+tempfile:EXIT FUNCTION IF rot13(tempfile, tempfile+".rot13") THEN STDOUT tempfile+".rot13 created" ELSE STDOUT "error in reading "+tempfile+" or creating "+tempfile+".rot13" FUNCTION=0 END IF END FUNCTION '=============================== FUNCTION GetFile(BYVAL File AS STRING, Buffer AS STRING) AS LONG LOCAL hFile AS LONG ERR = 0 : hFile = FREEFILE OPEN file FOR BINARY AS hFile IF ERR THEN EXIT FUNCTION GET$ hFile, LOF(hFile), Buffer CLOSE hFile FUNCTION = 1 END FUNCTION '=============================== FUNCTION PutFile(BYVAL File AS STRING, Buffer AS STRING) AS LONG LOCAL hFile AS LONG ERR = 0 : hFile = FREEFILE OPEN File FOR BINARY AS hFile IF ERR THEN EXIT FUNCTION PUT$ hFile, Buffer CLOSE hFile FUNCTION = 1 END FUNCTION
Comment