06-15-2003, 10:19 PM
im about the same as Meg, i know nothing about encryption, but this baby program i wrote was fun for me to do.
my program will take the text ( or file ) that you enter and change each character to its ascii value.
i know a real attack could take it without even thinking, but nobody in my house knows anything about anything.
my program will take the text ( or file ) that you enter and change each character to its ascii value.
i know a real attack could take it without even thinking, but nobody in my house knows anything about anything.
Code:
DECLARE SUB Encrypt (outputmethod%, text$, outfile$)
DECLARE SUB Decrypt (outputmethod%, text$, outfile$)
program$ = "OVERdosE"
version$ = "v1.0"
main:
CLS
PRINT "Welcome to OVERdosE!!"
PRINT "Over(Disk Operating System)Encryption"
PRINT
PRINT
PRINT "1 )-- Encrypt"
PRINT "2 )-- Encrypt a file"
PRINT "3 )-- Decrypt"
PRINT "4 )-- Decrypt a file"
PRINT "5 )-- Quit"
DO
h$ = INKEY$
LOOP UNTIL h$ = "1" OR h$ = "2" OR h$ = "3" OR h$ = "4" OR h$ = "5"
SELECT CASE h$
CASE "1"
'this is for encryption
CLS
PRINT "Enter the text you want encrypted:"
PRINT
LINE INPUT text1$
CALL Encrypt(1, text1$, "")
CASE "2"
CLS
INPUT "Enter the directory and filename to encrypt: ", file$
INPUT "Enter the directory and filename to output to: ", output$
OPEN file$ FOR RANDOM AS #(FREEFILE) LEN = 128
GET #(FREEFILE - 1), 3, text$
CLOSE #(FREEFILE - 1)
CALL Encrypt(2, text$, output$)
CASE "3"
'this is for decryption
CLS
PRINT "Enter the encrypted text you want decoded:"
PRINT
LINE INPUT encrypted$
CALL Decrypt(1, encrypted$, "")
CASE "4"
CLS
INPUT "Enter the directory and filename to decode: ", file$
INPUT "Enter the directory and filename to output to: ", output$
OPEN file$ FOR RANDOM AS #(FREEFILE)
GET #(FREEFILE - 1), 3, text$
CALL Decrypt(2, text$, output$)
CASE "5"
FOR x% = 1 TO FREEFILE - 1
CLOSE #(x%)
NEXT
END
CASE ELSE
'in case of errors:
PRINT "There was an error in the program, please try again."
LOCATE 24: PRINT "Press any key to continue"
END SELECT
SLEEP
GOTO main
SUB Decrypt (outputmethod%, text$, outfile$)
length% = (LEN(text$) * 2) MOD 3
SELECT CASE length%
CASE 0
PRINT "Decrypting..."
CASE ELSE
PRINT "There is an error with your text, please try again."
PRINT
EXIT SUB
END SELECT
plain$ = ""
FOR x% = 0 TO LEN(text$) - 3 STEP 3
nextcode% = VAL(MID$(text$, x% + 1, 3))
newletter$ = STRING$(1, (CHR$(nextcode%)))
PRINT "Next code: " + STR$(nextcode%), "New letter: " + newletter$
plain$ = plain$ + newletter$
NEXT
SELECT CASE outputmethod%
CASE 1
PRINT "Your freshly decoded text is now this:"
PRINT
PRINT plain$
PRINT
PRINT "Would you like this saved? (y/n)"
DO
h$ = INKEY$
LOOP UNTIL LCASE$(h$) = "y" OR LCASE$(h$) = "n"
SELECT CASE h$
CASE "y"
PRINT
PRINT "Enter the directory and filename you would like to save to:"
INPUT save$
OPEN save$ FOR RANDOM AS #(FREEFILE)
PUT #(FREEFILE - 1), 1, program$
PUT #(FREEFILE - 1), 2, version$
PUT #(FREEFILE - 1), 3, plain$
CLOSE #(FREEFILE - 1)
PRINT
PRINT "Saved on demand successfully"
END SELECT
CASE 2
OPEN outfile$ FOR RANDOM AS #(FREEFILE)
PUT #(FREEFILE - 1), 1, program$
PUT #(FREEFILE - 1), 2, version$
PUT #(FREEFILE - 1), 3, plain$
CLOSE #(FREEFILE - 1)
PRINT
PRINT "Save command successful."
END SELECT
END SUB
SUB Encrypt (outputmethod%, text$, outfile$)
length% = (LEN(text$) * 2) MOD 2
SELECT CASE length%
CASE 0
PRINT "Encrypting..."
CASE ELSE
PRINT "There is an error with your text, please try again."
PRINT
EXIT SUB
END SELECT
encrypted$ = ""
FOR x% = 0 TO LEN(text$) - 1
nextletter$ = MID$(text$, x% + 1, 1)
newcode$ = STR$(ASC(nextletter$))
newcode$ = LTRIM$(newcode$)
PRINT "Character: " + nextletter$, "Code: " + newcode$
IF (LEN(newcode$) <= 2) THEN
encrypted$ = encrypted$ + "0" + newcode$
ELSE
encrypted$ = encrypted$ + newcode$
END IF
NEXT
SELECT CASE outputmethod%
CASE 1
PRINT "Your freshly encoded text is now this:"
PRINT
PRINT encrypted$
PRINT
PRINT "Would you like this saved? (y/n)"
DO
h$ = INKEY$
LOOP UNTIL LCASE$(h$) = "y" OR LCASE$(h$) = "n"
SELECT CASE h$
CASE "y"
PRINT
PRINT "Enter the directory and filename you would like to save to:"
INPUT save$
OPEN save$ FOR RANDOM AS #(FREEFILE)
PUT #(FREEFILE - 1), 1, program$
PUT #(FREEFILE - 1), 2, version$
PUT #(FREEFILE - 1), 3, encrypted$
CLOSE #(FREEFILE - 1)
PRINT
PRINT "Saved on demand successfully"
END SELECT
CASE 2
OPEN outfile$ FOR RANDOM AS #(FREEFILE)
PUT #(FREEFILE - 1), 1, program$
PUT #(FREEFILE - 1), 2, version$
PUT #(FREEFILE - 1), 3, encrypted$
CLOSE #(FREEFILE - 1)
PRINT "Save command successful."
END SELECT
END SUB
This is the end of everything, you are the end of everything." -Slipknot - Everything Ends
"GOD HATES US ALL!!" -Slayer - God Hates Us All
"GOD HATES US ALL!!" -Slayer - God Hates Us All