|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
different language windowssetup for english, but on a spanish computer it doesn't work properly. Any idea how I can force this routine to only work in english. Public Function DecryptText(ByVal in_text As String) As String Dim strKey As String = "1234" Dim i As Integer Dim c As Integer Dim out_buff As String For i = 1 To Len(RTrim(in_text)) c = Asc(Mid$(in_text, i, 1)) c -= Asc(Mid(strKey, (i Mod Len(strKey)) + 1, 1)) out_buff &= Chr(c And &HFF) Next Return RTrim(out_buff) End Function Thanks. Darin *** Sent via Developersdex http://www.developersdex.com ***
Show quote
Hide quote
"Darin" <darin_nospam@nospamever> schrieb: How do the results differ on the two systems?>I have a program that works perfectly when the computer language is > setup for english, but on a spanish computer it doesn't work properly. > Any idea how I can force this routine to only work in english. > > Public Function DecryptText(ByVal in_text As String) As String > Dim strKey As String = "1234" > Dim i As Integer > Dim c As Integer > Dim out_buff As String > > For i = 1 To Len(RTrim(in_text)) > c = Asc(Mid$(in_text, i, 1)) > c -= Asc(Mid(strKey, (i Mod Len(strKey)) + 1, 1)) > out_buff &= Chr(c And &HFF) > Next > Return RTrim(out_buff) > End Function -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/> The characters just differ. It has to do with the unicode setting. I
have seen other english systems where if the language for non-unicode was something other then english, what is encrypted on a full english system isn't decrypted. In this case, everything in the regional setting is set for spanish - mexico. I just need a method of doing encryption and decryption that is language-indenpent, but not too easy to crack, and the resulting string has to have no issues with being stored in an SQL database. I have looked for some others, but they just store a string of numbers and I could break it by just looking at it. Darin *** Sent via Developersdex http://www.developersdex.com *** "Darin" <darin_nospam@nospamever> schrieb: Sorry, I missed that you are using 'Asc' and 'Chr' instead of 'AscW' and > The characters just differ. It has to do with the unicode setting. I > have seen other english systems where if the language for non-unicode > was something other then english, what is encrypted on a full english > system isn't decrypted. In this case, everything in the regional setting > is set for spanish - mexico. 'ChrW'. 'Asc'/'Chr' are using the current ANSI codepage which is different on Spanish and English systems. 'AscW' and 'ChrW' do not have this "problem". -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/> didn't know that. I will have to adjust all current encrypted text and
re-do them so Chr is now ChrW. Thanks. Darin *** Sent via Developersdex http://www.developersdex.com *** |
|||||||||||||||||||||||