CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2002
    Location
    Starkville, MS
    Posts
    4

    Question Equivalent function to PHP's crypt()?

    I'm currently writing a Windows application that will interface through HTTP POST requests to a PHP website backend that I'm also writing. I'm using PHP's crypt() function to encrypt the passwords that are inserted into the user database when a new user registers on the site. I'd like to know if there are any libraries, MSVC++ functions, or source code snippets that I could use to implement a DES encryption function so I can send an encrypted password string over the internet rather than a plaintext one.

    I've taken a look at OpenSSL and it does have a function for DES encryption, but I can't use it unless I install the rest of the lib as well, which I don't really want or need.

    Any help would be greatly appreciated.

    Thanks,
    David

  2. #2
    Join Date
    Aug 2001
    Location
    North Bend, WA
    Posts
    1,947
    Look up the Crypto Api in MSDN. It has the nearest equivilent.

  3. #3
    Join Date
    Oct 2002
    Location
    Starkville, MS
    Posts
    4
    I heard about it, but I didn't think it would give me a DES encrypted string. I need something that will give me the same output that the PHP crypt() function gave me so i can do a string comparison on the encrypted strings to test for password validity.

    If i'm missing something about Crypto API and I could actually do what I'm asking, please let me know.

    Thanks,
    David

  4. #4
    Join Date
    Aug 2001
    Location
    North Bend, WA
    Posts
    1,947
    Hmmm...

    I read that the MS Crypto API invokes one of several underlying encryption mechanisms. I see DSS in the list, but not DES. I'm not sure how different they actually are.

    There may be a "Cryptographic Service Provider" available for DES, but I haven't seen it. I guess it hasn't mattered to me before. I've only done some rudimentary crypto stuff.

    Does the PHP Crypt function have any options as to the types of encryption it supports?

  5. #5
    Join Date
    Dec 2000
    Location
    Slovakia
    Posts
    1,043
    DSS means Digital Signature Standard.

    DSS, or PROV_DSS is not use for standard DES encryption and decryption. It is provider for digital signature. PROV_DSS provider doesn't support any encrypting mechanism. Just digital signature and hash codes (MD 5 and Secure Hash Algorithm).

    That's about DSS provider...

    You can encrypt any plain text using DES algorithm with Crypto API too. However you need to use MS Enhanced Provider to deal with this purpose...

    The explanation of whole Crypto API functionality is too complex to write it here... I recommend you to read the Crypto API documentation in MSDN. The good start point to Crypto API would be Dino Esposito's article:
    Periodicals 1997 \ Supporting CryptoAPI in Real-Word Applications

    You can find this article in MSDN...

    martin

  6. #6
    Join Date
    Aug 2022
    Posts
    1

    Re: Equivalent function to PHP's crypt()?

    Quote Originally Posted by neonstar View Post
    I'm currently writing a Windows application that will interface through HTTP POST requests to a PHP website backend that I'm also writing. I'm using PHP's crypt() function to encrypt the passwords that are inserted into the user database when a new user registers on the site. I'd like to know if there are any libraries, MSVC++ functions, or source code snippets that I could use to implement a DES encryption function so I can send an encrypted password string over the internet rather than a plaintext one.

    I've taken a look at OpenSSL and it does have a function for DES encryption, but I can't use it unless I install the rest of the lib as well, which I don't really want or need.

    Any help would be greatly appreciated.

    Thanks,
    David
    Thank you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured