Results 1 to 6 of 6
  1. #1
    sythe179's Avatar
    Join Date
    Jun 2010
    Gender
    male
    Location
    The internet
    Posts
    660
    Reputation
    15
    Thanks
    1,458
    My Mood
    Paranoid

    Encrypting/decrypting strings

    OK, I'm not going into detail about it, but I'll give you the code, and how to use a simple encryption/decryption method.

    then upgrade it to a MD5 hash method.

    first of all, put these above your namespace.
    (if you don't know where that is, sorry, stop reading, and do something else)

    [highlight=vb.net]
    Imports System.Text
    Imports System.IO
    Imports System.Security.Cryptography
    Imports System.Collections.Specialized
    [/highlight]


    first method, reverse encrypt/decrypt.

    [highlight=vb.net]
    Public Function SimpleCrypt(ByVal Text As String) As String
    ' Encrypts/decrypts the passed string using
    ' a simple ASCII value-swapping algorithm
    Dim strTempChar As String, i As Integer
    strTempChar = ""
    For i = 1 To Len(Text)
    If Asc(Mid$(Text, i, 1)) < 128 Then
    strTempChar = CType(Asc(Mid$(Text, i, 1)) + 128, String)
    ElseIf Asc(Mid$(Text, i, 1)) > 128 Then
    strTempChar = CType(Asc(Mid$(Text, i, 1)) - 128, String)
    End If
    Mid$(Text, i, 1) = Chr(CType(strTempChar, Integer))
    Next i
    Return Text
    End Function
    [/highlight]



    simply, use it like:
    [highlight=vb.net]
    dim str as string = simplecrypt("string here")
    [/highlight]

    and to decrypt that message, use:
    [highlight=vb.net]
    msgbox(simplecrypt(str))
    [/highlight]



    now, if you want to use a heavy encryption, there are a few you can use,
    but i tend to stick with a MD5 encryption.
    people use what they want to, and this is just my personal one...well, modified of coarse for security reasons for my apps...

    [highlight=vb.net]
    Public Class DEScrypt
    Private Shared DES As New TripleDESCryptoServiceProvider
    Private Shared MD5 As New MD5CryptoServiceProvider

    Public Shared Function MD5hash(ByVal value As String) As Byte()
    Return MD5.ComputeHash(ASCIIEncoding.ASCII.GetBytes(value ))
    End Function
    Public Shared Function encrypt(ByVal strEncrypt As String, ByVal key As String) As String
    DES.Key = DEScrypt.MD5hash(key)
    DES.Mode = CipherMode.ECB
    Dim Buffer As Byte() = ASCIIEncoding.ASCII.GetBytes(strEncrypt)
    Return Convert.ToBase64String(DES.CreateEncryptor().Trans formFinalBlock(Buffer, 0, Buffer.Length))
    End Function
    Public Shared Function decrypt(ByVal strdecrypt As String, ByVal key As String) As String
    Try
    DES.Key = DEScrypt.MD5hash(key)
    DES.Mode = CipherMode.ECB
    Dim Buffer As Byte() = Convert.FromBase64String(strdecrypt)
    Return ASCIIEncoding.ASCII.GetString(DES.CreateDecryptor( ).TransformFinalBlock(Buffer, 0, Buffer.Length))
    Catch ex As Exception
    MsgBox("error, wrong key")
    Return ""
    End Try
    End Function
    End Class
    [/highlight]


    now, to use this one, its much the same, except there is a decrypt function and an encrypt function.

    where it says key, that is the encryption/decryption key. it must be the same as the one you used to encrypt if your going to decrypt the encrypted string. or, it will error.

    encrypt :
    [highlight=vb.net]
    dim encoded as string = encrypt("string here", "key")

    [/highlight]

    and decrypt:
    [highlight=vb.net]
    dim unencoded as string = decrypt(encoded, "key")
    [/highlight]


    that's about it, so...until I'm bored again, see ya's ^.^

  2. The Following User Says Thank You to sythe179 For This Useful Post:

    MOZMALINHA (08-08-2011)

  3. #2
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    LOL

    Quote Originally Posted by *****179
    first of all, put these in your namespace area.
    (if you don't know where that is, sorry, stop reading, and do something else)
    I stopped reading because even that line was wrong. You do NOT put import statements within a namespace.

    Why are you using VB6 functions for this..?

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  4. #3
    sythe179's Avatar
    Join Date
    Jun 2010
    Gender
    male
    Location
    The internet
    Posts
    660
    Reputation
    15
    Thanks
    1,458
    My Mood
    Paranoid
    ok...better?...

  5. #4
    Code[VB]'s Avatar
    Join Date
    Mar 2011
    Gender
    male
    Location
    CODER
    Posts
    608
    Reputation
    11
    Thanks
    702
    My Mood
    Bitchy
    What xD namespace area? lol, i learned VB and i never, never heard about namespace are, namespacearea is in C++ but not in VB ,.. its the Import Area but the rest is okay

  6. #5
    Hassan's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    System.Threading.Tasks
    Posts
    4,764
    Reputation
    495
    Thanks
    2,133
    My Mood
    Dead
    Quote Originally Posted by Code[VB] View Post
    What xD namespace area? lol, i learned VB and i never, never heard about namespace are, namespacearea is in C++ but not in VB ,.. its the Import Area but the rest is okay
    VB does contains namespaces.

  7. #6
    MOZMALINHA's Avatar
    Join Date
    May 2011
    Gender
    male
    Location
    luxembourg
    Posts
    51
    Reputation
    8
    Thanks
    10
    My Mood
    Aggressive
    thank u man ...i apprecitate this ...and also the other pplz wich corrected ..THANK YOU
    _______________

    yeah man but .....

    IF U LOVE ,U WILL NOT BE LOVED BACK
    IF U STEAL ,at least u got somethin to eat
    IF U KILL THEN U WILL PROBABLY GET KILLED


    I LOVE MEDINA !


Similar Threads

  1. [release] my aer-246 aes encryption | decryption program
    By cosconub in forum C# Programming
    Replies: 9
    Last Post: 02-02-2011, 06:01 PM
  2. Encrypt/Decrypt vb.Net?
    By o0OpurezO0o in forum Visual Basic Programming
    Replies: 24
    Last Post: 11-22-2010, 09:36 PM
  3. Encrypt/Decrypt Functions
    By CodeDemon in forum Combat Arms Hack Coding / Programming / Source Code
    Replies: 7
    Last Post: 09-09-2010, 04:59 AM
  4. Mods Encrypt/Decrypt???
    By SPA777174 in forum Call of Duty Modern Warfare 2 Help
    Replies: 0
    Last Post: 07-22-2010, 11:33 PM
  5. [TUT]Basic Encrypter\Decrypter
    By Bombsaway707 in forum Visual Basic Programming
    Replies: 30
    Last Post: 12-01-2009, 09:05 PM