Re: VFP9 SP1 encoding little endian UTF 16, SHA1, base64

Author: KAM.covad

Posted: 2009-05-08 at 15:51:50

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 -----=20

From: Stephen Russell=20

To: ProFox Email List=20

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

<a_gmail_noSpam@kenmcginnis.com> 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 =3D new UnicodeEncoding();

> hashBytes =3D encoding.GetBytes(password.ToUpper().Trim());

> SHA1 sha1 =3D new SHA1CryptoServiceProvider();

> byte[] cryptPassword =3D sha1.ComputeHash(hashBytes);

> String pwd=3D 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.

--=20

Stephen Russell

Sr. Production Systems Programmer

Web and Windows Development

Independent Contractor

Memphis TN

901.246-0159

[excessive quoting removed by server]

©2009 KAM.covad