65.9K
CodeProject is changing. Read more.
Home

VB.NET String Obfuscation Utility

starIconstarIconstarIcon
emptyStarIcon
starIcon
emptyStarIcon

3.57/5 (15 votes)

Dec 24, 2004

CPOL

1 min read

viewsIcon

88955

downloadIcon

2449

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:

Private SObs As New StringObfuscate

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

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.

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

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