Qbasicnews.com
Let's have an encryption CHALLENGE! - Printable Version

+- Qbasicnews.com (http://qbasicnews.com/newforum)
+-- Forum: QbasicNews.Com (http://qbasicnews.com/newforum/forum-3.html)
+--- Forum: Challenges (http://qbasicnews.com/newforum/forum-10.html)
+--- Thread: Let's have an encryption CHALLENGE! (/thread-1160.html)

Pages: 1 2 3 4 5 6 7 8 9


Let's have an encryption CHALLENGE! - oracle - 06-21-2003

So what you mean is that you make up a different key each time, right? What's to stop the computer doing the same?


Let's have an encryption CHALLENGE! - BinarySHOCK - 06-24-2003

Here's something i come up with... when i wasn't sober....


DECLARE FUNCTION Rotate$ (Text$)
DECLARE FUNCTION Cipher$ (Text$, Key$)

CLS

NormalString$ = "I Can't Goto Sleep The Clowns Will Eat Me"
Key$ = "QbAsIcNeWs..."

CipherdText$ = Cipher$(NormalString$, Key$)
DeCipherd$ = Cipher$(CipherdText$, Key$)

PRINT "Orignal- "; NormalString$
PRINT "Cipherd- "; CipherdText$
PRINT "DeCipherd-> "; DeCipherd$

PRINT STRING$(80, "-")

PRINT "Orginal Len-"; LEN(NormalString$)
PRINT "Cipherd Len-"; LEN(CipherdText$)
PRINT "DeCipherd Len->"; LEN(DeCipherd$)

SYSTEM

DEFINT A-Z
FUNCTION Cipher$ (Text$, Key$)

DIM L AS LONG
DIM D AS LONG
DIM X AS LONG

X& = 1

OldKey$ = Key$

FOR I = 1 TO LEN(Text$)

Key.I = Key.I + 1
IF Key.I > LEN(Key$) THEN Key.I = 1

C = (ASC(MID$(Text$, I, 1)) XOR (ASC(MID$(Key$, Key.I, 1)) * I)) AND 255
Enc$ = Enc$ + CHR$©

L = L + 7
D = D + 4
X = ((X + (SQR((X XOR (D MOD X))) * (64 + (L * D) - I))) AND 4095) XOR I

IF X Mod (L + D) < I THEN Key$ = Rotate$(Key$)

NEXT

Key$ = OldKey$

Cipher$ = Enc$

END FUNCTION

FUNCTION Rotate$ (Text$)

N$ = SPACE$(LEN(Text$))

FOR I = 2 TO LEN(Text$)

MID$(N$, I - 1) = MID$(Text$, I, 1)

NEXT

MID$(N$, LEN(N$)) = MID$(Text$, 1, 1)

Rotate$ = N$

END FUNCTION


i'll announce the winners in.... - Agamemnus - 06-27-2003

one and a half weeks, since i'll be disappearing for a while..


Let's have an encryption CHALLENGE! - oracle - 06-27-2003

Excellent, there's been a lot of interest, hasn't there. But I thought this thread had died... so it's good.


Let's have an encryption CHALLENGE! - whitetiger0990 - 07-04-2003

Yes i know it's been 6 days since the last post and that this thread is most likely dead but i have a very bad encryption program. and i want to post it

Code:
CLS
INPUT text$
x$ = " ~!@#$%^&*()_+{}|:<>?`-=[]\;',./1234567890qetuoadgjlxvnwryipsfhkzcbmMBCZKHFSPIYRWNVXLJGDAOUTEQ"
x2$ = "QETUOADGJLXVNWRYIPSFHKZCBMmbczkhfspiyrwnvxljgdaouteq0987654321/.,';\][=-`?><:|}{+_)(*&^%$#@!~"
FOR i = 1 TO LEN(text$)
tmp = INSTR(x$, MID$(text$, i, 1))
IF tmp <> 0 THEN
  tmp2$ = MID$(x2$, tmp, 1)
  f$ = f$ + tmp2$
END IF
NEXT
PRINT f$

Yes very simple. but if you are dumb it may take you a minute or two to figure it out. j/k. :wink:


Let's have an encryption CHALLENGE! - oracle - 07-04-2003

Out of interest, is anyone collecting an archive of these programs, because I'll happily do it for QBNZ (I have a whopping 30+ files to add, which have been made available to me in the space of one week!)

If I don't hear anything by tomorrow I'll do it anyway, but of course you have the right to request that it disappears from QBNZ at any time.


well, - Agamemnus - 07-09-2003

without any effort, I can declare Mango the winner (surely a no-brainer?), and everyone else ties second place. Smile


Let's have an encryption CHALLENGE! - whitetiger0990 - 07-09-2003

YEah 2nd place!!!!!


Let's have an encryption CHALLENGE! - Blitz - 07-22-2003

Why complicate things, you can't break any decryption without the key no matter what. So an XOR cryption will do fine for most things. And it's small too.

Code:
defint a-z
function xorEncrypt$ ( src as string, ekey as string )
    dim i as integer
    dim dst as string
    dim keyLen as integer    
    
    keyLen = len( ekey )
    
    for  i = 1 to len ( src )
        dst = dst + chr$( asc(mid$( src, i, 1 )) xor _
                          asc(mid$( ekey, i mod keyLen + 1, 1 )) )
    next i
    
    xorEncrypt$ = dst    
    
end function


defint a-z
function xorDecrypt$ ( src as string, ekey as string )
    dim i as integer
    dim dst as string
    dim keyLen as integer    
    
    keyLen = len( ekey )
    
    for  i = 1 to len ( src )
        dst = dst + chr$( asc(mid$( src, i, 1 )) xor _
                          asc(mid$( ekey, i mod keyLen + 1, 1 )) )
    next i
    
    xorDecrypt$ = dst    
    
end function



Let's have an encryption CHALLENGE! - Agamemnus - 07-22-2003

Quote:Why complicate things, you can't break any decryption without the key no matter what. So an XOR cryption will do fine for most things. And it's small too.
Incorrect. I broke the first encryption technique using english language letter frequency.