crypt in C++ just like crypt in c library

crypt in C++ just like crypt in c library

Post by william jian » Sat, 29 Jul 2000 04:00:00



I ever used the crypt function to crypt a string. and then compared the
crypted string with a special string such as password in shadow file. Using
this function, I can validate that the user is right or not.

The operation system is UNIX Sparc 2.6

But when I try to translate this function to C++. I was told that crypt has
not prototype. I don't know the correspnding function in C++ library just
like crypt in C library.

Any advice is welcome.

Thanks a lot.

 
 
 

crypt in C++ just like crypt in c library

Post by RenĂ© En » Sat, 29 Jul 2000 04:00:00


Hi



Quote:> I ever used the crypt function to crypt a string. and then compared the
> crypted string with a special string such as password in shadow file.
Using
> this function, I can validate that the user is right or not.

> The operation system is UNIX Sparc 2.6

> But when I try to translate this function to C++. I was told that crypt
has
> not prototype. I don't know the correspnding function in C++ library just
> like crypt in C library.

You can use the C function crypt in your C++ program (like any other C
function).
The only problem is that the C++ compiler requires a prototype, whereas a C
compiler
can do without (not always, but most often).

Now, there are two possible solutions for your problem:
1) you forgot to include the header file that contains the prototype of
crypt.
Use 'man crypt' to learn in which file the prototype is defined and include
it
in your sourcecode.

2) If no prototype is defined in the system header files, you have to define
the prototype
in your source file. If you don't know the prototype of crypt then look it
up in the man page.
You have to add sth like

extern char* crypt( char*);

to your sourcecode. Then it should work.

hth
Rene

============================================
Free C / C++ sourcecode for UNIX and WinTel platforms:
http://gemini.futurezone.com

 
 
 

1. unix crypt() vs. AIX crypt()


Yeah, this is quite cool. Which scheme is the default?

--
-----------------------------------------------------------------------------
Thomas H. Ptacek                                        Secure Networks, Inc.
-----------------------------------------------------------------------------
http://www.enteract.com/~tqbf                         "mmm... sacrilicious"

2. TCP/IP on sco openserver

3. passwd hashing methods Re: unix crypt() vs. AIX crypt()

4. Why can't I enable cookies with Netscape Communicator 4.7 and AIX 5.1 ???

5. Does Linux support crypt(1) and crypt(3)?

6. what did patch 1.1.2->1.1.3? my scsi disk (st4702n) doesn't work anymore !

7. Perl(Crypt::DES, Crypt::IDEA)

8. Remote Shell Problems

9. Plug-Ins using C++

10. Unix Libraries Ins/Outs

11. using crypt(3C) in a C++ program on Solaris 2.6

12. crypt function library on RH 5.2

13. Frontend to library crypt()