Click here to Skip to main content
15,886,137 members
Articles / Programming Languages / Visual Basic
Article

VB.NET String Obfuscation Utility

Rate me:
Please Sign up or sign in to vote.
3.57/5 (15 votes)
23 Dec 2004CPOL1 min read 87.2K   2.4K   24   13
A fast and dirty way of obfuscating strings in VB.NET applications.

Sample Image

Introduction

I was quite impressed with the 'free' Dotfuscator Community Edition provided with MS Visual Studio 2003, but wanted to have the strings in my software encrypted.

The String Obfuscate utility provided here, is an extremely simple tool for allowing you to make a string obfuscated, and if you forget what it was, de-obfuscate it. It uses a small StringObfuscate class that is intended to be copied and used in a VB.NET application to un-obfuscate text.

The way I use it is to keep the strings used in the app in obfuscated constants, then un-obfuscate the constant at runtime as needed. Crude though it is, it does allow the cheap concealment of strings in an app, which as we all know, is the first thing people look at when decompiling code.

Using the code

Copy the file: StringObfuscate.vb from the source code in the demo project, put it into your application development area, then load the file by choosing 'New/Add An Existing item' by right clicking on the project properties.

The class is loaded in an application globally or locally using a statement such as:

VB
Private SObs As New StringObfuscate

In your application, you may have the strings stored like:

VB
myStringVariable = "This is a string"

Using the utility, enter the text of the string "This is a string" and obfuscate it, to give the string "git ishnrsas iT" as the result. Replace the text in the application with the obfuscated text and put a wrapper round the text to call the UnObfuscateString function from the class.

VB
myStringVariable = SObs.UnObfuscateString("git ishnrsas iT")

Simple, now nobody can easily read the text in your application if they decompile it.

License

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


Written By
Web Developer
United Kingdom United Kingdom
I started programing at Lancaster University in 1972 with Algol 68, coding ever since, too many languages to list, most of which are now so old nobody uses them any more Smile | :)

Mainly using MS .Net products now.

Wrote some of the software used to put out the oil-well fires in the first Gulf War. Wrote some of the Pentagon security software that was blown up on 11th September.

In the last year I have started up my own software company.

Comments and Discussions

 
GeneralMy vote of 4 Pin
Manuel Arce8-Jul-14 5:49
Manuel Arce8-Jul-14 5:49 
GeneralMy vote of 1 Pin
Joezer BH27-May-13 4:17
professionalJoezer BH27-May-13 4:17 
GeneralMy vote of 2 Pin
Dave Kreskowiak16-Mar-10 2:14
mveDave Kreskowiak16-Mar-10 2:14 
GeneralGood piece of work Pin
tiote23-Dec-08 11:17
tiote23-Dec-08 11:17 
GeneralVery good Pin
padilhath18-Jun-07 0:29
padilhath18-Jun-07 0:29 
Generalthanks! Pin
cdnhype13-May-07 19:06
cdnhype13-May-07 19:06 
GeneralNot to be harsh, obnoxious or simply a ‘smuck’ but, useless Pin
cechode23-Dec-04 22:15
cechode23-Dec-04 22:15 
GeneralRe: Not to be harsh, obnoxious or simply a ‘smuck’ but, useless Pin
The Beard24-Dec-04 1:18
The Beard24-Dec-04 1:18 
GeneralRe: Not to be harsh, obnoxious or simply a ‘smuck’ but, useless Pin
attackweasel27-Dec-04 3:22
attackweasel27-Dec-04 3:22 
GeneralRe: Not to be harsh, obnoxious or simply a ‘smuck’ but, useless Pin
TLWallace27-Jun-05 6:27
TLWallace27-Jun-05 6:27 
GeneralRe: Not to be harsh, obnoxious or simply a ‘smuck’ but, useless Pin
Member 9618-Jan-06 12:19
Member 9618-Jan-06 12:19 
GeneralRe: Not to be harsh, obnoxious or simply a ‘smuck’ but, useless Pin
yesildal17-May-06 13:30
yesildal17-May-06 13:30 
GeneralRe: Not to be harsh, obnoxious or simply a ‘smuck’ but, useless Pin
okoji Cyril2-Aug-07 21:00
okoji Cyril2-Aug-07 21:00 
don'nt mind the guy joo

Magic has often been thought of us the art of making dreams come true; the art of realizing visions. Yet before we can bring birth to the vision we have to see it.

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

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