1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
<html>
<head>
<title>~/src/firstworks/rudiments-0.31/include/rudiments/crypt.h.html</title>
<meta name="Generator" content="Vim/7.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="#ffffff" text="#000000">
<pre>
<font color="#0000ff">// Copyright (c) 2004 David Muse</font>
<font color="#0000ff">// See the COPYING file for more information.</font>
<font color="#a020f0">#ifndef RUDIMENTS_CRYPT_H</font>
<font color="#a020f0">#define RUDIMENTS_CRYPT_H</font>
<font color="#a020f0">#include </font><font color="#ff00ff"><rudiments/private/cryptincludes.h></font>
<font color="#0000ff">// The crypt class provides a method that is useful for password encryption.</font>
<font color="#a020f0">#ifdef RUDIMENTS_NAMESPACE</font>
<font color="#2e8b57"><b>namespace</b></font> rudiments {
<font color="#a020f0">#endif</font>
<font color="#2e8b57"><b>class</b></font> crypt {
<font color="#a52a2a"><b>public</b></font>:
<font color="#2e8b57"><b>static</b></font> <font color="#2e8b57"><b>char</b></font> *encrypt(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *password,
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *salt);
<font color="#0000ff">// Encrypts "password" using the des algorithm</font>
<font color="#0000ff">// and "salt" (which should be a 2 character</font>
<font color="#0000ff">// string from the set [a-zA-Z0-9./].</font>
<font color="#0000ff">//</font>
<font color="#0000ff">// Returns the encrypted password on success</font>
<font color="#0000ff">// or NULL on failure.</font>
<font color="#0000ff">//</font>
<font color="#0000ff">// Note that this method allocates a buffer</font>
<font color="#0000ff">// internally and returns it. The calling</font>
<font color="#0000ff">// program must deallocate this buffer.</font>
<font color="#2e8b57"><b>static</b></font> <font color="#2e8b57"><b>bool</b></font> needsMutex();
<font color="#0000ff">// If your system doesn't support crypt_r() then this</font>
<font color="#0000ff">// class needs a mutex to assure thread safety.</font>
<font color="#0000ff">//</font>
<font color="#0000ff">// This method returns true if this class needs a mutex</font>
<font color="#0000ff">// to operate safely in a threaded environment and false</font>
<font color="#0000ff">// otherwise.</font>
<font color="#2e8b57"><b>static</b></font> <font color="#2e8b57"><b>void</b></font> setMutex(mutex *mtx);
<font color="#0000ff">// Allows you to supply a mutex is the class needs it.</font>
<font color="#0000ff">// If your application is not multithreaded, then</font>
<font color="#0000ff">// there is no need to supply a mutex.</font>
<font color="#a020f0"> #include </font><font color="#ff00ff"><rudiments/private/crypt.h></font>
};
<font color="#a020f0">#ifdef RUDIMENTS_NAMESPACE</font>
}
<font color="#a020f0">#endif</font>
<font color="#a020f0">#endif</font>
</pre>
</body>
</html>
|