Introduction
A quick and easy solution to encrypt passwords. Just like MD5, SHA1 etc., it creates a long, confusing, and half-pointless string of numbers that cannot be decrypted.
Unlike some hashes, there is no possible (yet) way to recreate the same hash without the same string (unless you are using basic encryption).
Using the code
There are only two classes in this, as you will find out. There are three different ways to encrypt a string: Basic, Effective, and Advanced (which should probably be ultra-unhackable).
Public Class K3YK4Y
Public Class encode
Public Shared Function basic(ByVal str As String)
Dim k3yk4y As Int32 = Nothing
For Each number As Byte In Text.ASCIIEncoding.ASCII.GetBytes(str)
k3yk4y += number
Next
Return k3yk4y
End Function
Public Shared Function effective(ByVal str As String)
Dim k3yk4y As Int32 = Nothing
Dim order As String = Nothing
For Each number As Byte In Text.ASCIIEncoding.ASCII.GetBytes(str)
order &= Convert.ToInt64(number) / 4
k3yk4y += number
Next
Return Convert.ToInt64(k3yk4y) & order
End Function
Public Shared Function advanced(ByVal str As String)
Dim k3yk4y As String = Nothing
Dim order As String = Nothing
For Each number As Byte In Text.ASCIIEncoding.ASCII.GetBytes(str)
order &= Convert.ToInt64(number) / 4
k3yk4y &= Hex(number / 2)
Next
Dim orderLength As Int32 = order.Length / 2
Dim halfOrder As String = order.Substring(orderLength, 4)
Dim endEncode As Decimal = Convert.ToDecimal(halfOrder) * 2
Return k3yk4y & order & endEncode
End Function
End Class
End Class
Each encryption level returns a different string with things added or taken off for more security. I guess you could use this process with files, but imagine how big it would be :S. Pretty pointless too, considering you can't decrypt it.
Points of interest
What I really like about what I've done here is all the little pointless things. They make it look big and confusing when all you really need to use is the basic encryption, and voila! Although, basic encryption does tend to return the same result if the strings use the same letters.
History
- 2008-08-18: Version 1 released.