xref: /illumos-gate/usr/src/lib/gss_mechs/mech_krb5/krb5/rcache/rc_common.c (revision 581cede61ac9c14d8d4ea452562a567189eead78)
1 /*
2  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 #pragma ident	"%Z%%M%	%I%	%E% SMI"
7 
8 /*
9  * lib/krb5/rcache/rc_common.c
10  *
11  * This file of the Kerberos V5 software is derived from public-domain code
12  * contributed by Daniel J. Bernstein, <brnstnd@acf10.nyu.edu>.
13  *
14  */
15 
16 /*
17  * An implementation for the common replay cache functions.
18  */
19 #include "rc_common.h"
20 
21 /*
22  * Local stuff:
23  *
24  * static int hash(krb5_donot_replay *rep, int hsize)
25  *  returns hash value of *rep, between 0 and hsize - 1
26  */
27 
28 int
29 hash(krb5_donot_replay *rep, int hsize)
30 {
31 	return ((int)((((rep->cusec + rep->ctime + *rep->server + *rep->client)
32 	    % hsize) + hsize) % hsize));
33 }
34