Qbasicnews.com

Full Version: Help!!!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
hello,

I'm quite new here and i saw that there are quite some good alogarithms for encryption/decryption...
the case is, i've made my own alogarithm in which you can enter all possible ascii characters as the cleartext,and also as the keyword...
the output cipher text is in upper case alphabetic characters, which mean, it even harder to decrypt.... try some examples:


output screen:

ENTER WORD: ? the quick brown fox jumps over the lazy dog
ENTER KEY : ? letters

KEY CODE :
letterslettersletterslettersletterslettersl


PLAIN TEXT :
the quick brown fox jumps over the lazy dog


CIPHER TEXT :
CJVESJYLMESTDMWPWFZCZDOGJPDLNTEKJTDUCQPPSEP



and another one


output screen:

ENTER WORD: ? THQUICKBROWNFOXJUMPSOVERTHELAZYDOG!@#$%^&*()
ENTER KEY : ? ALPHA!@#$%^&*()

KEY CODE :
ALPHA!@#$%^&*()ALPHA!@#$%^&*()ALPHA!@#$%^&*(


PLAIN TEXT :
THQUICKBROWNFOXJUMPSOVERTHELAZYDOG!@#$%^&*()


CIPHER TEXT :
FERNUIVJAYLYUBLVRNIEUGMADWPANNKAPZGFHFHNOOQP




as you could notice, the output, whatever the input is always in the alphabet charaters only, even if your input and/or keyword is/ containing special characters

