Author: KAM.covad
Posted: 2009-05-08 14:54:10 Link
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.=20
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);
Anyone know where to start looking? I searched google but could not find =
anything that could easily be converted to vfp code.
--- StripMime Report -- processed MIME parts ---
multipart/alternative
text/plain (text body -- kept)
text/html
---
Author: Tracy Pearson
Posted: 2009-05-08 15:23:24 Link
STRCONV() can get you base64 but not UTF16, though UTF8 is there.
There has been threads previously on Crypto, either someone else will give
their two cents, or you can search the threads.
That looks like it might be .NET, it's possible some of this information can
be gotten through Craig Boyd's encryption FLL. I've not used it either.
HTH,
Tracy
-----Original Message-----
From: KAM.covad
Sent: Friday, May 08, 2009 2:54 PM
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);
Anyone know where to start looking? I searched google but could not find
anything that could easily be converted to vfp code.
Author: Stephen Russell
Posted: 2009-05-08 15:38:21 Link
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 = 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.
--
Stephen Russell
Sr. Production Systems Programmer
Web and Windows Development
Independent Contractor
Memphis TN
901.246-0159
Author: KAM.covad
Posted: 2009-05-08 15:51:50 Link
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]
Author: Andrew Stirling
Posted: 2009-05-09 11:05:44 Link
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
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
> <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 = 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.
>
>
Author: KAM.covad
Posted: 2009-05-09 16:29:23 Link
Thanks,=20
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 -----=20
From: Andrew Stirling=20
To: profox@leafe.com=20
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 =3D SHA1 (a.k.a SHA160)
2 =3D SHA256
3 =3D SHA384
4 =3D SHA512 *Default
5 =3D MD5
6 =3D RIPEMD128
7 =3D RIPEMD256
SET LIBRARY TO vfpencryption71.fll ADDITIVE
tempText =3D"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
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.
>=20
> 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.
>=20
>=20
>=20
> ----- 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
>=20
>=20
> 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);
> -------------------
>=20
> That is straight up C#.
>=20
> You could make a dll to do that and register it.
> You pass in string and it returns string back.
>=20
>=20
[excessive quoting removed by server]
Author: Andrew Stirling
Posted: 2009-05-09 20:54:32 Link
Kam
Re the example
temp = "Aladdin:open sesame"
? STRCONV(temp,13)
gives:
QWxhZGRpbjpvcGVuIHNlc2FtZQ==
is that not what you want?
Andrew Stirling
01250 874580
HMRC Accredited UK payroll program
KAM.covad wrote:
> 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: profox@leafe.com
> 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
> 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
>> <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 = 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]
Author: KAM.covad
Posted: 2009-05-09 21:22:01 Link
Thanks. That saves me the trouble of using openssl
You are correct. I was changing it to upper case like the specs, however =
for that example, they did not make it upper case.=20
----- Original Message -----=20
From: Andrew Stirling=20
To: profox@leafe.com=20
Sent: Saturday, May 09, 2009 5:54 PM
Subject: Re: VFP9 SP1 encoding little endian UTF 16, SHA1, base64
Kam
Re the example
temp =3D "Aladdin:open sesame"
? STRCONV(temp,13)
gives:
QWxhZGRpbjpvcGVuIHNlc2FtZQ=3D=3D
is that not what you want?
Andrew Stirling
01250 874580
HMRC Accredited UK payroll program
KAM.covad wrote:
> Thanks,=20
>=20
> 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.
>=20
> The only thing left is UTF-16.
>=20
>=20
> ----- Original Message -----=20
> From: Andrew Stirling=20
> To: profox@leafe.com=20
> Sent: Saturday, May 09, 2009 8:05 AM
> Subject: Re: VFP9 SP1 encoding little endian UTF 16, SHA1, base64
>=20
>=20
> Kam
>=20
> You can get the SHA1 done via Craig Boyd's vfpencryption,.fll
> =
http://www.sweetpotatosoftware.com/SPSBlog/2007/08/06/VFPEncryptionUpdate=
.aspx
>=20
> 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=20
> different hash functions supported
>=20
> 1 =3D SHA1 (a.k.a SHA160)
> 2 =3D SHA256
> 3 =3D SHA384
> 4 =3D SHA512 *Default
> 5 =3D MD5
> 6 =3D RIPEMD128
> 7 =3D RIPEMD256
>=20
> SET LIBRARY TO vfpencryption71.fll ADDITIVE
> tempText =3D"Hello World" +CHR(13) + " was Jane's quote"
> ? (Hash(tempText,1)
> ? STRCONV(Hash(tempText,1),13)
>=20
> I also think you need to have/download 'msvcp71.dll'
>=20
> Andrew Stirling
> 01250 874580
> HMRC Accredited UK payroll program
>=20
>=20
> 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 -----=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
[excessive quoting removed by server]
Author: Tracy Pearson
Posted: 2009-05-11 09:42:43 Link
In regards to the MSVCP7*.DLL, I found an FLL I built will not use the DLL
in the same folder as the FLL. Either the DLL needs to be in the path, or in
needs to be registered in the manifests. Building the FLL by default will
put the manifest into the FLL. However, the DLL needs to be installed with
manifest instructions. This is the DLL Hell solution Microsoft has put out.
Installing the DLL with the MSM found in the %CommonProgramFiles%\Merge
Modules is the easiest way to install the manifest links.
Using INNO does not have a direct provision for installing an MSM. There is
a tool available to convert an MSM into an MSI which INNO could then use.
http://www.ethalone.com/articles/msm2msi.php
HTH,
Tracy
-----Original Message-----
From: Andrew Stirling
Sent: Saturday, May 09, 2009 11:06 AM
Kam
You can get the SHA1 done via Craig Boyd's vfpencryption,.fll
http://www.sweetpotatosoftware.com/SPSBlog/2007/08/06/VFPEncryptionUpdate.as
px
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
HMRC Accredited UK payroll program