NOGDUS

Other => Independent Projects => Topic started by: DeJa Vu on February 02, 2008, 04:49:12 PM



Title: CryptoEdit (ACT w/ a GUI) C#
Post by: DeJa Vu on February 02, 2008, 04:49:12 PM
Well, I decided to port my old ACT program into C# and add a nice little GUI to it!

QuickBasic version (uses a command-line interface DOS is required):
Download .zip (http://shadowland.cc/downloads.php?mode=downloads&file=act.zip)
Code:
DECLARE SUB encode ()
DECLARE SUB decode ()
SCREEN 12
CLS
LOCATE 3, 3
INPUT "(e)ncode/(d)ecode"; switch$
IF UCASE$(switch$) = "E" THEN encode ELSE decode

SUB decode
INPUT "Please enter your Password:"; passWord$
CLS
INPUT "Please enter you File's name:"; Filname$
CLS
OPEN Filname$ FOR INPUT AS #1
DO WHILE NOT EOF(1)
INPUT #1, char$
message$ = message$ + char$
LOOP
CLOSE #1
salt% = ASC(RIGHT$(message$, 1))
msgLen% = LEN(message$)
FOR lp = 1 TO msgLen%
 passWordA$ = RIGHT$(LEFT$(passWord$, lp), 1)
 passWordA% = ASC(passWordA$)
 messageA$ = RIGHT$(LEFT$(message$, lp), 1)
 messageA% = ASC(messageA$) - salt% - passWordA%
 IF messageA% > 0 AND messageA% < 255 THEN
   messageC$ = messageC$ + CHR$(messageA%)
 END IF
 IF messageA% > 255 THEN
   messageA% = messageA% - 255
   messageC$ = messageC$ + CHR$(messageA%)
 END IF
 IF messageA% < 0 THEN
   messageA% = messageA% + 255
   messageC$ = messageC$ + CHR$(messageA%)
 END IF
NEXT
        removeLen% = LEN(messageC$)
        messageC$ = LEFT$(messageC$, removeLen% - 1)
        PRINT "Before:"; message$
        PRINT "After:"; messageC$
        PRINT
        PRINT "Password used:"; passWord$
        OPEN Filname$ FOR OUTPUT AS #1
          PRINT #1, messageC$
        CLOSE #1
END SUB

SUB encode
  INPUT "Please enter either a (f)ile or your (m)essage:"; fm$
 fm$ = UCASE$(fm$)
 SELECT CASE fm$
  CASE "M"
          INPUT "Please enter your password:"; passWord$
        CLS
        PRINT "Push enter when finished"
          INPUT "Type in your message here:"; message$
        CLS
        msgLen% = LEN(message$)
        salt% = INT(RND * 255)
        FOR lp = 1 TO msgLen%
          passWordA$ = RIGHT$(LEFT$(passWord$, lp), 1)
          passWordA% = ASC(passWordA$)
          messageA$ = RIGHT$(LEFT$(message$, lp), 1)
          messageA% = ASC(messageA$) + salt% + passWordA%
          IF messageA% > 0 AND messageA% < 255 THEN
            messageC$ = messageC$ + CHR$(messageA%)
          END IF
          IF messageA% > 255 THEN
            messageA% = messageA% - 255
            messageC$ = messageC$ + CHR$(messageA%)
          END IF
          IF messageA% < 0 THEN
            messageA% = messageA% + 255
            messageC$ = messageC$ + CHR$(messageA%)
          END IF
        NEXT
        messageC$ = messageC$ + CHR$(salt%)
        PRINT "Before:"; message$
        PRINT "After:"; messageC$
        PRINT
        PRINT "Password used:"; passWord$
          INPUT "Please pick a file name:"; fileName$
        CLS
        OPEN fileName$ FOR OUTPUT AS #1
          PRINT #1, messageC$
        CLOSE #1
  CASE "F"
          INPUT "Please enter your password:"; passWord$
        CLS
        PRINT "Push enter when finished"
          INPUT "Please enter your file name"; Filname$
        CLS
        OPEN Filname$ FOR INPUT AS #1
         DO WHILE NOT EOF(1)
           INPUT #1, char$
           message$ = message$ + char$
         LOOP
        CLOSE #1
        CLS
        msgLen% = LEN(message$)
        salt% = INT(RND * 255)
        FOR lp = 1 TO msgLen%
          passWordA$ = RIGHT$(LEFT$(passWord$, lp), 1)
          passWordA% = ASC(passWordA$)
          messageA$ = RIGHT$(LEFT$(message$, lp), 1)
          messageA% = ASC(messageA$) + salt% + passWordA%
          IF messageA% > 0 AND messageA% < 255 THEN
            messageC$ = messageC$ + CHR$(messageA%)
          END IF
          IF messageA% > 255 THEN
            messageA% = messageA% - 255
            messageC$ = messageC$ + CHR$(messageA%)
          END IF
          IF messageA% < 0 THEN
            messageA% = messageA% + 255
            messageC$ = messageC$ + CHR$(messageA%)
          END IF
        NEXT
        messageC$ = messageC$ + CHR$(salt%)
        PRINT "Before:"; message$
        PRINT "After:"; messageC$
        PRINT
        PRINT "Password used:"; passWord$
        OPEN Filname$ FOR OUTPUT AS #1
          PRINT #1, messageC$
        CLOSE #1
 END SELECT
END SUB

C# version (uses a graphical interface, Windows required)
Download .zip (http://shadowland.cc/downloads.php?mode=downloads&file=CryptoEdit.zip)

Check it out and lemme now what y'all think?!

* GUI version might be able to be executed on linux using mono (http://www.mono-project.com/Main_Page).