if you dont mind(i'm addressing this to the reade)
it's quite easy to understand the source code for the program


CLS

LOCATE 1, 1

INPUT "ENTER WORD: "; WORD$
INPUT "ENTER KEY : "; KEY$

KCOUNT = 0
ALPHABET$ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

FOR X = 1 TO LEN(WORD$)

KCOUNT = KCOUNT + 1
IF KCOUNT > LEN(KEY$) THEN KCOUNT = 1

KKEY% = ASC(MID$(KEY$, KCOUNT, 1)) - 64
CHAR% = ASC(MID$(WORD$, X, 1)) - 64

ASCNUM = CHAR% + KKEY% + 63

COUT = 0
CASCNUM = 0


DO WHILE CASCNUM < ASCNUM

CASCNUM = CASCNUM + 1
COUT = COUT + 1
IF COUT > 26 THEN COUT = 1
GOODCHAR$ = MID$(ALPHABET$, COUT, 1)

FOR DELAY = 1 TO 1000: NEXT DELAY

LOOP


KKEY$ = CHR$(KKEY% + 64)
KKEY$ = KKEY$ + OLKKEY$

CHAR$ = CHR$(CHAR% + 64)
CHAR$ = CHAR$ + OCHAR$

GOODCHAR$ = GOODCHAR$ + OLCHAR$

OLCHAR$ = GOODCHAR$
OLKKEY$ = KKEY$
OCHAR$ = CHAR$


LOCATE 5, 1: PRINT SPACE$(LEN(WORD$))
LOCATE 9, 1: PRINT SPACE$(LEN(WORD$))
LOCATE 13, 1: PRINT SPACE$(LEN(WORD$))


LOCATE 4, 1
PRINT "KEY CODE :"
'LOCATE 5, REV
PRINT KKEY$
LOCATE 8, 1
PRINT "PLAIN TEXT :"
'LOCATE 9, REV
PRINT CHAR$
LOCATE 12, 1
PRINT "CIPHER TEXT :"
'LOCATE 13, REV
PRINT GOODCHAR$




NEXT X

SLEEP


KEYCODE$ = KKEY$
PLAINTEXT$ = CHAR$
CIPHERTEXT$ = GOODCHAR$

TXTL = LEN(WORD$)

REV = 0
TREV = TXTL + 1



DO WHILE REV < TXTL

FOR DELAY = 1 TO 109999: NEXT DELAY


REV = REV + 1
TREV = TREV - 1


KC% = ASC(MID$(KEYCODE$, TREV, 1))
PC% = ASC(MID$(PLAINTEXT$, TREV, 1))
CIPC% = ASC(MID$(CIPHERTEXT$, TREV, 1))


KCHAR$ = CHR$(KC%)
PCHAR$ = CHR$(PC%)
CIPCHAR$ = CHR$(CIPC%)

LOCATE 4, 1
PRINT "KEY CODE :"
LOCATE 5, REV
PRINT KCHAR$
LOCATE 8, 1
PRINT "PLAIN TEXT :"
LOCATE 9, REV
PRINT PCHAR$
LOCATE 12, 1
PRINT "CIPHER TEXT :"
LOCATE 13, REV
PRINT CIPCHAR$

LOOP

SLEEP



if someone knows how, tell me.... i have still plenty of adjustments to be done to this thing.... thanks....
Quote:hello,

I'm quite new here and i saw that there are quite some good alogarithms for encryption/decryption...
the case is, i've made my own alogarithm in which you can enter all possible ascii characters as the cleartext,and also as the keyword...
......
if someone knows how, tell me....
Ok, so you made your own algorithm. Now, what do you mean by "if someone knows how, tell me...." ??? What kind of help are you asking for?
*****
Moneo: Yes, what is his question.

Polter: Good. Some things I think would be in order:
1. Establish a limit to the length of the string one may enter. Maybe 65 characters or so?
2. Establish a minimum and a maximum for the keyword.
3. Do you have a decoder for your program?
4. see Moneo's post.
Yeah.. I forgot....

What I mean is I need to have a decoder to this type of encryption.

Sounds stupid but i can't figure it out how to make a decryptor....

If i'll fail, I'll just use another alogarithms....
It can't be decoded 'cause it fails on something completely necessary: encoding using a biyective function. Right now you are encoding several source characters with the very same destination character, for example you are encoding ".", "R" and j with a "P" (not actual, just an example). When deciphering, you find a "P" and... what to choose, ".", "R" or "j"?

It's like if I coded this encryption program:

Code:
For i% = 1 To Len (text$)
   If Asc(Mid$(text$, i%, 1)) < 100 Then
      Mid$(text$, i%, 1) = "A"
   Else
      Mid$(text$, i%, 1) = "B"
   End If
Next

Which would turn any sentence into something like "AAABBBABBABABBABABBABAAABABABBBBABABAAABBA". Now... how to decrypt? Impossible: you are losing information with the encryption.
Thanks for reminding me about that... I forgot to look at the results... I'll just recode it so that it can have a decryptor....
You could always try implementing the XOR function somewhere...
Quote:Thanks for reminding me about that... I forgot to look at the results... I'll just recode it so that it can have a decryptor....
Here's a very good, simple XOR encryption and decryption algorithm originally written by Ethan Winer. Try it out.
Code:
rem X$ is the string to be encrypted or decrypted.
rem Password$ is the password.

dim L as integer
dim X as integer
dim Pass as integer

L=len(Password$)
for X = 1 to len(X$)
     Pass = asc(mid$(Password$, (X mod L) - L  * ((X mod L) = 0), 1))
     mid$(X$,X,1) = chr$(asc(mid$(X$,X,1)) xor Pass)
next X
*****
Moneo:

I tried the code in QuickBASIC 4.5. I had to change the X$ to S$, as the use of X and X$ kept giving me an error.

Then, encryping the simple word "THIS" returns a heart)/2. Now, since the heart is not your "usual" keyboard entry character, it becomes very dificult to de-crypt the encrypted code! I think that an encrypter/decrypter should return only keyboard characters, to make it truly useful. What do you think?
I like the XOR alogarithm but i what i have in mind right now is to make an alogarithm which employs the use of vigenere table and other old stuff, combined which can make a stronger alogarithm...
Pages: 1 2 3 4