CVS update: php3/functions
| From: | fmk | Date: | Mon, 01 Feb 1999 07:44:10 +0000 |
| Subject: | CVS update: php3/functions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-3820@lists.php.net to get a copy of this message | ||
Date: Monday February 1, 1999 @ 2:44
Author: fmk
Update of /repository/php3/functions
In directory asf:/u/temp/cvs-serv11263
Modified Files:
md5.c md5.h
Log Message:
Making the md5() function callable from other modules
Index: php3/functions/md5.c
diff -c php3/functions/md5.c:1.35 php3/functions/md5.c:1.36
*** php3/functions/md5.c:1.35 Fri Jan 1 12:59:13 1999
--- php3/functions/md5.c Mon Feb 1 02:44:07 1999
***************
*** 27,33 ****
+----------------------------------------------------------------------+
*/
! /* $Id: md5.c,v 1.35 1999/01/01 17:59:13 zeev Exp $ */
/*
* md5.c - Copyright 1997 Lachlan Roche
--- 27,33 ----
+----------------------------------------------------------------------+
*/
! /* $Id: md5.c,v 1.36 1999/02/01 07:44:07 fmk Exp $ */
/*
* md5.c - Copyright 1997 Lachlan Roche
***************
*** 42,63 ****
#include "md5.h"
! /* {{{ proto string md5(string str)
! Calculate the md5 hash of a string */
! void php3_md5(INTERNAL_FUNCTION_PARAMETERS)
{
- pval *arg;
- char md5str[33];
PHP3_MD5_CTX context;
unsigned char digest[16];
int i;
char *r;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(arg);
md5str[0] = '\0';
PHP3_MD5Init(&context);
--- 42,53 ----
#include "md5.h"
! PHPAPI void _php3_md5(pval *arg, char *md5str)
{
PHP3_MD5_CTX context;
unsigned char digest[16];
int i;
char *r;
md5str[0] = '\0';
PHP3_MD5Init(&context);
***************
*** 67,72 ****
--- 57,79 ----
sprintf(r, "%02x", digest[i]);
}
*r = '\0';
+ }
+
+ /* {{{ proto string md5(string str)
+ Calculate the md5 hash of a string */
+ void php3_md5(INTERNAL_FUNCTION_PARAMETERS)
+ {
+ char md5str[33];
+ pval *arg;
+ TLS_VARS;
+
+ if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+ convert_to_string(arg);
+
+ _php3_md5(arg, md5str);
+
RETVAL_STRING(md5str,1);
}
/* }}} */
Index: php3/functions/md5.h
diff -c php3/functions/md5.h:1.13 php3/functions/md5.h:1.14
*** php3/functions/md5.h:1.13 Fri Jan 1 12:59:13 1999
--- php3/functions/md5.h Mon Feb 1 02:44:10 1999
***************
*** 27,33 ****
+----------------------------------------------------------------------+
*/
! /* $Id: md5.h,v 1.13 1999/01/01 17:59:13 zeev Exp $ */
#ifndef _md5_h
#define _md5_h
--- 27,33 ----
+----------------------------------------------------------------------+
*/
! /* $Id: md5.h,v 1.14 1999/02/01 07:44:10 fmk Exp $ */
#ifndef _md5_h
#define _md5_h
***************
*** 69,74 ****
void PHP3_MD5Update PROTO_LIST((PHP3_MD5_CTX *, const unsigned char *, unsigned int));
void PHP3_MD5Final PROTO_LIST((unsigned char[16], PHP3_MD5_CTX *));
extern void php3_md5(INTERNAL_FUNCTION_PARAMETERS);
-
#endif
--- 69,74 ----
void PHP3_MD5Update PROTO_LIST((PHP3_MD5_CTX *, const unsigned char *, unsigned int));
void PHP3_MD5Final PROTO_LIST((unsigned char[16], PHP3_MD5_CTX *));
+ PHPAPI void _php3_md5(pval *arg, char *md5str);
extern void php3_md5(INTERNAL_FUNCTION_PARAMETERS);
#endif
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net