////////////////////////////////////////////////////// // Secure Password // // // // by Pavel // // // Learn how to put Secure Passwords is your programs ////////////////////////////////////////////////////// Text Title : Secure Password Text Author : Pavel Author Mail : sadreck@yahoo.com Web Site : www.cccp.8m.net -=[Maximize Window For Better View]=- This text was written for people who know how to program.All the examples presented here are written in Visual Basic , but could also be used if re-written in any other programming language. Let's say that you want to put a password to your programs. You want the password to be STATIC (cannot be changed),like "testpassword". So , you put a statement in your program like this : If Password = "testpassword" Then Let_Me_In = True Else Let_Me_In = False End If Right ? Wrong ! If you do something like this , the only thing someone has to do is to open your program with a HEX editor and search for your password string.This can only be prevented , if you use an EXE Encryptor. But there is another solution too ! When the program is ran , it loads itself into the memory DECRYPTED ! So, the only thing to do,is to create a Loader that finds the string and shows it to you !But if you want to make it more difficult to find your "simple" password protection , keep reading. You will see a VERY INSANE way of encrypting your password ! This lock is called "One Way Encryption !" This password lock isn't the best lock ever ,but it will make the cracker call you names until he/she cracks your program ! Here we go ! The thing that we will do is to take the given string and compare it with the Correct string ! It sounds easy , and it is easy ! '//Here is the Correct Encrypted String (testpassword) : CorrectString = "E3391103CE23A14B3DE039D3E2AD23A113C3A10B3DE3E391413FD539" '//Set All Values To Zero(0) EncryptedString = "" NumericString = "" FinalString = "" MCounter = 0 '//Start Encryption Part 1 For i = 1 To Len(Text1.Text) '//Get letter from Text1.Text at position (i) letterA = Asc(Mid$(Text1.Text, i, 1)) '//Check if (i + 1) > Length of Text1.Text so that no errors appear If i + 1 > Len(Text1.Text) Then '//If TRUE , then take the first letter letterB = Asc(Mid$(Text1.Text, 1, 1)) Else '//If FALSE , then take the letter at position (i + 1) letterB = Asc(Mid$(Text1.Text, i + 1, 1)) End If '//Set LetterC as the sum of (LetterA + LetterB) letterC = letteA + letterB '//Check if LetterC > 255 so that no errors appear.If TRUE , then '//set LetterC minus 256 If letterC > 255 Then letterC = letterC - 256 '//Convert (LetterC) to HEX String Hex_Letter = Hex$(letterC) '//Add Hex_Letter value to Encrypted String EncryptedString = EncryptedString & Hex_Letter Next i '//Start Encryption Part 2 For i = Len(Text1.Text) To 1 Step -1 '//Get letter from Text1.Text at position (i) letterA = Asc(Mid$(Text1.Text, i, 1)) '//Set MCounter to (MCounter + 1) MCounter = MCounter + 1 '//Get letter from Text1.Text at position (MCounter) letterB = Asc(Mid$(Text1.Text, MCounter, 1)) '//Do operations letterC = ((letterA + letterB) * 2) * 8 '//Convert letterC to HEX Hex_Letter = Hex$(letterC) '//Add Hex_Letter value to NumericString NumericString = NumericString & Hex_Letter Next i '//Set MCounter to Zero(0) MCounter = 0 '//Start Encryption Part 3 For i = 1 To Len(NumericString) '//Get letter from Text1.Text at position (i) letterA = Asc(Mid$(NumericString, i, 1)) '//Set MCounter to (MCounter + 1) MCounter = MCounter + 1 '//Check if (MCounter + 1) > Length of (EncryptedString).If TRUE then '//set MCounter to One (1) If MCounter + 1 > Len(EncryptedString) Then MCounter = 1 '//Get letter from Text1.Text at position (MCounter) letterB = Asc(Mid$(EncryptedString, MCounter, 1)) '//Set letterC as (letterA - letterB) letterC = letterA - letterB '//Check if letterC < 0.If TRUE then set letterC as LetterC + 64 If letterC < 0 Then letterC = letterC + 64 '//Convert LetterC to HEX Hex_Letter = Hex$(letterC) '//Add Hex_Letter value to FinalString FinalString = FinalString & Hex_Letter Next i '//Check if FinalString Matches the correct string If FinalString <> CorrectString Then Continue = False Else Continue = True End If This is a very good way to secure your program with a static password , but it is still breakable ! You can make the algorithm stronger and encrypt your EXE file ! This way you will make it MORE difficult to crack.Anyways ,this is the Secure Password locking.If you like it , you can use it ! If you don't like it...don't use it ! :)