Интегрированные сети ISDN

         

битовое число без знака. Используйте



#include <sys/time.h> /* gettimeofday() */

#include <unistd.h> /* get..() */

#include <stdio.h> /* printf() */

#include <time.h> /* clock() */

#include <sys/utsname.h> /* uname() */

#include "global.h" /* from RFC 1321 */

#include "md5.h" /* from RFC 1321 */

#define MD_CTX MD5_CTX

#define MDInit MD5Init

#define MDUpdate MD5Update

#define MDFinal MD5Final

static u_long md_32(char *string, int length)

{

MD_CTX context;

union {

char c[16];

u_long x[4];

} digest;

u_long r;

int i;

MDInit (&context);

MDUpdate (&context, string, length);

MDFinal ((unsigned char *)&digest, &context);

r = 0;

for (i = 0; i < 3; i++) {

r ^= digest.x[i];

}

return r;

} /* md_32 */

/*

* Полученный результат - 32- битовое число без знака. Используйте аргумент 'type' если вам

* нужно получить несколько разных величин подряд.

*/

u_int32 random32(int type)

{

struct {

int type;

struct timeval tv;

clock_t cpu;

pid_t pid;

u_long hid;

uid_t uid;

gid_t gid;

struct utsname name;

} s;

gettimeofday(&s.tv, 0);

uname(&s.name);

s.type = type;

s.cpu = clock();

s.pid = getpid();

s.hid = gethostid();

s.uid = getuid();

s.gid = getgid();

return md_32((char *)&s, sizeof(s));

} /* random32 */

Библиография







































[1]

D. D. Clark и D. L. Tennenhouse, "Architectural considerations for a new generation of protocols," in SIGCOMM Symposium on Communications Architectures и Protocols , (Philadelphia, Pennsylvania), pp. 200--208, IEEE, Sept. 1990. Computer Communications Review, Vol. 20(4), Sept. 1990.

[2]

D. E. Comer, Internetworking with TCP/IP , vol. 1. Englewood Cliffs, New Jersey: Prentice Hall, 1991.

[3]

Postel, J., "Internet Protocol", STD 5, RFC 791, USC/Information Sciences Institute, September 1981.

[4]

Mills, D., "Network Time Protocol Version 3", RFC 1305, UDEL, March 1992.

[5]

Reynolds, J., и J. Postel, "Assigned Numbers", STD 2, RFC 1700, USC/Information Sciences Institute, October 1994.

[6]

Eastlake, D., Crocker, S., и J. Schiller, "Randomness Recommendations for Security", RFC 1750, DEC, Cybercash, MIT, December 1994.

[7]

J.-C. Bolot, T. Turletti, и I. Wakeman, "Scalable feedback control for multicast video distribution in the internet," in SIGCOMM Symposium on Communications Architectures и Protocols, (London, England), pp. 58--67, ACM, Aug. 1994.

[8]

Balenson, D., "Privacy Enhancement for Internet Electronic Mail: Part III: Algorithms, Modes, и Identifiers", RFC 1423, TIS, IAB IRTF PSRG, IETF PEM WG, February 1993.

[9]

V. L. Voydock и S. T. Kent, "Security mechanisms in high-level network protocols," ACM Computing Surveys, vol. 15, pp. 135--171, June 1983.

[10]

Rivest, R., "The MD5 Message-Digest Algorithm", RFC 1321, MIT Laboratory for Computer Science и RSA Data Security, Inc., April 1992.

[11]

S. Stubblebine, "Security services for multimedia conferencing," in 16th National Computer Security Conference , (Baltimore, Maryland), pp. 391--395, Sept. 1993.

[12]

S. Floyd и V. Jacobson, "The synchronization of periodic routing messages," IEEE/ACM Transactions on Networking , vol. 2, pp. 122-136, April 1994.
<

Содержание  Назад  Вперед







Forekc.ru
Рефераты, дипломы, курсовые, выпускные и квалификационные работы, диссертации, учебники, учебные пособия, лекции, методические пособия и рекомендации, программы и курсы обучения, публикации из профильных изданий