06-08-2006, 01:27 PM
FINALLY!!!!!
I've done my Vigenere program!!!! It really works!!!
A Text encryptor/Decryptor for alphabetic characters
Here's the code....
CLS
CLEAR
LOCATE 1, 1
INPUT "ENTER WORD: "; WORD$
WORD$ = UCASE$(WORD$)
LOCATE 1, 15
PRINT WORD$
INPUT "ENTER KEY : "; KEY$
KEY$ = UCASE$(KEY$)
LOCATE 2, 15
PRINT KEY$
Y = 0
P = 0
K = 0
C = 0
FOR X = 1 TO LEN(WORD$)
Y = Y + 1
IF Y > LEN(KEY$) THEN Y = 1
P = ASC(MID$(WORD$, X, 1)) - 65
K = ASC(MID$(KEY$, Y, 1)) - 65
C = (P + K) MOD 26
CIPHER$ = CHR$(C + 65)
CIPHER$ = OCIPHER$ + CIPHER$
OCIPHER$ = CIPHER$
NEXT
PRINT "CIPHER :"
LOCATE 3, 15
PRINT CIPHER$
LOCATE 6, 1
INPUT "ENTER CIPHER: "; CCIPHER$
CCIPHER$ = UCASE$(CCIPHER$)
LOCATE 6, 17
PRINT CCIPHER$
INPUT "ENTER KEY : "; KKEY$
KKEY$ = UCASE$(KKEY$)
LOCATE 7, 17
PRINT KKEY$
YY = 0
PP = 0
CC = 0
KK = 0
FOR XX = 1 TO LEN(CCIPHER$)
YY = YY + 1
IF YY > LEN(KKEY$) THEN YY = 1
CC = ASC(MID$(CCIPHER$, XX, 1)) - 65
KK = ASC(MID$(KKEY$, YY, 1)) - 65
PP = (CC - KK + 26) MOD 26
PLAIN$ = CHR$(PP + 65)
PLAIN$ = OPLAIN$ + PLAIN$
OPLAIN$ = PLAIN$
NEXT
PRINT "PLAIN :"
LOCATE 8, 17
PRINT PLAIN$
this nice for "secret messages" even though this does not support numeric and special characters.....
I recommend to use a key whose length is same as the plaintext...
I'll recode this to make use of the full ASCII code....
I'll also try to make an alogrithm to be combined with this....
It's called the one time pad... a secure and uncrackable encryption...
got the idea from
http://en.wikipedia.org/wiki/One-time_pad
I've done my Vigenere program!!!! It really works!!!
A Text encryptor/Decryptor for alphabetic characters
Here's the code....
CLS
CLEAR
LOCATE 1, 1
INPUT "ENTER WORD: "; WORD$
WORD$ = UCASE$(WORD$)
LOCATE 1, 15
PRINT WORD$
INPUT "ENTER KEY : "; KEY$
KEY$ = UCASE$(KEY$)
LOCATE 2, 15
PRINT KEY$
Y = 0
P = 0
K = 0
C = 0
FOR X = 1 TO LEN(WORD$)
Y = Y + 1
IF Y > LEN(KEY$) THEN Y = 1
P = ASC(MID$(WORD$, X, 1)) - 65
K = ASC(MID$(KEY$, Y, 1)) - 65
C = (P + K) MOD 26
CIPHER$ = CHR$(C + 65)
CIPHER$ = OCIPHER$ + CIPHER$
OCIPHER$ = CIPHER$
NEXT
PRINT "CIPHER :"
LOCATE 3, 15
PRINT CIPHER$
LOCATE 6, 1
INPUT "ENTER CIPHER: "; CCIPHER$
CCIPHER$ = UCASE$(CCIPHER$)
LOCATE 6, 17
PRINT CCIPHER$
INPUT "ENTER KEY : "; KKEY$
KKEY$ = UCASE$(KKEY$)
LOCATE 7, 17
PRINT KKEY$
YY = 0
PP = 0
CC = 0
KK = 0
FOR XX = 1 TO LEN(CCIPHER$)
YY = YY + 1
IF YY > LEN(KKEY$) THEN YY = 1
CC = ASC(MID$(CCIPHER$, XX, 1)) - 65
KK = ASC(MID$(KKEY$, YY, 1)) - 65
PP = (CC - KK + 26) MOD 26
PLAIN$ = CHR$(PP + 65)
PLAIN$ = OPLAIN$ + PLAIN$
OPLAIN$ = PLAIN$
NEXT
PRINT "PLAIN :"
LOCATE 8, 17
PRINT PLAIN$
this nice for "secret messages" even though this does not support numeric and special characters.....
I recommend to use a key whose length is same as the plaintext...
I'll recode this to make use of the full ASCII code....
I'll also try to make an alogrithm to be combined with this....
It's called the one time pad... a secure and uncrackable encryption...
got the idea from
http://en.wikipedia.org/wiki/One-time_pad
aith without action is dead.
Life becomes easier if things are done well than being said.
Life becomes easier if things are done well than being said.