Click here to Skip to main content
Licence CPOL
First Posted 18 Aug 2008
Views 12,675
Downloads 46
Bookmarked 7 times

K3YK4Y String Hasher

By | 18 Aug 2008 | Article
Advanced/Not-So Advanced string and password hash.

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)
            'Possibly hackable, although not very likely. Would require a LOT of maths.
            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)
            '9999/10000 chance of ever being hacked
            '9998/10000 if they know the formula
            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)
            'Lmao ;).
            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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

trecool999



United Kingdom United Kingdom

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
QuestionEncrypt it's okay..... but decrypt?? Pinmembercoccode1449:34 13 Mar '09  
GeneralCollision PinmemberThe JZ14:27 18 Aug '08  
GeneralRe: Collision Pinmembertrecool99916:46 18 Aug '08  
GeneralRe: Collision PinmemberThe JZ7:50 19 Aug '08  
GeneralRe: Collision Pinmembertrecool9997:51 19 Aug '08  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web04 | 2.5.120517.1 | Last Updated 18 Aug 2008
Article Copyright 2008 by trecool999
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid