Click here to Skip to main content
16,005,552 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: scrollbar Pin
Dave Kreskowiak1-Aug-06 4:50
mveDave Kreskowiak1-Aug-06 4:50 
GeneralRe: scrollbar Pin
microuser_20001-Aug-06 12:43
microuser_20001-Aug-06 12:43 
GeneralRe: scrollbar Pin
Dave Kreskowiak2-Aug-06 2:07
mveDave Kreskowiak2-Aug-06 2:07 
QuestionVB.NET & WSUS API - Reporting the status of a specific update per computer Pin
J Oliveira1-Aug-06 1:08
J Oliveira1-Aug-06 1:08 
Questionencrypt password Pin
md_refay1-Aug-06 0:50
md_refay1-Aug-06 0:50 
AnswerRe: encrypt password Pin
ii_noname_ii1-Aug-06 4:45
ii_noname_ii1-Aug-06 4:45 
GeneralRe: encrypt password Pin
ii_noname_ii1-Aug-06 4:54
ii_noname_ii1-Aug-06 4:54 
AnswerRe: encrypt password Pin
Nouvand3-Aug-06 2:02
Nouvand3-Aug-06 2:02 
what version of VB you're using?
If you're using VB.NET or 2005 there are several way you can encrypt the password(string) before you commit it to the database.

You can try this one: (VB 2005)
--------------------------------------------------------------------------------
Imports System
Imports System.IO
Imports System.Text
Imports System.Security.Cryptography

Public Class CLSxCrypter
Private Enum ENUMxChains
e_Random = 0
e_Genuine = 1
End Enum
Private Shared SEC_Key() As Byte = {4, 79, 103, 140, 6, 60, 24, 88, _
76, 77, 254, 237, 104, 117, 106, 175, _
54, 140, 255, 30, 143, 61, 39, 19, _
122, 235, 123, 158, 250, 190, 159, 224}

Private Shared SEC_IV() As Byte = {110, 121, 68, 148, 141, 195, 221, 30, _
228, 89, 223, 131, 226, 82, 177, 195}

Public Shared Function SEC_Encrypt(ByVal xPlainString As String) As String

Dim EncryptBuffer() As Byte, _
EncryptedBytes() As Byte, _
EncryptedString As String = "", _
mRijndael As New RijndaelManaged, _
ASCIIConverter As New ASCIIEncoding, _
Encryptor As ICryptoTransform, _
msEncrypt As New MemoryStream

'create encryptor
Encryptor = mRijndael.CreateEncryptor(SEC_Key, SEC_IV)

'encrypt data
Dim csEncrypt As New CryptoStream(msEncrypt, Encryptor, CryptoStreamMode.Write)

'convert the data to a byte array
EncryptBuffer = ASCIIConverter.GetBytes(xPlainString)

'write all data to the crypto stream and flush it
csEncrypt.Write(EncryptBuffer, 0, EncryptBuffer.Length)
csEncrypt.FlushFinalBlock()

'get encrypted array of bytes
EncryptedBytes = msEncrypt.ToArray

'convert the encrypted bytes in array to string
For i As Integer = 0 To EncryptedBytes.Length - 1
EncryptedString = EncryptedString & EncryptedBytes(i) & " "
Next
EncryptedString = Left(EncryptedString, EncryptedString.Length - 1)

'return the encrypted string value
Return EncryptedString

End Function
Public Shared Function SEC_Decrypt(ByVal CipherString As String) As String

Dim EncryptedStrings() As String, _
EncryptedBytes() As Byte, _
DecryptBuffer() As Byte, _
DecryptedString As String, _
ASCIIConverter As New ASCIIEncoding, _
mRijndael As New RijndaelManaged, _
Decryptor As ICryptoTransform

'create decryptor
Decryptor = mRijndael.CreateDecryptor(SEC_Key, SEC_IV)

'convert the data to a byte array
EncryptedStrings = Split(CipherString)

ReDim EncryptedBytes(EncryptedStrings.Length - 1)

For i As Integer = 0 To EncryptedStrings.Length - 1
EncryptedBytes(i) = CByte(EncryptedStrings(i))
Next

'decrypt data
Dim msDecrypt As New MemoryStream(EncryptedBytes)
Dim csDecrypt As New CryptoStream(msDecrypt, Decryptor, CryptoStreamMode.Read)

DecryptBuffer = New Byte(EncryptedBytes.Length) {}

'Read the data out of the crypto stream
csDecrypt.Read(DecryptBuffer, 0, DecryptBuffer.Length)

'Convert the byte array back into a string
DecryptedString = ASCIIConverter.GetString(DecryptBuffer)

Return DecryptedString

End Function
-------------------------------------------------------------------------------
You can change the Key and IV with yours...

Good LuckCool | :cool:
Question(wav / mp3) file Pin
md_refay1-Aug-06 0:47
md_refay1-Aug-06 0:47 
Questionsetup package Pin
md_refay1-Aug-06 0:45
md_refay1-Aug-06 0:45 
QuestionMsgBox brainteaser Pin
ii_noname_ii1-Aug-06 0:42
ii_noname_ii1-Aug-06 0:42 
AnswerRe: MsgBox brainteaser Pin
Dave Kreskowiak1-Aug-06 5:06
mveDave Kreskowiak1-Aug-06 5:06 
GeneralRe: MsgBox brainteaser Pin
ii_noname_ii1-Aug-06 20:07
ii_noname_ii1-Aug-06 20:07 
GeneralRe: MsgBox brainteaser Pin
Dave Kreskowiak2-Aug-06 3:06
mveDave Kreskowiak2-Aug-06 3:06 
GeneralRe: MsgBox brainteaser Pin
ii_noname_ii2-Aug-06 20:10
ii_noname_ii2-Aug-06 20:10 
AnswerRe: MsgBox brainteaser Pin
Steven J Jowett1-Aug-06 5:45
Steven J Jowett1-Aug-06 5:45 
GeneralRe: MsgBox brainteaser Pin
ii_noname_ii1-Aug-06 20:05
ii_noname_ii1-Aug-06 20:05 
GeneralRe: MsgBox brainteaser Pin
Steven J Jowett1-Aug-06 23:04
Steven J Jowett1-Aug-06 23:04 
GeneralRe: MsgBox brainteaser Pin
ii_noname_ii2-Aug-06 0:04
ii_noname_ii2-Aug-06 0:04 
QuestionResize OCX in MMC - VB6 Pin
YemShivaKumar1-Aug-06 0:38
YemShivaKumar1-Aug-06 0:38 
AnswerRe: Resize OCX in MMC - VB6 Pin
Dave Kreskowiak1-Aug-06 5:11
mveDave Kreskowiak1-Aug-06 5:11 
Questionsaving treeview changes back in database Pin
Kapil Thakur1-Aug-06 0:34
Kapil Thakur1-Aug-06 0:34 
AnswerRe: saving treeview changes back in database Pin
Dave Kreskowiak1-Aug-06 5:13
mveDave Kreskowiak1-Aug-06 5:13 
Questioninsert error Pin
kyosugi1-Aug-06 0:17
kyosugi1-Aug-06 0:17 
AnswerRe: insert error Pin
Dave Kreskowiak1-Aug-06 5:18
mveDave Kreskowiak1-Aug-06 5:18 

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.