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! - HystericPoison - 06-16-2003

hmm, didnt think of that, thanks Smile


Let's have an encryption CHALLENGE! - Agamemnus - 06-16-2003

I'd never think of doing it like that.... i'd use len to check the length and then see how many zeroes I need.


Let's have an encryption CHALLENGE! - [Unknown] - 06-16-2003

For clarification...

This has to be reversable? Or could I write an hmac md5 algorithm and be done with it?

Easiest way would be to take the password and the key and simply rotate the letters up by the key. This is often used in cryptography for good reversable encryption, and has been used to transmit confidential messages.

Basically...

Code:
M Y N A M E I S W H A T <-- message
C A T C A T C A T C A T
-----------------------
O Y G C M X K S P J A M

Or...

Code:
key$ = "cat"
text$ = "mynameiswhat"

IF LEN(key$) < LEN(text$) THEN
   longkey$ = ""

   FOR i% = 0 TO LEN(text$) \ LEN(key$)
      longkey$ = longkey$ + key$
   NEXT i%
ELSE
   longkey$ = key$
END IF

result$ = ""
FOR i% = 1 TO LEN(text$)
   x% = ASC(UCASE$(MID$(text$, i%, 1))) + ASC(UCASE$(MID$(longkey$, i%, 1))) - 65

   IF x% > ASC("Z") THEN x% = x% - 26

   result$ = result$ + CHR$(x%)
NEXT i%

PRINT result$

Result:
OYGCMXKSPJAM

It can easily be decrypted by subtracting with the key.

-[Unknown]


Let's have an encryption CHALLENGE! - Agamemnus - 06-16-2003

I know, I wrote such a decrypter before. Finds the key length then decrypts.

Ideally it shouldn't be breakable by a simple method, or any method at all, without the key.


Let's have an encryption CHALLENGE! - [Unknown] - 06-16-2003

Quote:I know, I wrote such a decrypter before. Finds the key length then decrypts.

Ideally it shouldn't be breakable by a simple method, or any method at all, without the key.

It can't be...... it's reversible only with the key - otherwise you have to plug and chug with a supercomputer and never know if you are right.

It can be decrypted with shorter keys and longer messages, but...

-[Unknown]


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

I already did a key one... see above. agamemnus hasn't posted a decoding program for it yet.


Let's have an encryption CHALLENGE! - Agamemnus - 06-16-2003

DISCLAIMER:

no... i am still waiting for someone to tell me how to combine ugl and the other library...

I may have lost interest in this thread.


Reply to Agamemnus re inserting leading zeros - Moneo - 06-16-2003

Quote:I'd never think of doing it like that.... i'd use len to check the length and then see how many zeroes I need.

That's what my code example is doing. The idea is to do it all on one line of code.

Yes, to be more elegant, you could do a CASE on the length. But that would be several lines of code. My theory is that the more lines of code to do something, the more chance of bugs. Within reason of course, I don't mean to have one line of code with more than 2 or 3 operations that spans more than 100 characters just to get it all on one line.

Why don't you show us your example for doing it.
*****


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

Oi, my method uses a very long key... what's wrong with it? Assume I don't add those zeroes on each character.


Let's have an encryption CHALLENGE! - Neo - 06-16-2003

Well then, anyone broke mine yet?

Code:
FUNCTION KT.ENC.DifCipher$(ToCipher AS STRING, Frequency AS INTEGER)
   'a completely new ciphering method -> Dif Ciphering
   'by Neo Deus Ex Machina

   'I thought of this ciphering, it's completely new ;) lol
   'It uses the difference with a sequent character from the base character
   freqnow = Frequency
   basechar$ = ""
   ans$ = ""
   FOR i = 1 TO LEN(ToCipher)
                IF freqnow = Frequency THEN
                   freqnow = 1
                   basechar$ = MID$(ToCipher, i, 1)
                   ans$ = ans$ + basechar$
                ELSE
                   freqnow = freqnow + 1
                   NewChar$ = MID$(ToCipher, i, 1)
                        dif% = ASC(NewChar$) - ASC(basechar$)
                        IF dif% >= 0 THEN
                           ans$ = ans$ + CHR$(dif%)
                        ELSE
                                ans$ = ans$ + CHR$(256 + dif%)
                        END IF
                END IF
   NEXT i
   KT.ENC.DifCipher$ = ans$
END FUNCTION

8)