Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Let's have an encryption CHALLENGE!
#18
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.

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
Reply


Messages In This Thread
Let's have an encryption CHALLENGE! - by relsoft - 06-11-2003, 08:16 AM
here it is - by Agamemnus - 06-11-2003, 08:34 AM
Let's have an encryption CHALLENGE! - by oracle - 06-11-2003, 12:46 PM
Let's have an encryption CHALLENGE! - by Neo - 06-11-2003, 03:02 PM
BASIC encryption - by Mango - 06-11-2003, 07:49 PM
Let's have an encryption CHALLENGE! - by oracle - 06-12-2003, 01:35 AM
key update - by Mango - 06-12-2003, 04:34 AM
Let's have an encryption CHALLENGE! - by oracle - 06-12-2003, 05:36 AM
My prog - by Meg - 06-12-2003, 04:50 PM
Let's have an encryption CHALLENGE! - by Mango - 06-12-2003, 06:39 PM
Let's have an encryption CHALLENGE! - by HystericPoison - 06-15-2003, 10:19 PM
Let's have an encryption CHALLENGE! - by oracle - 06-16-2003, 01:38 AM
Let's have an encryption CHALLENGE! - by oracle - 06-16-2003, 01:23 PM
Let's have an encryption CHALLENGE! - by Neo - 06-16-2003, 02:53 PM
unknown, - by Agamemnus - 06-17-2003, 04:03 AM
. - by Meg - 06-18-2003, 10:37 AM
hmmm - by Agamemnus - 06-20-2003, 01:42 AM
Let's have an encryption CHALLENGE! - by oracle - 06-20-2003, 02:41 AM
Let's have an encryption CHALLENGE! - by barok - 06-20-2003, 05:28 AM
Let's have an encryption CHALLENGE! - by oracle - 06-20-2003, 09:34 AM
Let's have an encryption CHALLENGE! - by barok - 06-20-2003, 07:26 PM
Let's have an encryption CHALLENGE! - by oracle - 06-21-2003, 05:04 AM
i'll announce the winners in.... - by Agamemnus - 06-27-2003, 01:44 AM
Let's have an encryption CHALLENGE! - by oracle - 06-27-2003, 11:04 AM
Let's have an encryption CHALLENGE! - by oracle - 07-04-2003, 07:58 AM
well, - by Agamemnus - 07-09-2003, 05:10 AM
Let's have an encryption CHALLENGE! - by Blitz - 07-22-2003, 07:54 AM
Let's have an encryption CHALLENGE! - by na_th_an - 07-22-2003, 01:12 PM
Let's have an encryption CHALLENGE! - by Mango - 07-22-2003, 06:09 PM
Let's have an encryption CHALLENGE! - by Mango - 07-22-2003, 10:16 PM
Let's have an encryption CHALLENGE! - by oracle - 07-23-2003, 01:56 AM
Let's have an encryption CHALLENGE! - by Blitz - 07-23-2003, 03:30 AM
Let's have an encryption CHALLENGE! - by Blitz - 07-23-2003, 03:39 AM
Let's have an encryption CHALLENGE! - by oracle - 07-23-2003, 08:20 AM
Let's have an encryption CHALLENGE! - by Blitz - 07-23-2003, 10:20 AM
um. - by Meg - 07-23-2003, 11:20 AM
aga - by Meg - 07-24-2003, 02:39 AM
Let's have an encryption CHALLENGE! - by Blitz - 07-24-2003, 03:25 AM
yeah it prolly does - by Meg - 07-24-2003, 04:51 AM
well - by Meg - 07-24-2003, 06:32 AM
Let's have an encryption CHALLENGE! - by Phydaux - 07-24-2003, 06:23 PM
Let's have an encryption CHALLENGE! - by Blitz - 07-24-2003, 08:43 PM
Let's have an encryption CHALLENGE! - by Phydaux - 07-24-2003, 09:54 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)