Jump to content

encryption


Recommended Posts

Ok I wasn't sure where to post this (gosh i should know where to post stuff here by now) but i know nothing a bout how to make an encryption that wouldnt take 10 mins for any nub to decrypt

 

so here is what i know so far

i am doing this in Vbasic 2008 so i can learn basic and learn encrypting... ok i dont want to use any premade encryption like md5

how i want my encryption to work... i dont know exsept i do want to be able to change the method easily plus i want it to  see double letters and change them like LL not to equal same as L and other common ways of decryption .... ok that's about as far as i have gotten please point me in the right way lol oh and i am a Full vbasic noob and i am doing this for a challenge lol and if any one wants to work on this with me tell me i would be vary happy to let you help :P

Link to comment
Share on other sites

md5 is usually thought of as a hashing algorithm, not an encryption algorithm.  Encryption algorithms can be decrypted; hashing algorithms cannot [theoretically].

 

Which one are you trying to make, because they're very different beasts when it comes down to it.

 

 

By the way, how comfortable are you with binary?  Depending on how you plan on implementing an encryption algorithm, you will need to be fairly comfortable with binary and binary operations.

 

 

Chances are, you will want to be able to encrypt against a key, yes?

 

 

It would probably be easier to implement an existing algorithm.  Perhaps RSA?  That one is complex if you optimize it.

Link to comment
Share on other sites

Shows what I know about Encryption lol. binary and hex i am ok with not that i can tell you every little thing in 10 secs... i still have to use a calculator and for ascii i have to use a chart but i have a printed one so thats no big deal. but yes i want to do it with a key but i dont want the key to be "hardwired" into the code it want it to be blank or part of the way blank so the other half must be called in or emailed in that way the method isnt 100% the same all the time.

Link to comment
Share on other sites

well i found a very simple method witch will be just enough to get me started but heres a what a found...

Public Class StringEncryption
Public Shared Function SimpleEncrypt(ByVal toEncrypt As String) As String
Dim tempChar As String = Nothing
Dim i As Integer = 0
For i = 1 To toEncrypt.Length
If System.Convert.ToInt32(toEncrypt.Chars(i - 1)) < 128 Then
tempChar = System.Convert.ToString(System.Convert.ToInt32(toEncrypt.Chars(i - 1)) + 100)
ElseIf System.Convert.ToInt32(toEncrypt.Chars(i - 1)) > 128 Then
tempChar = System.Convert.ToString(System.Convert.ToInt32(toEncrypt.Chars(i - 1)) - 100)
End If
toEncrypt = toEncrypt.Remove(i - 1, 1).Insert(i - 1, (CChar(ChrW(tempChar))).ToString())
Next i
Return toEncrypt
End Function
End Class 

Link to comment
Share on other sites

Really understanding binary isn't that necessary.  Just binary operators.  In the big scheme of things, base systems (binary/decimal/hex) are just different ways of representing the same thing.

 

12 (base 10) = 0xC = 1100 (base 2)

 

In most programming language (pretty much all I can think of), all are interchangeable.  Actually, binary is rarely used, since for all human readable purposes, it's useless.

 

 

 

called/emailed in?  You plan on using your algorithm in a production environment?  I personally wouldn't do that.  Encryption algorithms can be sneaky little buggers and do weird things.  I wouldn't use my own algorithm in a production environ x.x.

 

 

 

Anyway, first you need to decide on paper or atleast in your head what you want to do.

 

 

Well, bit shifting operators are out of the question, since you wouldn't be able to reverse stuff with one of them, and you wouldn't be able to reasonably hold data with the other.  So, that leaves & | and ^.

 

The easiest thing I can think of is:

 

x xor y

 

010101 xor 111111 = 101010

 

101010 xor 111111 = 010101

 

For example.

 

 

Of course, things can get complicated super quickly, and you would probably have to use some kind of padding for that since things could get funky if the data were longer than the key.  (Well, it would work, but parts wouldn't be 'encrypted'.)

 

 

 

 

(I should probably tell you by the way, that I have fairly little experience making algos, I've just implemented them.  This is a learning experience for me too ;p.  lol.)

 

 

 

 

Edit:  You posted while I was writing this.

 

 

Yeah, so that method just either adds or subtracts 100 from the char....  Hrmm....  Wouldn't reversing be difficult?

 

 

f(x) = {

    x + 100, x < 128

    x - 100, x > 128

}

 

So the range of the first one would be 100 to 227.  The range of the second one would be 9 through 155.

 

 

So, the whole range over lapping thing....

 

 

From a mathematical point of view, the function done to each block of data needs to be 1 to 1.  (Or you would need to have some kind of means of determining the x from the y some other way.)

Link to comment
Share on other sites

Oh yeah....  The first part of the ASCII table (the part commonly used) is all <= 127.  I was thinking data in general, not convenient human-used data.

 

 

Actually, I guess either way it would work, since it would just get the opposite done to it....  Pretty clever, I must say.

Link to comment
Share on other sites

Hrmmm, first thing that comes to mind is to just use the offset...

 

Public Class StringEncryption
Public Shared Function SimpleEncrypt(ByVal toEncrypt As String) As String
Dim tempChar As String = Nothing
Dim i As Integer = 0
For i = 1 To toEncrypt.Length
If System.Convert.ToInt32(toEncrypt.Chars(i - 1)) < 128 Then
tempChar = System.Convert.ToString(System.Convert.ToInt32(toEncrypt.Chars(i - 1)) + 100-i)
ElseIf System.Convert.ToInt32(toEncrypt.Chars(i - 1)) > 128 Then
tempChar = System.Convert.ToString(System.Convert.ToInt32(toEncrypt.Chars(i - 1)) - 100-i)
End If
toEncrypt = toEncrypt.Remove(i - 1, 1).Insert(i - 1, (CChar(ChrW(tempChar))).ToString())
Next i
Return toEncrypt
End Function
End Class 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.