Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Encrypting a table in SQL Server
Message
From
20/08/2010 12:42:51
 
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01477569
Message ID:
01477608
Views:
44
>>>I need to implement in my VFP application being converted to SQL Server backend a Password feature. Currently in the VFP application I have a table MyPasswords.dbf that has (simplified) two column USER_NAME (C(20)) PASS_STR (C(200)). The PASS_STR contains a string like this “YNYNNNY” (just bunch of Y and N) encrypted using a very basic algorithm (which I created so it can be cracked in about 20 seconds <g>). But the application does not need much of security so it works.
>>>I can basically duplicate the same approach with a SQL Server table but before I do I thought I would ask if SQL Server has a simple (emphasize SIMPLE) way to encrypt a table and un-encrypt it in VFP application?
>>>
>>>TIA.
>>
>>
>>Why don't you (md5) hash the password a couple of times and store the hex of the hash in the password field ?
>
>Because I don't know how <g>. If you know of a simple article that you can recommend on the topic, please let me know. I will also search messages on UT if someone already posted an example. Thank you.


An example of how to Digest a password. It does a some passes depending on the length and the content of the password
function Password_Digest(Password, Digest, LeaveBinaryFormat)

	local Success
	Success = TRUE
	
	local i, j, obj
	
	do case
	case !md5Bits_Object(@m.obj)
		assert FALSE
		Success = FALSE
	
	case !m.obj.DigestString(m.Password, @m.Digest)
		assert FALSE
		Success = FALSE
	
	otherwise
		for i = 1 to len(m.Password)
			for j = 0 to mod(asc(substr(m.Password, m.i, 1)), 11)
				=m.obj.DigestString(m.Digest+m.Password, @m.Digest)
			endfor
		endfor
	
	endcase
	
	do case
	case !m.Success
	
	case m.LeaveBinaryFormat
	
	otherwise
		Digest = ath(m.Digest)  && in hex format
	
	endcase
	
	return m.Success

endfunc
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform