/* * Copyright (C) 2006 Richard Kotal * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ static int ns_mhash_IsHashObj (Tcl_Obj * obj, char *name) { int ret = NS_FALSE; if (obj == NULL || name == NULL) return ret; if (obj->length == 0) return ret; if (obj->bytes == NULL) return ret; if (!STREQ (obj->bytes, name)) return ret; return NS_TRUE; } static int ns_mhash_GetHashId (char *name) { int id = -1; size_t len = 0; int i = 0; __const mutils_word8 *hash = NULL; if (name == NULL) return id; len = mhash_count (); for (i = 0; i <= len; i++) { hash = mhash_get_hash_name_static (i); if (hash == NULL) continue; if (strcasecmp (hash, name) == 0) { id = i; break; } } return id; } static int ns_mhash_GetKeygenId (char *name) { int id = -1; size_t len = 0; int i = 0; __const mutils_word8 *algo = NULL; if (name == NULL) return id; len = mhash_keygen_count (); for (i = 0; i <= len; i++) { algo = mhash_get_keygen_name_static (i); if (algo == NULL) continue; if (strcasecmp (algo, name) == 0) { id = i; break; } } return id; }