Thanks, 

Regarding base64, strconv() does not give the answer I need. I was given this 
reference: http://en.wikipedia.org/wiki/Basic_authentication_scheme
I was able to duplicate their result by using a batch file to run openssl. It 
is not quite as clean as I would like, but it works fine and is easy.

The only thing left is UTF-16.


----- Original Message ----- 
From: Andrew Stirling 
To: [email protected] 
Sent: Saturday, May 09, 2009 8:05 AM
Subject: Re: VFP9 SP1 encoding little endian UTF 16, SHA1, base64


Kam

You can get the SHA1 done via Craig Boyd's vfpencryption,.fll
http://www.sweetpotatosoftware.com/SPSBlog/2007/08/06/VFPEncryptionUpdate.aspx

Function HASH()
Signature: Hash(cStringtoHash[, nHashType])
Parameters:
cStringtoHash - A plain text string you wish to have hashed
nHashType - The type of hash function to generate. There are currently 7 
different hash functions supported

1 = SHA1 (a.k.a SHA160)
2 = SHA256
3 = SHA384
4 = SHA512 *Default
5 = MD5
6 = RIPEMD128
7 = RIPEMD256

SET LIBRARY TO vfpencryption71.fll ADDITIVE
tempText ="Hello World" +CHR(13) + " was Jane's quote"
? (Hash(tempText,1)
? STRCONV(Hash(tempText,1),13)

I also think you need to have/download 'msvcp71.dll'

Andrew Stirling
01250 874580
http://www.calcpay.co.uk
HMRC Accredited UK payroll program


KAM.covad wrote:
> You could, but it has too many years since I did any assembler or C. I have 
> 20+ years in VFP so I am going to do everything there if I can. I use the 
> windows API alot so will go that way if possible.
> 
> STRCONV will do the base64 (thanks to Tracy). The VFP manual for XML web 
> services talks about UTF-16 (making the double bytes that I need in case the 
> password has characters that are not plain text). I still don't know about 
> the SHA1.
> 
> 
> 
> ----- Original Message ----- 
> From: Stephen Russell 
> To: ProFox Email List 
> Sent: Friday, May 08, 2009 12:38 PM
> Subject: Re: VFP9 SP1 encoding little endian UTF 16, SHA1, base64
> 
> 
> On Fri, May 8, 2009 at 1:54 PM, KAM.covad
> <[email protected]> wrote:
>> I need to encode a password:
>> 1. convert to upper case (yes, I know how to do this)
>> 2. Unicode it in little endian UTF16
>> 3. SHA1 it
>> 4. base64 encode it
>>
>> Here is an example I was given, but I have never used those methods and I do 
>> not believe they are in VFP
>>
>> The encoding process for password is: first convert to uppercase, then 
>> Unicode it in littleendian
>> UTF16,
>> then SHA1 it,
>> then base64 encode it.
>> UnicodeEncoding encoding = new UnicodeEncoding();
>> hashBytes = encoding.GetBytes(password.ToUpper().Trim());
>> SHA1 sha1 = new SHA1CryptoServiceProvider();
>> byte[] cryptPassword = sha1.ComputeHash(hashBytes);
>> String pwd= Convert.ToBase64String(cryptPassword);
> -------------------
> 
> That is straight up C#.
> 
> You could make a dll to do that and register it.
> You pass in string and it returns string back.
> 
> 

[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/010301c9d0e4$da3902a0$8600a...@w2k3s02
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to