the change produces some success.  It turns out I had the wrong value for ALGid 
(2nd param)

I get success with passing the CALG_ID value for SHA1, but SHA256 (32780) seems 
to fail on my system

CryptCreateHash ({. a2) ; 32772 ; 0 ; 0 ; (m=. , _1) NB. SHA1 hash




----- Original Message -----
From: bill lam <[email protected]>
To: [email protected]
Cc: 
Sent: Friday, September 6, 2013 10:32:17 AM
Subject: Re: [Jprogramming] SHA 256

I guess it should be

CryptCreateHash =: 'advapi32.dll CryptCreateHash i x i i i *x' & cd
CryptCreateHash ({.a); ALG_SID_SHA_256; 0 ; 0 ; (m=.,_1)

untested.
Пт, 06 сен 2013, Joe Bogner писал(а):
> I haven't worked out all the signatures, but I noticed that
> CryptAcquireContext was returning zero in your version
> 
> This version returns 1 and correctly populates a value in a
> 
> CryptAcquireContext =: 'advapi32.dll CryptAcquireContextA i *x *c *c i i' &
> cd
> CryptAcquireContext (a=.,_1);(<0);(<0);PROV_RSA_FULL;CRYPT_VERIFYCONTEXT
> 
> I haven't been able to use that context in CryptCreateHash yet
> 
> I was thinking that I could do this:
> 
> CryptCreateHash =: 'advapi32.dll CryptCreateHash i *x i i i *x' & cd
> CryptCreateHash a; ALG_SID_SHA_256; 0 ; 0 ; (m=.,_1)
> 
> Yet that's returning 0 and m is _1
> 
> 
> 
> 
> On Fri, Sep 6, 2013 at 7:31 AM, Henry Rich <[email protected]> wrote:
> 
> > On rereading, I think I am wrong here.  Ignore this.
> >
> > Henry Rich
> >
> >
> > On 9/6/2013 5:22 AM, Henry Rich wrote:
> >
> >> I'm looking at
> >>
> >> CryptCreateHash =: 'advapi32.dll CryptCreateHash i *i i i i *i' & cd
> >> err =. CryptCreateHash (<a); ALG_SID_SHA_256 ; 0 ; 0 ; (<<h)
> >>
> >> and I don't understand why this doesn't give an error on parameters a
> >> and h.  They correspond to *i descriptors, but they are scalar boxes.  I
> >> thought they needed to be scalars, so I would use
> >>
> >> err =. CryptCreateHash a; ALG_SID_SHA_256 ; 0 ; 0 ; h
> >>
> >> Similar cases later on
> >>
> >>
> >> Untested.
> >>
> >> Henry Rich
> >>
> >> On 9/6/2013 12:10 AM, Pascal Jasmin wrote:
> >>
> >>> I'm trying to get sha256 from microsoft's library working.
> >>>
> >>> MS documentation on the last call in my function:
> >>> http://msdn.microsoft.com/en-**us/library/windows/desktop/**
> >>> aa379947(v=vs.85).aspx<http://msdn.microsoft.com/en-us/library/windows/desktop/aa379947(v=vs.85).aspx>
> >>>
> >>>
> >>> The problem is that the 3rd param to CryptGetHashParam is a pointer to
> >>> a byte array, and should hold the hash result, but I'm unable to see
> >>> it change.  The 2nd param in CryptHashData may also be called
> >>> incorrectly here.
> >>>
> >>> any help?
> >>>
> >>>
> >>> ALG_SID_SHA_256 =: 12
> >>> ALG_CLASS_HASH =: 32768
> >>> PROV_RSA_FULL =:1
> >>> PROV_RSA_AES =: 24
> >>> HP_HASHVAL =: 2
> >>> CRYPT_VERIFYCONTEXT =: 4026531840
> >>> CryptAcquireContext =: ('advapi32.dll CryptAcquireContextA i *i c c i
> >>> i') & cd
> >>> NB.(ByRef phProv As Long, ByVal pszContainer As String, ByVal
> >>> pszProvider As String, ByVal dwProvType As Long, ByVal dwFlags As Long)
> >>> CryptReleaseContext =: 'advapi32.dll CryptReleaseContext i i i' & cd
> >>> NB. (ByVal hProv As Long, ByVal dwFlags As Long) As Long
> >>> CryptCreateHash =: 'advapi32.dll CryptCreateHash i *i i i i *i' & cd
> >>> NB.(ByVal hProv As Long, ByVal Algid As Long, ByVal hKey As Long,
> >>> ByVal dwFlags As Long, ByRef phHash As Long) As Long
> >>> CryptDestroyHash =: 'advapi32.dll CryptDestroyHash i i' & cd
> >>> NB.(ByVal hHash As Long) As Long
> >>> CryptHashData =: 'advapi32.dll CryptHashData i *i *c i i' & cd
> >>> NB.(ByVal hHash As Long, pbData As Any, ByVal cbData As Long, ByVal
> >>> dwFlags As Long) As Long
> >>> CryptGetHashParam =: 'advapi32.dll CryptGetHashParam i *i i *c *i i' & cd
> >>> NB.(ByVal hHash As Long, ByVal dwParam As Long, pbData As Any, ByRef
> >>> pcbData As Long, ByVal dwFlags As Long) As Long
> >>>
> >>>
> >>>
> >>> CreateHash =: 3 : 0
> >>> a =. mema 8
> >>> h =. mema 128
> >>> o =. mema 32
> >>>
> >>> err=. CryptAcquireContext (<a);' ';' ';PROV_RSA_FULL;CRYPT_**
> >>> VERIFYCONTEXT
> >>> err =. CryptCreateHash (<a); ALG_SID_SHA_256 ; 0 ; 0 ; (<<h)
> >>> y memw o, 0 , # y
> >>> CryptHashData (<h) ; (y) ; (# y) ; 0
> >>> CryptGetHashParam (<h); HP_HASHVAL ; (<o ); (,32) ; 0
> >>> NB. memr o, 0, # y
> >>> )
> >>>
> >>>
> >>> vb code that i adapted this from:
> >>> http://khoiriyyah.blogspot.ca/**2012/06/vb6-hash-class-md5-**
> >>> sha-1-sha-256-sha.html<http://khoiriyyah.blogspot.ca/2012/06/vb6-hash-class-md5-sha-1-sha-256-sha.html>
> >>>
> >>> ------------------------------**------------------------------**
> >>> ----------
> >>> For information about J forums see 
> >>> http://www.jsoftware.com/**forums.htm<http://www.jsoftware.com/forums.htm>
> >>>
> >>>  ------------------------------**------------------------------**
> >> ----------
> >> For information about J forums see 
> >> http://www.jsoftware.com/**forums.htm<http://www.jsoftware.com/forums.htm>
> >>
> >>  ------------------------------**------------------------------**
> > ----------
> > For information about J forums see 
> > http://www.jsoftware.com/**forums.htm<http://www.jsoftware.com/forums.htm>
> >
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm

-- 
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm 
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to