[PHP4BETA] CVS update: php4/ext/mcrypt

From: Date: Sun, 25 Apr 1999 21:49:01 +0000
Subject: [PHP4BETA] CVS update: php4/ext/mcrypt
Groups: php.version4 
Request: Send a blank email to php-version4+get-531@lists.php.net to get a copy of this message
Date: Sunday April 25, 1999 @ 17:49 Author: sas Update of /repository/php4/ext/mcrypt In directory php:/tmp/cvs-serv10193 Modified Files: mcrypt.c php_mcrypt.h Log Message: final change (?), add get_algorithms_name Index: php4/ext/mcrypt/mcrypt.c diff -u php4/ext/mcrypt/mcrypt.c:1.9 php4/ext/mcrypt/mcrypt.c:1.10 --- php4/ext/mcrypt/mcrypt.c:1.9 Sun Apr 25 17:32:52 1999 +++ php4/ext/mcrypt/mcrypt.c Sun Apr 25 17:49:01 1999 @@ -42,6 +42,7 @@ PHP_FE(mcrypt_cbc, NULL) PHP_FE(mcrypt_cfb, NULL) PHP_FE(mcrypt_ofb, NULL) + PHP_FE(mcrypt_get_algorithms_name, NULL) PHP_FE(mcrypt_get_block_size, NULL) PHP_FE(mcrypt_get_key_size, NULL) PHP_FE(mcrypt_create_iv, NULL) @@ -122,8 +123,8 @@ static int php3_minit_mcrypt(INIT_FUNC_ARGS) { /* modes for mcrypt_??? routines */ - REGISTER_LONG_CONSTANT("MCRYPT_ENCODE", 0, 0); - REGISTER_LONG_CONSTANT("MCRYPT_DECODE", 1, 0); + REGISTER_LONG_CONSTANT("MCRYPT_ENCRYPT", 0, 0); + REGISTER_LONG_CONSTANT("MCRYPT_DECRYPT", 1, 0); /* sources for mcrypt_create_iv */ REGISTER_LONG_CONSTANT("MCRYPT_DEV_RANDOM", 0, 0); @@ -192,6 +193,26 @@ } } RETURN_STRINGL(iv, size->value.lval, 0); +} + +/* proto mcrypt_get_algorithms_name(int cipher) + get the name of cipher */ +PHP_FUNCTION(mcrypt_get_algorithms_name) +{ + pval *cipher; + char *str, *nstr; + + if(ARG_COUNT(ht) != 1 || getParameters(ht, 1, &cipher) == FAILURE) { + WRONG_PARAM_COUNT; + } + + convert_to_long(cipher); + + str = get_algorithms_name(cipher->value.lval); + nstr = estrdup(str); + free(str); + + RETURN_STRING(nstr, 0); } /* proto mcrypt_get_key_size(int cipher) Index: php4/ext/mcrypt/php_mcrypt.h diff -u php4/ext/mcrypt/php_mcrypt.h:1.6 php4/ext/mcrypt/php_mcrypt.h:1.7 --- php4/ext/mcrypt/php_mcrypt.h:1.6 Sun Apr 25 17:11:29 1999 +++ php4/ext/mcrypt/php_mcrypt.h Sun Apr 25 17:49:01 1999 @@ -10,6 +10,7 @@ PHP_FUNCTION(mcrypt_cbc); PHP_FUNCTION(mcrypt_cfb); PHP_FUNCTION(mcrypt_ofb); +PHP_FUNCTION(mcrypt_get_algorithms_name); PHP_FUNCTION(mcrypt_get_block_size); PHP_FUNCTION(mcrypt_get_key_size); PHP_FUNCTION(mcrypt_create_iv); -- PHP 4 Beta

« previous php.version4 (#531) next »