Announcement

Collapse
No announcement yet.

Header Conversion For DES Encryption

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Header Conversion For DES Encryption

    Can someone help me create a declare statement for a DES encryption
    DLL. Below is part of the comment block from the header file.

    Code:
     * Synopsis:	   DesXxCrypt(key,inp,out,cnt)
     *
     *	Input:	   key - 64-bit DES key
     *                 inp - pointer to buffer of input data
     *                 out - pointer to buffer for result data
     *                 cnt - count of 64-bit blocks to be processed
     *
     *	Output:    None.
     *
     * Side Effect:	   Writes data to output buffer "out".
     *
     *****************************************************************************/
    extern  VOID FAR PASCAL DesEnCrypt(LPBYTE key,LPBYTE inp,LPBYTE out,WORD cnt);
    extern  VOID FAR PASCAL DesDeCrypt(LPBYTE key,LPBYTE inp,LPBYTE out,WORD cnt);

    ------------------
    Thanks,

    Doug Gamble
    mailto:[email protected][email protected]</A>
    Thanks,

    Doug Gamble
    [email protected]

  • #2
    Hi

    the C declares translate to:

    Code:
    DECLARE SUB DesEnCrypt SDECL ALIAS "DesEnCrypt" (BYVAL pKey AS BYTE PTR, _
                                                BYVAL pInp AS BYTE PTR, _
                                                BYVAL pOut AS BYTE PTR, _
                                                BYVAL wCount AS WORD)
     
    DECLARE SUB DesDeCrypt SDECL ALIAS "DesDeCrypt" (BYVAL pKey AS BYTE PTR, _
                                                BYVAL pInp AS BYTE PTR, _
                                                BYVAL pOut AS BYTE PTR, _
                                                BYVAL wCount AS WORD)
    
     
    'There's a small problem however: you'll notice that the 2 C declarations
    'have the keyword 'extern' at the front. This indicates that the implementation
    'of those routines are in an external file. It could be a header file,
    'a library or (this would be best for you), a dynamic link library.
     
    'If the routines are implemeted in a DLL then you'll have to add the
    'LIB keyword to the SUB declarations as in this example:
     
    DECLARE SUB DesEnCrypt SDECL LIB "MyDLL.DLL" ALIAS "DesEnCrypt" (BYVAL pKey AS BYTE PTR, _
                                                BYVAL pInp AS BYTE PTR, _
                                                BYVAL pOut AS BYTE PTR, _
                                                BYVAL wCount AS WORD)
     
    DECLARE SUB DesDeCrypt SDECL LIB "MyDLL.DLL" ALIAS "DesDeCrypt" (BYVAL pKey AS BYTE PTR, _
                                                BYVAL pInp AS BYTE PTR, _
                                                BYVAL pOut AS BYTE PTR, _
                                                BYVAL wCount AS WORD)
    Cheers

    Florent


    ------------------

    Comment

    Working...
    X