| Author |
Topic |
|
saini_balvinder
Starting Member
22 Posts |
Posted - 2008-01-03 : 00:19:08
|
| This is related to post :http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=78552got a issue with this one..im not sure why..My results are as follows:Select dbo.fnEncDecRc4('Orange12345', 'Hello123')Output : ,MglSelect dbo.fnEncDecRc4('Orange12345', ',Mgl')Output : Mi am not able to decrypt it. Any idea why this is hapenning? Does it has to do something with regional settings? |
|
|
kiruthika
Yak Posting Veteran
67 Posts |
Posted - 2008-01-03 : 01:28:33
|
quote: Originally posted by saini_balvinder This is related to post :http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=78552got a issue with this one..im not sure why..My results are as follows:Select dbo.fnEncDecRc4('Orange12345', 'Hello123')Output : ,MglSelect dbo.fnEncDecRc4('Orange12345', ',Mgl')Output : Mi am not able to decrypt it. Any idea why this is hapenning? Does it has to do something with regional settings?
Hi! Try this Select dbo.fnEncDecRc4('Orange12345', 'Hello123') as [Ecryption]Ecryption----------ó,úMÃglcopy this and paste it to the below functionselect dbo.fnEncDecRc4('Orange12345', 'ó,úMÃgl') as [Decryption]Decryption-----------Hello123It gives the same resultkiruthika!http://www.ictned.eu |
 |
|
|
saini_balvinder
Starting Member
22 Posts |
Posted - 2008-01-03 : 01:45:17
|
| Hello Kirutika,Thanks for your reply. i have seen the previous msg for this topic and all of them can encrypt/decrypt successfully. But in my case the query :Select dbo.fnEncDecRc4('Orange12345', 'Hello123') is giving me this result,MglIts not the same with your result. Any idea why this is hapenning? |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-01-03 : 01:56:22
|
Never mind his result. The important thing is that YOU get original text back when decoding the encoded text.Maybe you are using unicode and kiruthika is not? E 12°55'05.25"N 56°04'39.16" |
 |
|
|
saini_balvinder
Starting Member
22 Posts |
Posted - 2008-01-03 : 02:04:48
|
| Hello Peso,Thanks for that... but thing is im not able to decrypt it... i have following results with different query:select dbo.fnEncDecRc4('Orange12345',(select dbo.fnEncDecrc4('Orange12345','testing123')))Result:! |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-01-03 : 02:07:25
|
Are you using UNICODE collation? E 12°55'05.25"N 56°04'39.16" |
 |
|
|
saini_balvinder
Starting Member
22 Posts |
Posted - 2008-01-03 : 02:23:51
|
| Hello Peso,the application i have is for japan, so when i create a new table by default the unicode is as follows. below is script for my table.if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[TBL_FTP]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)drop table [dbo].[TBL_FTP]GOCREATE TABLE [dbo].[TBL_FTP] ( [Userid] [varchar] (15) COLLATE Chinese_PRC_CI_AS NULL , [pwd] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL , [createdate] [smalldatetime] NULL ) ON [PRIMARY]GO |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-01-03 : 02:37:23
|
The columns are still varchar with chinese collation.Have you tried creating the columns with NVARCHAR instead? E 12°55'05.25"N 56°04'39.16" |
 |
|
|
saini_balvinder
Starting Member
22 Posts |
Posted - 2008-01-03 : 02:47:07
|
| Hello peso,no luck.. i change column type to nvarchar and run the following:declare @pwd varchar(256)update tbl_ftp set pwd=dbo.fnEncDecRc4('Orange12345','$Orange1234')select @pwd=pwd from tbl_ftpset @pwd=dbo.fnEncDecRc4('Orange12345',@pwd)print @pwdResult:(1 row(s) affected) ! |
 |
|
|
KenW
Constraint Violating Yak Guru
391 Posts |
Posted - 2008-01-03 : 14:12:00
|
quote: Originally posted by saini_balvinder Hello peso,no luck.. i change column type to nvarchar and run the following:declare @pwd varchar(256)update tbl_ftp set pwd=dbo.fnEncDecRc4('Orange12345','$Orange1234')select @pwd=pwd from tbl_ftpset @pwd=dbo.fnEncDecRc4('Orange12345',@pwd)print @pwdResult:(1 row(s) affected) !
Common sense would tell you that if you were advised to change your columns to NVarchar, you should also change your variable types to NVarchar as well, wouldn't it? |
 |
|
|
saini_balvinder
Starting Member
22 Posts |
Posted - 2008-01-03 : 21:02:22
|
| tried that too...but same result. declare @pwd nvarchar(256)update tbl_ftp set pwd=dbo.fnEncDecRc4('Orange12345','$Orange1234')select @pwd=pwd from tbl_ftpset @pwd=dbo.fnEncDecRc4('Orange12345',@pwd)print @pwdResult:!The problem here is not with datatype or collation i think. because even if use just a "print" statement that also gives me same result.declare @pwd nvarchar(256)set @pwd=dbo.fnEncDecRc4('Orange12345','$Orange1234')print @pwdset @pwd=dbo.fnEncDecRc4('Orange12345',@pwd)print @pwdResult:@I0n ! |
 |
|
|
|