Compare commits

..
375 changed files with 8782 additions and 110408 deletions

No files matched your search

-2
View File
@@ -1,2 +0,0 @@
Bzip2
Sterling Hughes
-529
View File
@@ -1,529 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP version 4.0 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 2.02 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available at through the world-wide-web at |
| http://www.php.net/license/2_02.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Sterling Hughes <sterling@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "php.h"
#include "php_bz2.h"
#if HAVE_BZ2
/* PHP Includes */
#include "ext/standard/file.h"
#include "ext/standard/info.h"
#include "ext/standard/php_string.h"
/* for fileno() */
#include <stdio.h>
/* Internal error constants */
#define PHP_BZ_ERRNO 0
#define PHP_BZ_ERRSTR 1
#define PHP_BZ_ERRBOTH 2
/* Blocksize of the decompression buffer */
#define PHP_BZ_DECOMPRESS_SIZE 4096
function_entry bz2_functions[] = {
PHP_FE(bzopen, NULL)
PHP_FE(bzread, NULL)
PHP_FALIAS(bzwrite, fwrite, NULL)
PHP_FALIAS(bzflush, fflush, NULL)
PHP_FALIAS(bzclose, fclose, NULL)
PHP_FE(bzerrno, NULL)
PHP_FE(bzerrstr, NULL)
PHP_FE(bzerror, NULL)
PHP_FE(bzcompress, NULL)
PHP_FE(bzdecompress, NULL)
{NULL, NULL, NULL}
};
zend_module_entry bz2_module_entry = {
STANDARD_MODULE_HEADER,
"bz2",
bz2_functions,
PHP_MINIT(bz2),
PHP_MSHUTDOWN(bz2),
NULL,
NULL,
PHP_MINFO(bz2),
NO_VERSION_YET,
STANDARD_MODULE_PROPERTIES
};
#ifdef COMPILE_DL_BZ2
ZEND_GET_MODULE(bz2)
#endif
struct php_bz2_stream_data_t {
BZFILE *bz_file;
php_stream *stream;
};
/* {{{ BZip2 stream implementation */
static size_t php_bz2iop_read(php_stream *stream, char *buf, size_t count TSRMLS_DC)
{
struct php_bz2_stream_data_t *self = (struct php_bz2_stream_data_t *) stream->abstract;
size_t ret;
ret = BZ2_bzread(self->bz_file, buf, count);
if (ret == 0) {
stream->eof = 1;
}
return ret;
}
static size_t php_bz2iop_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC)
{
struct php_bz2_stream_data_t *self = (struct php_bz2_stream_data_t *) stream->abstract;
return BZ2_bzwrite(self->bz_file, (char*)buf, count);
}
static int php_bz2iop_close(php_stream *stream, int close_handle TSRMLS_DC)
{
struct php_bz2_stream_data_t *self = (struct php_bz2_stream_data_t *)stream->abstract;
int ret = EOF;
if (close_handle) {
BZ2_bzclose(self->bz_file);
}
if (self->stream) {
php_stream_free(self->stream, PHP_STREAM_FREE_CLOSE | (close_handle == 0 ? PHP_STREAM_FREE_PRESERVE_HANDLE : 0));
}
efree(self);
return ret;
}
static int php_bz2iop_flush(php_stream *stream TSRMLS_DC)
{
struct php_bz2_stream_data_t *self = (struct php_bz2_stream_data_t *)stream->abstract;
return BZ2_bzflush(self->bz_file);
}
/* }}} */
php_stream_ops php_stream_bz2io_ops = {
php_bz2iop_write, php_bz2iop_read,
php_bz2iop_close, php_bz2iop_flush,
"BZip2",
NULL, /* seek */
NULL, /* cast */
NULL, /* stat */
NULL /* set_option */
};
/* {{{ Bzip2 stream openers */
PHP_BZ2_API php_stream *_php_stream_bz2open_from_BZFILE(BZFILE *bz,
char *mode, php_stream *innerstream STREAMS_DC TSRMLS_DC)
{
struct php_bz2_stream_data_t *self;
self = emalloc(sizeof(*self));
self->stream = innerstream;
self->bz_file = bz;
return php_stream_alloc_rel(&php_stream_bz2io_ops, self, 0, mode);
}
PHP_BZ2_API php_stream *_php_stream_bz2open(php_stream_wrapper *wrapper,
char *path,
char *mode,
int options,
char **opened_path,
php_stream_context *context STREAMS_DC TSRMLS_DC)
{
php_stream *retstream = NULL, *stream = NULL;
char *path_copy = NULL;
BZFILE *bz_file = NULL;
if (strncasecmp("compress.bzip2://", path, 17) == 0) {
path += 17;
}
#ifdef VIRTUAL_DIR
virtual_filepath(path, &path_copy TSRMLS_CC);
#else
path_copy = path;
#endif
/* try and open it directly first */
bz_file = BZ2_bzopen(path_copy, mode);
if (opened_path && bz_file) {
*opened_path = estrdup(path_copy);
}
path_copy = NULL;
if (bz_file == NULL) {
/* that didn't work, so try and get something from the network/wrapper */
stream = php_stream_open_wrapper(path, mode, options, opened_path);
if (stream) {
int fd;
if (SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD, (void **) &fd, REPORT_ERRORS)) {
bz_file = BZ2_bzdopen(fd, mode);
}
}
}
if (bz_file) {
retstream = _php_stream_bz2open_from_BZFILE(bz_file, mode, stream STREAMS_REL_CC TSRMLS_CC);
if (retstream) {
return retstream;
}
BZ2_bzclose(bz_file);
}
if (stream) {
php_stream_close(stream);
}
return NULL;
}
/* }}} */
static php_stream_wrapper_ops bzip2_stream_wops = {
_php_stream_bz2open,
NULL, /* close */
NULL, /* fstat */
NULL, /* stat */
NULL, /* opendir */
"BZip2",
NULL /* unlink */
};
php_stream_wrapper php_stream_bzip2_wrapper = {
&bzip2_stream_wops,
NULL,
0 /* is_url */
};
static void php_bz2_error(INTERNAL_FUNCTION_PARAMETERS, int);
PHP_MINIT_FUNCTION(bz2)
{
php_register_url_stream_wrapper("compress.bzip2", &php_stream_bzip2_wrapper TSRMLS_CC);
return SUCCESS;
}
PHP_MSHUTDOWN_FUNCTION(bz2)
{
php_unregister_url_stream_wrapper("compress.bzip2" TSRMLS_CC);
return SUCCESS;
}
PHP_MINFO_FUNCTION(bz2)
{
php_info_print_table_start();
php_info_print_table_row(2, "BZip2 Support", "Enabled");
php_info_print_table_row(2, "BZip2 Version", (char *) BZ2_bzlibVersion());
php_info_print_table_end();
}
/* {{{ proto string bzread(int bz[, int length])
Reads up to length bytes from a BZip2 stream, or 1024 bytes if length is not specified */
PHP_FUNCTION(bzread)
{
zval *bz;
long len = 1024;
php_stream *stream;
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &bz, &len)) {
RETURN_FALSE;
}
php_stream_from_zval(stream, &bz);
if (len < 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "length may not be negative");
RETURN_FALSE;
}
Z_STRVAL_P(return_value) = emalloc(len + 1);
Z_STRLEN_P(return_value) = php_stream_read(stream, Z_STRVAL_P(return_value), len);
if (Z_STRLEN_P(return_value) < 0) {
efree(Z_STRVAL_P(return_value));
php_error_docref(NULL TSRMLS_CC, E_WARNING, "could not read valid bz2 data from stream");
RETURN_FALSE;
}
Z_STRVAL_P(return_value)[Z_STRLEN_P(return_value)] = 0;
if (PG(magic_quotes_runtime)) {
Z_STRVAL_P(return_value) = php_addslashes( Z_STRVAL_P(return_value),
Z_STRLEN_P(return_value),
&Z_STRLEN_P(return_value), 1 TSRMLS_CC);
}
Z_TYPE_P(return_value) = IS_STRING;
}
/* }}} */
/* {{{ proto resource bzopen(string|int file|fp, string mode)
Opens a new BZip2 stream */
PHP_FUNCTION(bzopen)
{
zval **file, /* The file to open */
**mode; /* The mode to open the stream with */
BZFILE *bz; /* The compressed file stream */
php_stream *stream = NULL;
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &file, &mode) == FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_string_ex(mode);
/* If it's not a resource its a string containing the filename to open */
if (Z_TYPE_PP(file) != IS_RESOURCE) {
convert_to_string_ex(file);
stream = php_stream_bz2open(NULL,
Z_STRVAL_PP(file),
Z_STRVAL_PP(mode),
ENFORCE_SAFE_MODE | REPORT_ERRORS,
NULL);
} else {
/* If it is a resource, than its a stream resource */
int fd;
php_stream_from_zval(stream, file);
if (FAILURE == php_stream_cast(stream, PHP_STREAM_AS_FD, (void *) &fd, REPORT_ERRORS)) {
RETURN_FALSE;
}
bz = BZ2_bzdopen(fd, Z_STRVAL_PP(mode));
stream = php_stream_bz2open_from_BZFILE(bz, Z_STRVAL_PP(mode), stream);
}
if (stream) {
php_stream_to_zval(stream, return_value);
} else {
RETURN_FALSE;
}
}
/* }}} */
/* {{{ proto int bzerrno(resource bz)
Returns the error number */
PHP_FUNCTION(bzerrno)
{
php_bz2_error(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_BZ_ERRNO);
}
/* }}} */
/* {{{ proto string bzerrstr(resource bz)
Returns the error string */
PHP_FUNCTION(bzerrstr)
{
php_bz2_error(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_BZ_ERRSTR);
}
/* }}} */
/* {{{ proto array bzerror(resource bz)
Returns the error number and error string in an associative array */
PHP_FUNCTION(bzerror)
{
php_bz2_error(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_BZ_ERRBOTH);
}
/* }}} */
/* {{{ proto string bzcompress(string source [, int blocksize100k [, int workfactor]])
Compresses a string into BZip2 encoded data */
PHP_FUNCTION(bzcompress)
{
zval **source, /* Source data to compress */
**zblock_size, /* Optional block size to use */
**zwork_factor; /* Optional work factor to use */
char *dest = NULL; /* Destination to place the compressed data into */
int error, /* Error Container */
block_size = 4, /* Block size for compression algorithm */
work_factor = 0, /* Work factor for compression algorithm */
argc; /* Argument count */
unsigned int source_len, /* Length of the source data */
dest_len; /* Length of the destination buffer */
argc = ZEND_NUM_ARGS();
if (argc < 1 || argc > 3 || zend_get_parameters_ex(argc, &source, &zblock_size, &zwork_factor) == FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_string_ex(source);
/* Assign them to easy to use variables, dest_len is initially the length of the data
+ .01 x length of data + 600 which is the largest size the results of the compression
could possibly be, at least that's what the libbz2 docs say (thanks to jeremy@nirvani.net
for pointing this out). */
source_len = Z_STRLEN_PP(source);
dest_len = Z_STRLEN_PP(source) + (0.01 * Z_STRLEN_PP(source)) + 600;
/* Allocate the destination buffer */
dest = emalloc(dest_len + 1);
/* Handle the optional arguments */
if (argc > 1) {
convert_to_long_ex(zblock_size);
block_size = Z_LVAL_PP(zblock_size);
}
if (argc > 2) {
convert_to_long_ex(zwork_factor);
work_factor = Z_LVAL_PP(zwork_factor);
}
error = BZ2_bzBuffToBuffCompress(dest, &dest_len, Z_STRVAL_PP(source), source_len, block_size, 0, work_factor);
if (error != BZ_OK) {
efree(dest);
RETURN_LONG(error);
} else {
/* Copy the buffer, we have perhaps allocate alot more than we need,
so we erealloc() the buffer to the proper size */
dest = erealloc(dest, dest_len + 1);
dest[dest_len] = 0;
RETURN_STRINGL(dest, dest_len, 0);
}
}
/* }}} */
/* {{{ proto string bzdecompress(string source [, int small])
Decompresses BZip2 compressed data */
PHP_FUNCTION(bzdecompress)
{
zval **source, /* Source data to decompress */
**zsmall; /* (Optional) user specified small */
char *dest; /* Destination buffer, initially allocated */
int error, /* Error container */
iter = 1, /* Iteration count for the compression loop */
size, /* Current size to realloc the dest buffer to */
dest_len = PHP_BZ_DECOMPRESS_SIZE, /* Size of the destination length */
small = 0, /* The actual small */
argc = ZEND_NUM_ARGS(); /* Argument count */
if (argc < 1 || argc > 2 || zend_get_parameters_ex(argc, &source, &zsmall) == FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_string_ex(source);
/* optional small argument handling */
if (argc > 1) {
convert_to_long_ex(zsmall);
small = Z_LVAL_PP(zsmall);
}
/* Depending on the size of the source buffer, either allocate
the length of the source buffer or the a default decompression
size */
dest = emalloc(PHP_BZ_DECOMPRESS_SIZE > Z_STRLEN_PP(source) ? PHP_BZ_DECOMPRESS_SIZE : Z_STRLEN_PP(source));
/* (de)Compression Loop */
do {
/* Handle the (re)allocation of the buffer */
size = dest_len * iter;
if (iter > 1) {
dest = erealloc(dest, size);
}
++iter;
/* Perform the decompression */
error = BZ2_bzBuffToBuffDecompress(dest, &size, Z_STRVAL_PP(source), Z_STRLEN_PP(source), small, 0);
} while (error == BZ_OUTBUFF_FULL);
if (error != BZ_OK) {
efree(dest);
RETURN_LONG(error);
} else {
/* we might have allocated a little to much, so erealloc the buffer
down to size, before returning it */
dest = erealloc(dest, size + 1);
dest[size] = 0;
RETURN_STRINGL(dest, size, 0);
}
}
/* }}} */
/* {{{ php_bz2_error()
The central error handling interface, does the work for bzerrno, bzerrstr and bzerror */
static void php_bz2_error(INTERNAL_FUNCTION_PARAMETERS, int opt)
{
zval **bzp; /* BZip2 Resource Pointer */
php_stream *stream;
const char *errstr; /* Error string */
int errnum; /* Error number */
struct php_bz2_stream_data_t *self;
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &bzp) == FAILURE) {
WRONG_PARAM_COUNT;
}
php_stream_from_zval(stream, bzp);
if (!php_stream_is(stream, PHP_STREAM_IS_BZIP2)) {
RETURN_FALSE;
}
self = (struct php_bz2_stream_data_t *) stream->abstract;
/* Fetch the error information */
errstr = BZ2_bzerror(self->bz_file, &errnum);
/* Determine what to return */
switch (opt) {
case PHP_BZ_ERRNO:
RETURN_LONG(errnum);
break;
case PHP_BZ_ERRSTR:
RETURN_STRING((char*)errstr, 1);
break;
case PHP_BZ_ERRBOTH:
array_init(return_value);
add_assoc_long (return_value, "errno", errnum);
add_assoc_string(return_value, "errstr", (char*)errstr, 1);
break;
}
}
/* }}} */
#endif
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: fdm=marker
* vim: noet sw=4 ts=4
*/
-108
View File
@@ -1,108 +0,0 @@
# Microsoft Developer Studio Project File - Name="bz2" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=bz2 - Win32 Debug_TS
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "bz2.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "bz2.mak" CFG="bz2 - Win32 Debug_TS"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "bz2 - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "bz2 - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "bz2 - Win32 Release_TS"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release_TS"
# PROP BASE Intermediate_Dir "Release_TS"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release_TS"
# PROP Intermediate_Dir "Release_TS"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BZ2_EXPORTS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\php_build\includes" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_BZ2" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_BZ2=1 /D "PHP_BZ2_EXPORTS" /FR /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x407 /d "NDEBUG"
# ADD RSC /l 0x407 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 libbz2.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_bz2.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" /libpath:"..\..\..\php_build\release"
!ELSEIF "$(CFG)" == "bz2 - Win32 Debug_TS"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug_TS"
# PROP BASE Intermediate_Dir "Debug_TS"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug_TS"
# PROP Intermediate_Dir "Debug_TS"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BZ2_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\php_build\includes" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_BZ2" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_BZ2=1 /D "PHP_BZ2_EXPORTS" /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x407 /d "_DEBUG"
# ADD RSC /l 0x407 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 php4ts_debug.lib libbz2.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_bz2.dll" /pdbtype:sept /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\release"
!ENDIF
# Begin Target
# Name "bz2 - Win32 Release_TS"
# Name "bz2 - Win32 Debug_TS"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\bz2.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\php_bz2.h
# End Source File
# End Group
# End Target
# End Project
-33
View File
@@ -1,33 +0,0 @@
dnl
dnl $Id$
dnl
PHP_ARG_WITH(bz2, for BZip2 support,
[ --with-bz2[=DIR] Include BZip2 support])
if test "$PHP_BZ2" != "no"; then
if test -r $PHP_BZ2/include/bzlib.h; then
BZIP_DIR=$PHP_BZ2
else
AC_MSG_CHECKING(for BZip2 in default path)
for i in /usr/local /usr; do
if test -r $i/include/bzlib.h; then
BZIP_DIR=$i
AC_MSG_RESULT(found in $i)
fi
done
fi
if test -z "$BZIP_DIR"; then
AC_MSG_RESULT(not found)
AC_MSG_ERROR(Please reinstall the BZip2 distribution)
fi
PHP_ADD_INCLUDE($BZIP_DIR/include)
PHP_SUBST(BZ2_SHARED_LIBADD)
PHP_ADD_LIBRARY_WITH_PATH(bz2, $BZIP_DIR/lib, BZ2_SHARED_LIBADD)
AC_CHECK_LIB(bz2, BZ2_bzerror, [AC_DEFINE(HAVE_BZ2,1,[ ])], [AC_MSG_ERROR(bz2 module requires libbz2 >= 1.0.0)],)
PHP_NEW_EXTENSION(bz2, bz2.c, $ext_shared)
fi
-35
View File
@@ -1,35 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!-- do not use the "Type" attribute here, that one is only for
generated package.xml files -->
<package>
<name>bz2</name>
<summary>A Bzip2 management extension</summary>
<description>
Bz2 is an extension to create and parse bzip2 compressed data.
</description>
<license>PHP License</license>
<maintainers>
<maintainer>
<user>sterling</user>
<name>Sterling Hughes</name>
<email>sterling@php.net</email>
</maintainer>
</maintainers>
<release>
<version>1.0</version>
<date>2003-05-17</date>
<state>stable</state>
<notes>
Initial Release in PECL
</notes>
</release>
<filelist>
<dir role="src" name="/">
<file role="doc">CREDITS</file>
<file role="src">config.m4</file>
<file role="doc">php_bz2.h</file>
<file role="src">bz2.c</file>
<file role="src">bz2.dsp</file>
</dir>
</filelist>
</package>
-72
View File
@@ -1,72 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 2.02 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available at through the world-wide-web at |
| http://www.php.net/license/2_02.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Sterling Hughes <sterling@php.net> |
+----------------------------------------------------------------------+
*/
#ifndef PHP_BZ2_H
#define PHP_BZ2_H
#if HAVE_BZ2
extern zend_module_entry bz2_module_entry;
#define phpext_bz2_ptr &bz2_module_entry
/* Bzip2 includes */
#include <bzlib.h>
PHP_MINIT_FUNCTION(bz2);
PHP_MSHUTDOWN_FUNCTION(bz2);
PHP_MINFO_FUNCTION(bz2);
PHP_FUNCTION(bzopen);
PHP_FUNCTION(bzread);
PHP_FUNCTION(bzerrno);
PHP_FUNCTION(bzerrstr);
PHP_FUNCTION(bzerror);
PHP_FUNCTION(bzcompress);
PHP_FUNCTION(bzdecompress);
#else
#define phpext_bz2_ptr NULL
#endif
#ifdef PHP_WIN32
# ifdef PHP_BZ2_EXPORTS
# define PHP_BZ2_API __declspec(dllexport)
# else
# define PHP_BZ2_API __declspec(dllimport)
# endif
#else
# define PHP_BZ2_API
#endif
PHP_BZ2_API PHPAPI php_stream *_php_stream_bz2open(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC);
PHP_BZ2_API PHPAPI php_stream *_php_stream_bz2open_from_BZFILE(BZFILE *bz, char *mode, php_stream *innerstream STREAMS_DC TSRMLS_DC);
#define php_stream_bz2open_from_BZFILE(bz, mode, innerstream) _php_stream_bz2open_from_BZFILE((bz), (mode), (innerstream) STREAMS_CC TSRMLS_CC)
#define php_stream_bz2open(wrapper, path, mode, options, opened_path) _php_stream_bz2open((wrapper), (path), (mode), (options), (opened_path), NULL STREAMS_CC TSRMLS_CC)
php_stream_ops php_stream_bz2io_ops;
#define PHP_STREAM_IS_BZIP2 &php_stream_bz2io_ops
#endif
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
*/
-2
View File
@@ -1,2 +0,0 @@
enchant
Pierre-Alain Joye, Ilia Alshanetsky
-36
View File
@@ -1,36 +0,0 @@
dnl
dnl $Id$
dnl
PHP_ARG_WITH(enchant,for ENCHANT support,
[ --with-enchant[=DIR] Include enchant support.
GNU Aspell version 1.1.3 or higher required.])
if test "$PHP_ENCHANT" != "no"; then
PHP_NEW_EXTENSION(enchant, enchant.c, $ext_shared)
if test "$PHP_ENCHANT" != "yes"; then
ENCHANT_SEARCH_DIRS=$PHP_ENCHANT
else
ENCHANT_SEARCH_DIRS="/usr/local /usr"
fi
for i in $ENCHANT_SEARCH_DIRS; do
if test -f $i/include/enchant/enchant.h; then
ENCHANT_DIR=$i
ENCHANT_INCDIR=$i/include/enchant
elif test -f $i/include/enchant.h; then
ENCHANT_DIR=$i
ENCHANT_INCDIR=$i/include
fi
done
if test -z "$ENCHANT_DIR"; then
AC_MSG_ERROR(Cannot find enchant)
fi
ENCHANT_LIBDIR=$ENCHANT_DIR/lib
AC_DEFINE(HAVE_ENCHANT,1,[ ])
PHP_SUBST(ENCHANT_SHARED_LIBADD)
PHP_ADD_LIBRARY_WITH_PATH(enchant, $ENCHANT_LIBDIR, ENCHANT_SHARED_LIBADD)
PHP_ADD_INCLUDE($ENCHANT_INCDIR)
fi
-13
View File
@@ -1,13 +0,0 @@
// $Id$
// vim:ft=javascript
ARG_ENABLE("enchant", "Enchant Support", "no");
if (PHP_ENCHANT == "yes") {
if (CHECK_HEADER_ADD_INCLUDE("enchant.h", "CFLAGS_ENCHANT", PHP_ENCHANT)) {
EXTENSION("enchant", "enchant.c");
AC_DEFINE('HAVE_ENCHANT', 1, 'Have Enchant support', false);
} else {
WARNING('Could not find enchant.h; skipping');
}
}
-25
View File
@@ -1,25 +0,0 @@
<?php
$tag = 'en_US';
$r = enchant_broker_init();
$bprovides = enchant_broker_describe($r);
echo "Current broker provides the following backend(s):\n";
print_r($bprovides);
if (enchant_broker_dict_exists($r,$tag)) {
$d = enchant_broker_request_dict($r, $tag);
$dprovides = enchant_dict_describe($d);
echo "dictionary $tag provides:\n";
$spellerrors = enchant_dict_check($d, "soong");
print_r($dprovides);
echo "found $spellerrors spell errors\n";
if ($spellerrors) {
$suggs = enchant_dict_suggest($d, "soong");
echo "Suggestions for 'soong':";
print_r($suggs);
}
enchant_broker_free_dict($d);
} else {
}
enchant_broker_free($r);
?>
-731
View File
@@ -1,731 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2004 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available at through the world-wide-web at |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Pierre-Alain Joye <paj@pearfr.org> |
| Ilia Alshanetsky <ilia@prohost.org> |
+----------------------------------------------------------------------+
$Id$
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "enchant.h"
#include "php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
#include "php_enchant.h"
typedef EnchantBroker * EnchantBrokerPtr;
typedef struct _broker_struct enchant_broker;
typedef struct _dict_struct enchant_dict;
typedef enchant_broker * enchant_brokerPtr;
typedef enchant_dict * enchant_dictPtr;
typedef struct _broker_struct {
EnchantBroker *pbroker;
enchant_dict **dict;
unsigned int dictcnt;
zval *rsrc_id;
} _enchant_broker;
typedef struct _dict_struct {
unsigned int id;
EnchantDict *pdict;
enchant_broker *pbroker;
zval *rsrc_id;
enchant_dict *next;
enchant_dict *prev;
} _enchant_dict;
/* True global resources - no need for thread safety here */
static int le_enchant_broker;
static int le_enchant_dict;
/* If you declare any globals in php_enchant.h uncomment this:*/
/*ZEND_DECLARE_MODULE_GLOBALS(enchant)*/
/* {{{ enchant_functions[]
*
* Every user visible function must have an entry in enchant_functions[].
*/
function_entry enchant_functions[] = {
PHP_FE(enchant_broker_init, NULL)
PHP_FE(enchant_broker_free, NULL)
PHP_FE(enchant_broker_get_error, NULL)
PHP_FE(enchant_broker_request_dict, NULL)
PHP_FE(enchant_broker_request_pwl_dict, NULL)
PHP_FE(enchant_broker_free_dict, NULL)
PHP_FE(enchant_broker_dict_exists, NULL)
PHP_FE(enchant_broker_set_ordering, NULL)
PHP_FE(enchant_broker_describe, NULL)
PHP_FE(enchant_dict_check, NULL)
PHP_FE(enchant_dict_suggest, NULL)
PHP_FE(enchant_dict_add_to_personal, NULL)
PHP_FE(enchant_dict_add_to_session, NULL)
PHP_FE(enchant_dict_is_in_session, NULL)
PHP_FE(enchant_dict_store_replacement, NULL)
PHP_FE(enchant_dict_get_error, NULL)
PHP_FE(enchant_dict_describe, NULL)
PHP_FE(enchant_dict_quick_check, third_arg_force_ref)
{NULL, NULL, NULL} /* Must be the last line in enchant_functions[] */
};
/* }}} */
/* {{{ enchant_module_entry
*/
zend_module_entry enchant_module_entry = {
#if ZEND_MODULE_API_NO >= 20010901
STANDARD_MODULE_HEADER,
#endif
"enchant",
enchant_functions,
PHP_MINIT(enchant),
PHP_MSHUTDOWN(enchant),
NULL, /* Replace with NULL if there's nothing to do at request start */
NULL, /* Replace with NULL if there's nothing to do at request end */
PHP_MINFO(enchant),
#if ZEND_MODULE_API_NO >= 20010901
"0.1", /* Replace with version number for your extension */
#endif
STANDARD_MODULE_PROPERTIES
};
/* }}} */
#ifdef COMPILE_DL_ENCHANT
ZEND_GET_MODULE(enchant)
#endif
static void
enumerate_providers_fn (const char * const name,
const char * const desc,
const char * const file,
void * ud)
{
zval *zdesc = (zval *) ud;
zval *tmp_array;
MAKE_STD_ZVAL(tmp_array);
array_init(tmp_array);
add_assoc_string(tmp_array, "name", (char *)name, 1);
add_assoc_string(tmp_array, "desc", (char *)desc, 1);
add_assoc_string(tmp_array, "file", (char *)file, 1);
if (Z_TYPE_P(zdesc)!=IS_ARRAY) {
array_init(zdesc);
}
add_next_index_zval(zdesc, tmp_array);
}
static void
describe_dict_fn (const char * const lang,
const char * const name,
const char * const desc,
const char * const file,
void * ud)
{
zval *zdesc = (zval *) ud;
array_init(zdesc);
add_assoc_string(zdesc, "lang", (char *)lang, 1);
add_assoc_string(zdesc, "name", (char *)name, 1);
add_assoc_string(zdesc, "desc", (char *)desc, 1);
add_assoc_string(zdesc, "file", (char *)file, 1);
}
static void php_enchant_broker_free(zend_rsrc_list_entry *rsrc TSRMLS_DC)
{
if (rsrc->ptr) {
enchant_broker *broker = (enchant_broker *)rsrc->ptr;
if (broker) {
if (broker->pbroker) {
if (broker->dictcnt && broker->dict) {
if (broker->dict) {
int total, tofree;
tofree = total = broker->dictcnt-1;
do {
zend_list_delete(Z_RESVAL_P(broker->dict[total]->rsrc_id));
efree(broker->dict[total]);
total--;
} while (total>=0);
}
efree(broker->dict);
broker->dict = NULL;
}
enchant_broker_free(broker->pbroker);
}
efree(broker);
}
}
}
static void php_enchant_dict_free(zend_rsrc_list_entry *rsrc TSRMLS_DC)
{
if (rsrc->ptr) {
enchant_dict *pdict = (enchant_dict *)rsrc->ptr;
if (pdict) {
if (pdict->pdict && pdict->pbroker) {
enchant_broker_free_dict(pdict->pbroker->pbroker, pdict->pdict);
}
if (pdict->id) {
pdict->pbroker->dict[pdict->id-1]->next = NULL;
}
}
}
}
/* {{{ PHP_MINIT_FUNCTION
*/
PHP_MINIT_FUNCTION(enchant)
{
le_enchant_broker = zend_register_list_destructors_ex(php_enchant_broker_free, NULL, "enchant broker", module_number);
le_enchant_dict = zend_register_list_destructors_ex(php_enchant_dict_free, NULL, "enchant dict", module_number);
return SUCCESS;
}
/* }}} */
/* {{{ PHP_MSHUTDOWN_FUNCTION
*/
PHP_MSHUTDOWN_FUNCTION(enchant)
{
return SUCCESS;
}
/* }}} */
/* {{{ PHP_MINFO_FUNCTION
*/
static void __enumerate_providers_fn (const char * const name,
const char * const desc,
const char * const file,
void * ud)
{
php_info_print_table_row(3, name, desc, file);
}
/* }}} */
/* {{{ PHP_MINFO_FUNCTION
*/
PHP_MINFO_FUNCTION(enchant)
{
EnchantBroker *pbroker;
pbroker = enchant_broker_init();
php_info_print_table_start();
php_info_print_table_header(2, "enchant support", "enabled");
php_info_print_table_row(2, "Version", "@version@");
php_info_print_table_row(2, "Revision", "$Revision$");
php_info_print_table_end();
php_info_print_table_start();
enchant_broker_describe(pbroker, __enumerate_providers_fn, NULL);
php_info_print_table_end();
enchant_broker_free(pbroker);
}
/* }}} */
#define PHP_ENCHANT_GET_BROKER \
ZEND_FETCH_RESOURCE(pbroker, enchant_broker *, &broker, -1, "enchant_broker", le_enchant_broker); \
if (!pbroker || !pbroker->pbroker) { \
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", "Resource broker invalid"); \
RETURN_FALSE; \
}
#define PHP_ENCHANT_GET_DICT \
ZEND_FETCH_RESOURCE(pdict, enchant_dict *, &dict, -1, "enchant dict", le_enchant_dict); \
if (!pdict || !pdict->pdict) { \
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", "Invalid dictionary resource."); \
RETURN_FALSE; \
}
/* {{{ proto resource enchant_broker_init()
create a new broker object capable of requesting */
PHP_FUNCTION(enchant_broker_init)
{
enchant_broker *broker;
EnchantBroker *pbroker;
if (ZEND_NUM_ARGS()) {
ZEND_WRONG_PARAM_COUNT();
}
pbroker = enchant_broker_init();
if (pbroker) {
broker = (enchant_broker *) emalloc(sizeof(enchant_broker));
broker->pbroker = pbroker;
broker->dict = NULL;
broker->dictcnt = 0;
ZEND_REGISTER_RESOURCE(return_value, broker, le_enchant_broker);
broker->rsrc_id = return_value;
} else {
RETURN_FALSE;
}
}
/* }}} */
/* {{{ proto boolean enchant_free(resource broker)
Destroys the broker object and its dictionnaries */
PHP_FUNCTION(enchant_broker_free)
{
zval *broker;
enchant_broker *pbroker;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &broker) == FAILURE) {
RETURN_FALSE;
}
PHP_ENCHANT_GET_BROKER;
zend_list_delete(Z_RESVAL_P(broker));
RETURN_TRUE;
}
/* }}} */
/* {{{ proto string enchant_broker_get_error(resource broker)
Returns the last error of the broker */
PHP_FUNCTION(enchant_broker_get_error)
{
zval *broker;
enchant_broker *pbroker;
char *msg;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &broker) == FAILURE) {
RETURN_FALSE;
}
PHP_ENCHANT_GET_BROKER;
msg = enchant_broker_get_error(pbroker->pbroker);
if (msg) {
RETURN_STRING((char *)msg, 1);
}
RETURN_FALSE;
}
/* }}} */
/* {{{ proto resource enchant_broker_request_dict(resource broker, string tag)
create a new dictionary using tag, the non-empty language tag you wish to request
a dictionary for ("en_US", "de_DE", ...) */
PHP_FUNCTION(enchant_broker_request_dict)
{
zval *broker;
enchant_broker *pbroker;
enchant_dict *dict;
EnchantDict *d;
char *tag;
int taglen;
int pos;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &broker, &tag, &taglen) == FAILURE) {
RETURN_FALSE;
}
PHP_ENCHANT_GET_BROKER;
d = enchant_broker_request_dict(pbroker->pbroker, (const char *)tag);
if (d) {
if (pbroker->dictcnt) {
pbroker->dict = (enchant_dict **)erealloc(pbroker->dict, sizeof(enchant_dict *) * pbroker->dictcnt);
pos = pbroker->dictcnt++;
} else {
pbroker->dict = (enchant_dict **)emalloc(sizeof(enchant_dict *));
pos = 0;
pbroker->dictcnt++;
}
dict = pbroker->dict[pos] = (enchant_dict *)emalloc(sizeof(enchant_dict));
dict->id = pos;
dict->pbroker = pbroker;
dict->pdict = d;
dict->rsrc_id = return_value;
dict->prev = pos ? pbroker->dict[pos-1] : NULL;
dict->next = NULL;
pbroker->dict[pos] = dict;
if (pos) {
pbroker->dict[pos-1]->next = dict;
}
ZEND_REGISTER_RESOURCE(return_value, dict, le_enchant_dict);
} else {
RETURN_FALSE;
}
}
/* }}} */
/* {{{ proto resource enchant_broker_request_pwl_dict(resource dict, string filename)
creates a dictionary using a PWL file. A PWL file is personal word file one word per line.
It must exist before the call.*/
PHP_FUNCTION(enchant_broker_request_pwl_dict)
{
zval *broker;
enchant_broker *pbroker;
enchant_dict *dict;
EnchantDict *d;
char *pwl;
int pwllen;
int pos;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &broker, &pwl, &pwllen) == FAILURE) {
RETURN_FALSE;
}
if ((PG(safe_mode) && (!php_checkuid(pwl, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || php_check_open_basedir(pwl TSRMLS_CC)) {
RETURN_FALSE;
}
PHP_ENCHANT_GET_BROKER;
d = enchant_broker_request_pwl_dict(pbroker->pbroker, (const char *)pwl);
if (d) {
if (pbroker->dictcnt) {
pos = pbroker->dictcnt++;
pbroker->dict = (enchant_dict **)erealloc(pbroker->dict, sizeof(enchant_dict *) * pbroker->dictcnt);
} else {
pbroker->dict = (enchant_dict **)emalloc(sizeof(enchant_dict *));
pos = 0;
pbroker->dictcnt++;
}
dict = pbroker->dict[pos] = (enchant_dict *)emalloc(sizeof(enchant_dict));
dict->id = pos;
dict->pbroker = pbroker;
dict->pdict = d;
dict->rsrc_id = return_value;
dict->prev = pos?pbroker->dict[pos-1]:NULL;
dict->next = NULL;
pbroker->dict[pos] = dict;
if (pos) {
pbroker->dict[pos-1]->next = dict;
}
ZEND_REGISTER_RESOURCE(return_value, dict, le_enchant_dict);
} else {
RETURN_FALSE;
}
}
/* }}} */
/* {{{ proto resource enchant_broker_free_dict(resource dict)
Free the dictionary resource */
PHP_FUNCTION(enchant_broker_free_dict)
{
zval *dict;
enchant_dict *pdict;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &dict) == FAILURE) {
RETURN_FALSE;
}
PHP_ENCHANT_GET_DICT;
zend_list_delete(Z_RESVAL_P(dict));
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool enchant_broker_dict_exists(resource broker, string tag)
Wether a dictionary exists or not. Using non-empty tag */
PHP_FUNCTION(enchant_broker_dict_exists)
{
zval *broker;
char *tag;
int taglen;
enchant_broker * pbroker;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &broker, &tag, &taglen) == FAILURE) {
RETURN_FALSE;
}
PHP_ENCHANT_GET_BROKER;
RETURN_BOOL(enchant_broker_dict_exists(pbroker->pbroker, tag));
}
/* }}} */
/* {{{ proto bool enchant_broker_set_ordering(resource broker, string tag, string ordering)
Declares a preference of dictionaries to use for the language
described/referred to by 'tag'. The ordering is a comma delimited
list of provider names. As a special exception, the "*" tag can
be used as a language tag to declare a default ordering for any
language that does not explictly declare an ordering. */
PHP_FUNCTION(enchant_broker_set_ordering)
{
zval *broker;
char *pordering;
int porderinglen;
char *ptag;
int ptaglen;
enchant_broker * pbroker;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss", &broker, &ptag, &ptaglen, &pordering, &porderinglen) == FAILURE) {
RETURN_FALSE;
}
PHP_ENCHANT_GET_BROKER;
enchant_broker_set_ordering(pbroker->pbroker, ptag, pordering);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto array enchant_broker_describe(resource broker)
Enumerates the Enchant providers and tells
you some rudimentary information about them. The same info is provided through phpinfo() */
PHP_FUNCTION(enchant_broker_describe)
{
EnchantBrokerDescribeFn describetozval = enumerate_providers_fn;
zval *broker;
enchant_broker * pbroker;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &broker) == FAILURE) {
RETURN_FALSE;
}
PHP_ENCHANT_GET_BROKER;
enchant_broker_describe(pbroker->pbroker, describetozval, (void *)return_value);
}
/* }}} */
/* {{{ proto bool enchant_dict_quick_check(resource dict, string word [, array &suggestions])
If the word is correctly spelled return true, otherwise return false, if suggestions variable
is provided, fill it with spelling alternatives. */
PHP_FUNCTION(enchant_dict_quick_check)
{
zval *dict, *sugg = NULL;
char *word;
int wordlen;
enchant_dict *pdict;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|z/", &dict, &word, &wordlen, &sugg) == FAILURE) {
RETURN_FALSE;
}
if (sugg) {
zval_dtor(sugg);
}
PHP_ENCHANT_GET_DICT;
if (enchant_dict_check(pdict->pdict, word, wordlen) > 0) {
if (!sugg && ZEND_NUM_ARGS() == 2) {
RETURN_FALSE;
}
int n_sugg;
char **suggs;
array_init(sugg);
suggs = enchant_dict_suggest(pdict->pdict, word, wordlen, &n_sugg);
if (suggs && n_sugg) {
int i;
for (i = 0; i < n_sugg; i++) {
add_next_index_string(sugg, suggs[i], 1);
}
enchant_dict_free_suggestions(pdict->pdict, suggs);
}
RETURN_FALSE;
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool enchant_dict_check(resource dict, string word)
If the word is correctly spelled return true, otherwise return false */
PHP_FUNCTION(enchant_dict_check)
{
zval *dict;
char *word;
int wordlen;
enchant_dict *pdict;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &dict, &word, &wordlen) == FAILURE) {
RETURN_FALSE;
}
PHP_ENCHANT_GET_DICT;
RETURN_BOOL(!enchant_dict_check(pdict->pdict, word, wordlen));
}
/* }}} */
/* {{{ proto array enchant_dict_suggest(resource dict, string word)
Will return a list of values if any of those pre-conditions are not met.*/
PHP_FUNCTION(enchant_dict_suggest)
{
zval *dict;
char *word;
int wordlen;
char **suggs;
enchant_dict *pdict;
int n_sugg;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &dict, &word, &wordlen) == FAILURE) {
RETURN_FALSE;
}
PHP_ENCHANT_GET_DICT;
suggs = enchant_dict_suggest(pdict->pdict, word, wordlen, &n_sugg);
if (suggs && n_sugg) {
int i;
array_init(return_value);
for (i = 0; i < n_sugg; i++) {
add_next_index_string(return_value, suggs[i], 1);
}
enchant_dict_free_suggestions(pdict->pdict, suggs);
}
}
/* }}} */
/* {{{ proto void enchant_dict_add_to_personal(resource dict, string word)
add 'word' to personal word list */
PHP_FUNCTION(enchant_dict_add_to_personal)
{
zval *dict;
char *word;
int wordlen;
enchant_dict *pdict;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &dict, &word, &wordlen) == FAILURE) {
RETURN_FALSE;
}
PHP_ENCHANT_GET_DICT;
enchant_dict_add_to_personal(pdict->pdict, word, wordlen);
}
/* }}} */
/* {{{ proto void enchant_dict_add_to_session(resource dict, string word)
add 'word' to this spell-checking session */
PHP_FUNCTION(enchant_dict_add_to_session)
{
zval *dict;
char *word;
int wordlen;
enchant_dict *pdict;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &dict, &word, &wordlen) == FAILURE) {
RETURN_FALSE;
}
PHP_ENCHANT_GET_DICT;
enchant_dict_add_to_session(pdict->pdict, word, wordlen);
}
/* }}} */
/* {{{ proto bool enchant_dict_is_in_session(resource dict, string word)
whether or not 'word' exists in this spelling-session */
PHP_FUNCTION(enchant_dict_is_in_session)
{
zval *dict;
char *word;
int wordlen;
enchant_dict *pdict;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &dict, &word, &wordlen) == FAILURE) {
RETURN_FALSE;
}
PHP_ENCHANT_GET_DICT;
RETURN_BOOL(enchant_dict_is_in_session(pdict->pdict, word, wordlen));
}
/* }}} */
/* {{{ proto void enchant_dict_store_replacement(resource dict, string mis, string cor)
add a correction for 'mis' using 'cor'.
Notes that you replaced @mis with @cor, so it's possibly more likely
that future occurrences of @mis will be replaced with @cor. So it might
bump @cor up in the suggestion list.*/
PHP_FUNCTION(enchant_dict_store_replacement)
{
zval *dict;
char *mis, *cor;
int mislen, corlen;
enchant_dict *pdict;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss", &dict, &mis, &mislen, &cor, &corlen) == FAILURE) {
RETURN_FALSE;
}
PHP_ENCHANT_GET_DICT;
enchant_dict_store_replacement(pdict->pdict, mis, mislen, cor, corlen);
}
/* }}} */
/* {{{ proto string enchant_dict_get_error(resource dict)
Returns the last error of the current spelling-session */
PHP_FUNCTION(enchant_dict_get_error)
{
zval *dict;
enchant_dict *pdict;
char *msg;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &dict) == FAILURE) {
RETURN_FALSE;
}
PHP_ENCHANT_GET_DICT;
msg = enchant_dict_get_error(pdict->pdict);
if (msg) {
RETURN_STRING((char *)msg, 1);
}
RETURN_FALSE;
}
/* }}} */
/* {{{ proto array enchant_dict_describe(resource dict)
Describes an individual dictionary 'dict' */
PHP_FUNCTION(enchant_dict_describe)
{
zval *dict;
enchant_dict *pdict;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &dict) == FAILURE) {
RETURN_FALSE;
}
PHP_ENCHANT_GET_DICT;
enchant_dict_describe(pdict->pdict, describe_dict_fn, (void *)return_value);
}
/* }}} */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/
-83
View File
@@ -1,83 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE package SYSTEM "../pear/package.dtd">
<package>
<name>enchant</name>
<summary>libenchant binder, support near all spelling tools</summary>
<maintainers>
<maintainer>
<user>pajoye</user>
<name>Pierre-Alain Joye</name>
<email>paj@pearfr.org</email>
<role>lead</role>
</maintainer>
<maintainer>
<user>iliaa</user>
<name>Ilia Alshanetsky</name>
<email>ilia@php.net</email>
<role>lead</role>
</maintainer>
</maintainers>
<description>Enchant is a binder for libenchant. Libenchant provides a common
API for many spell libraries:
- aspell/pspell (intended to replace ispell)
- hspell (hebrew)
- ispell
- myspell (OpenOffice project, mozilla)
- uspell (primarily Yiddish, Hebrew, and Eastern European languages)
A plugin system allows to add custom spell support.
see www.abisource.com/enchant/</description>
<license>PHP</license>
<release>
<state>stable</state>
<version>1.0</version>
<date>2004-08-11</date>
<notes>- Fixed leak inside MINFO function.
- Fixed crash inside enchant_dict_suggest() when there are no suggestions.
- Added missing safe_mode/open_basedir check inside enchant_broker_request_pwl_dict().
- Fixed various function prototypes.
- Fixed possible leak in suggestions result.</notes>
<filelist>
<file role="src" name="config.m4"/>
<file role="src" name="config.w32"/>
<file role="src" name="enchant.c"/>
<file role="src" name="php_enchant.h"/>
<file role="doc" name="CREDITS"/>
<dir name="docs" role="doc">
<dir name="examples">
<file name="example1.php"/>
</dir>
</dir>
</filelist>
<configureoptions>
<configureoption name="with-enchant" default="shared" prompt="libenchant prefix?"/>
</configureoptions>
<deps>
<dep type="php" rel="ge" version="5" />
</deps>
</release>
<changelog>
<release>
<state>beta</state>
<version>0.2.1</version>
<date>2004-03-11</date>
<notes>- Fix possible leak in suggestions result
- Move to beta status</notes>
</release>
<release>
<state>alpha</state>
<version>0.2.0</version>
<notes>- Add Ilia Alshanetsky as maintainer
- Cleanup sources codes (ilia)
- Add enchant_dict_quick_check (ilia)</notes>
</release>
<release>
<version>0.1</version>
<state>alpha</state>
<date>2003-03-08</date>
<notes>Initial release</notes>
</release>
</changelog>
</package>
<!--
vim:et:ts=1:sw=1
-->
-80
View File
@@ -1,80 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available at through the world-wide-web at |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Pierre-Alain Joye <paj@pearfr.org> |
+----------------------------------------------------------------------+
$Id$
*/
#ifndef PHP_ENCHANT_H
#define PHP_ENCHANT_H
extern zend_module_entry enchant_module_entry;
#define phpext_enchant_ptr &enchant_module_entry
#ifdef PHP_WIN32
#define PHP_ENCHANT_API __declspec(dllexport)
#else
#define PHP_ENCHANT_API
#endif
#ifdef ZTS
#include "TSRM.h"
#endif
static void php_enchant_broker_free(zend_rsrc_list_entry *rsrc TSRMLS_DC);
static void php_enchant_dict_free(zend_rsrc_list_entry *rsrc TSRMLS_DC);
PHP_MINIT_FUNCTION(enchant);
PHP_MSHUTDOWN_FUNCTION(enchant);
PHP_MINFO_FUNCTION(enchant);
PHP_FUNCTION(enchant_broker_init);
PHP_FUNCTION(enchant_broker_free);
PHP_FUNCTION(enchant_broker_get_error);
PHP_FUNCTION(enchant_broker_request_dict);
PHP_FUNCTION(enchant_broker_request_pwl_dict);
PHP_FUNCTION(enchant_broker_free_dict);
PHP_FUNCTION(enchant_broker_dict_exists);
PHP_FUNCTION(enchant_broker_set_ordering);
PHP_FUNCTION(enchant_broker_describe);
PHP_FUNCTION(enchant_dict_check);
PHP_FUNCTION(enchant_dict_suggest);
PHP_FUNCTION(enchant_dict_add_to_personal);
PHP_FUNCTION(enchant_dict_add_to_session);
PHP_FUNCTION(enchant_dict_is_in_session);
PHP_FUNCTION(enchant_dict_store_replacement);
PHP_FUNCTION(enchant_dict_get_error);
PHP_FUNCTION(enchant_dict_describe);
PHP_FUNCTION(enchant_dict_quick_check);
#ifdef ZTS
#define ENCHANT_G(v) TSRMG(enchant_globals_id, zend_enchant_globals *, v)
#else
#define ENCHANT_G(v) (enchant_globals.v)
#endif
#endif /* PHP_ENCHANT_H */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* indent-tabs-mode: t
* End:
*/
-2
View File
@@ -1,2 +0,0 @@
fileinfo
Ilia Alshanetsky
View File
Whitespace-only changes.
-62
View File
@@ -1,62 +0,0 @@
dnl $Id$
dnl config.m4 for extension fileinfo
PHP_ARG_WITH(fileinfo, for fileinfo support,
[ --with-fileinfo=DIR Include fileinfo support])
if test "$PHP_FILEINFO" != "no"; then
SEARCH_PATH="/usr/local /usr /usr/share/file"
if test -r $PHP_FILEINFO/include/magic.h || test -r $PHP_FILEINFO/magic.h; then
FILEINFO_DIR=$PHP_FILEINFO
else
AC_MSG_CHECKING([for magic files in default path])
for i in $SEARCH_PATH ; do
if test -r $i/include/magic.h || test -r $i/magic.h; then
FILEINFO_DIR=$i
AC_MSG_RESULT(found in $i)
break
fi
done
fi
if test -z "$FILEINFO_DIR"; then
AC_MSG_RESULT([not found])
AC_MSG_ERROR([Please reinstall the libmagic distribution])
fi
if test -r "$FILEINFO_DIR/include/magic.h"; then
PHP_ADD_INCLUDE($FILEINFO_DIR/include)
else
PHP_ADD_INCLUDE($FILEINFO_DIR)
fi
LIBNAME=magic
LIBSYMBOL=magic_open
PHP_CHECK_FUNC(dl, dlopen)
PHP_CHECK_FUNC(gzgets, z)
PHP_CHECK_FUNC(round, m)
PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL,
[
PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $FILEINFO_DIR/lib, FILEINFO_SHARED_LIBADD)
AC_DEFINE(HAVE_FILEINFOLIB,1,[ ])
],[
AC_MSG_ERROR([wrong magic lib version or lib not found])
],[
-L$FILEINFO_DIR/lib
])
MAGIC_MIME_LOCATIONS="/usr/local/share/file/magic /usr/share/file/magic /usr/share/misc/file/magic /etc/magic /usr/share/misc"
for i in $MAGIC_MIME_LOCATIONS; do
if test -f $i; then
PHP_DEFAULT_MAGIC_FILE=$i
break
fi
done
AC_DEFINE_UNQUOTED(PHP_DEFAULT_MAGIC_FILE,"$PHP_DEFAULT_MAGIC_FILE",[magic file path])
PHP_SUBST(FILEINFO_SHARED_LIBADD)
PHP_NEW_EXTENSION(fileinfo, fileinfo.c, $ext_shared)
fi
-433
View File
@@ -1,433 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2004 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Ilia Alshanetsky <ilia@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <magic.h>
/*
* HOWMANY specifies the maximum offset libmagic will look at
* this is currently hardcoded in the libmagic source but not exported
*/
#ifndef HOWMANY
#define HOWMANY 65536
#endif
#include "php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
#include "ext/standard/file.h" /* needed for context stuff */
#include "php_fileinfo.h"
#include "fopen_wrappers.h" /* needed for is_url */
struct php_fileinfo {
long options;
struct magic_set *magic;
};
#ifndef PHP_DEFAULT_MAGIC_FILE
#define PHP_DEFAULT_MAGIC_FILE NULL
#endif
#ifdef ZEND_ENGINE_2
static zend_object_handlers finfo_object_handlers;
zend_class_entry *finfo_class_entry;
struct finfo_object {
zend_object zo;
struct php_fileinfo *ptr;
};
#define FILEINFO_DECLARE_INIT_OBJECT(object) \
zval *object = getThis();
#define FILEINFO_REGISTER_OBJECT(_object, _ptr) \
{ \
struct finfo_object *obj; \
obj = (struct finfo_object*)zend_object_store_get_object(_object TSRMLS_CC); \
obj->ptr = _ptr; \
}
#define FILEINFO_FROM_OBJECT(finfo, object) \
{ \
struct finfo_object *obj = zend_object_store_get_object(object TSRMLS_CC); \
finfo = obj->ptr; \
if (!finfo) { \
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The invalid fileinfo object."); \
RETURN_FALSE; \
} \
}
/* {{{ finfo_objects_dtor
*/
static void finfo_objects_dtor(void *object, zend_object_handle handle TSRMLS_DC)
{
struct finfo_object *intern = (struct finfo_object *) object;
if (intern->ptr) {
magic_close(intern->ptr->magic);
efree(intern->ptr);
}
efree(intern);
}
/* }}} */
/* {{{ finfo_objects_new
*/
PHP_FILEINFO_API zend_object_value finfo_objects_new(zend_class_entry *class_type TSRMLS_DC)
{
zend_object_value retval;
struct finfo_object *intern;
intern = emalloc(sizeof(struct finfo_object));
intern->zo.ce = class_type;
intern->zo.in_get = 0;
intern->zo.in_set = 0;
intern->zo.properties = NULL;
intern->ptr = NULL;
retval.handle = zend_objects_store_put(intern, finfo_objects_dtor, NULL, NULL TSRMLS_CC);
retval.handlers = (zend_object_handlers *) &finfo_object_handlers;
return retval;
}
/* }}} */
/* {{{ finfo_class_functions
*/
function_entry finfo_class_functions[] = {
ZEND_ME_MAPPING(finfo, finfo_open, NULL)
ZEND_ME_MAPPING(set_flags, finfo_set_flags,NULL)
ZEND_ME_MAPPING(file, finfo_file, NULL)
ZEND_ME_MAPPING(buffer, finfo_buffer, NULL)
{NULL, NULL, NULL}
};
/* }}} */
#else
#define FILEINFO_REGISTER_OBJECT(_object, _ptr) {}
#define FILEINFO_FROM_OBJECT(socket_id, object) {}
#define FILEINFO_DECLARE_INIT_OBJECT(object)
#define object 0
#endif
#define FINFO_SET_OPTION(magic, options) \
if (magic_setflags(magic, options) == -1) { \
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to set option '%ld' %d:%s", \
options, magic_errno(magic), magic_error(magic)); \
RETURN_FALSE; \
}
/* True global resources - no need for thread safety here */
static int le_fileinfo;
void finfo_resource_destructor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
{
if (rsrc->ptr) {
struct php_fileinfo *finfo = (struct php_fileinfo *) rsrc->ptr;
magic_close(finfo->magic);
efree(rsrc->ptr);
rsrc->ptr = NULL;
}
}
/* {{{ fileinfo_functions[]
*/
function_entry fileinfo_functions[] = {
PHP_FE(finfo_open, NULL)
PHP_FE(finfo_close, NULL)
PHP_FE(finfo_set_flags, NULL)
PHP_FE(finfo_file, NULL)
PHP_FE(finfo_buffer, NULL)
{NULL, NULL, NULL}
};
/* }}} */
/* {{{ PHP_MINIT_FUNCTION
*/
PHP_MINIT_FUNCTION(finfo)
{
#ifdef ZEND_ENGINE_2
zend_class_entry _finfo_class_entry;
INIT_CLASS_ENTRY(_finfo_class_entry, "finfo", finfo_class_functions);
_finfo_class_entry.create_object = finfo_objects_new;
finfo_class_entry = zend_register_internal_class(&_finfo_class_entry TSRMLS_CC);
/* copy the standard object handlers to you handler table */
memcpy(&finfo_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
#endif /* ZEND_ENGINE_2 */
le_fileinfo = zend_register_list_destructors_ex(finfo_resource_destructor, NULL, "file_info", module_number);
REGISTER_LONG_CONSTANT("FILEINFO_NONE", MAGIC_NONE, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FILEINFO_SYMLINK", MAGIC_SYMLINK, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FILEINFO_MIME", MAGIC_MIME, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FILEINFO_COMPRESS", MAGIC_COMPRESS, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FILEINFO_DEVICES", MAGIC_DEVICES, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FILEINFO_CONTINUE", MAGIC_CONTINUE, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FILEINFO_PRESERVE_ATIME", MAGIC_PRESERVE_ATIME, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FILEINFO_RAW", MAGIC_RAW, CONST_CS|CONST_PERSISTENT);
return SUCCESS;
}
/* }}} */
/* {{{ fileinfo_module_entry
*/
zend_module_entry fileinfo_module_entry = {
#if ZEND_MODULE_API_NO >= 20010901
STANDARD_MODULE_HEADER,
#endif
"fileinfo",
fileinfo_functions,
PHP_MINIT(finfo),
NULL,
NULL,
NULL,
PHP_MINFO(fileinfo),
#if ZEND_MODULE_API_NO >= 20010901
"0.1", /* Replace with version number for your extension */
#endif
STANDARD_MODULE_PROPERTIES
};
/* }}} */
#ifdef COMPILE_DL_FILEINFO
ZEND_GET_MODULE(fileinfo)
#endif
/* {{{ PHP_MINFO_FUNCTION
*/
PHP_MINFO_FUNCTION(fileinfo)
{
php_info_print_table_start();
php_info_print_table_header(2, "fileinfo support", "enabled");
php_info_print_table_end();
}
/* }}} */
/* {{{ proto resource finfo_open([int options [, string arg]])
Create a new fileinfo resource. */
PHP_FUNCTION(finfo_open)
{
long options = MAGIC_NONE;
char *file = PHP_DEFAULT_MAGIC_FILE;
int file_len = 0;
struct php_fileinfo *finfo;
FILEINFO_DECLARE_INIT_OBJECT(object)
char resolved_path[MAXPATHLEN];
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ls", &options, &file, &file_len) == FAILURE) {
RETURN_FALSE;
}
if (file_len) { /* user specified filed, perform open_basedir checks */
if (!VCWD_REALPATH(file, resolved_path)) {
RETURN_FALSE;
}
file = resolved_path;
if ((PG(safe_mode) && (!php_checkuid(file, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || php_check_open_basedir(file TSRMLS_CC)) {
RETURN_FALSE;
}
}
finfo = emalloc(sizeof(struct php_fileinfo));
finfo->options = options;
finfo->magic = magic_open(options);
if (finfo->magic == NULL) {
efree(finfo);
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid mode '%ld'.", options);
RETURN_FALSE;
}
if (magic_load(finfo->magic, file) == -1) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to load magic database at '%s'.", file);
magic_close(finfo->magic);
efree(finfo);
RETURN_FALSE;
}
if (object) {
FILEINFO_REGISTER_OBJECT(object, finfo);
} else {
ZEND_REGISTER_RESOURCE(return_value, finfo, le_fileinfo);
}
}
/* }}} */
/* {{{ proto resource finfo_close(resource finfo)
Close fileinfo resource. */
PHP_FUNCTION(finfo_close)
{
struct php_fileinfo *finfo;
zval *zfinfo;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &zfinfo) == FAILURE) {
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE(finfo, struct php_fileinfo *, &zfinfo, -1, "file_info", le_fileinfo);
zend_list_delete(Z_RESVAL_P(zfinfo));
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool finfo_set_flags(resource finfo, int options)
Set libmagic configuration options. */
PHP_FUNCTION(finfo_set_flags)
{
long options;
struct php_fileinfo *finfo;
zval *zfinfo;
FILEINFO_DECLARE_INIT_OBJECT(object)
if (object) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &options) == FAILURE) {
RETURN_FALSE;
}
FILEINFO_FROM_OBJECT(finfo, object);
} else {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl", &zfinfo, &options) == FAILURE) {
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE(finfo, struct php_fileinfo *, &zfinfo, -1, "file_info", le_fileinfo);
}
FINFO_SET_OPTION(finfo->magic, options)
finfo->options = options;
RETURN_TRUE;
}
/* }}} */
static void _php_finfo_get_type(INTERNAL_FUNCTION_PARAMETERS, int mode)
{
long options = 0;
char *buffer, *tmp, *ret_val;
int buffer_len;
struct php_fileinfo *finfo;
zval *zfinfo, *zcontext = NULL;
FILEINFO_DECLARE_INIT_OBJECT(object)
if (object) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lbz", &buffer, &buffer_len, &options, &zcontext) == FAILURE) {
RETURN_FALSE;
}
FILEINFO_FROM_OBJECT(finfo, object);
} else {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs|lbz", &zfinfo, &buffer, &buffer_len, &options, &zcontext) == FAILURE) {
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE(finfo, struct php_fileinfo *, &zfinfo, -1, "file_info", le_fileinfo);
}
/* Set options for the current file/buffer. */
if (options) {
FINFO_SET_OPTION(finfo->magic, options)
}
if (mode) { /* file */
/* determine if the file is a local file or remote URL */
char *tmp2;
php_stream_wrapper *wrap = php_stream_locate_url_wrapper(buffer, &tmp2, 0 TSRMLS_CC);
if (wrap && wrap->is_url) {
#ifdef ZEND_ENGINE_2
php_stream_context *context = php_stream_context_from_zval(zcontext, 0);
#else
php_stream_context *context = NULL;
#endif
php_stream *stream = php_stream_open_wrapper_ex(buffer, "rb",
ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, context);
if (!stream) {
RETURN_FALSE;
}
buffer_len = php_stream_copy_to_mem(stream, &tmp, HOWMANY, 0);
php_stream_close(stream);
if (buffer_len == 0) {
RETURN_FALSE;
}
} else { /* local file */
char resolved_path[MAXPATHLEN];
if (!VCWD_REALPATH(buffer, resolved_path)) {
RETURN_FALSE;
}
ret_val = (char *) magic_file(finfo->magic, buffer);
goto common;
}
} else { /* buffer */
tmp = buffer;
}
ret_val = (char *) magic_buffer(finfo->magic, tmp, buffer_len);
if (mode) {
efree(tmp);
}
common:
/* Restore options */
if (options) {
FINFO_SET_OPTION(finfo->magic, finfo->options)
}
if (!ret_val) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed identify data %d:%s",
magic_errno(finfo->magic), magic_error(finfo->magic));
RETURN_FALSE;
} else {
RETURN_STRING(ret_val, 1);
}
}
/* {{{ proto string finfo_file(resource finfo, char *file_name [, int options [, resource context]])
Return information about a file. */
PHP_FUNCTION(finfo_file)
{
_php_finfo_get_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
}
/* }}} */
/* {{{ proto string finfo_buffer(resource finfo, char *string [, int options])
Return infromation about a string buffer. */
PHP_FUNCTION(finfo_buffer)
{
_php_finfo_get_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
}
/* }}} */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/
-29
View File
@@ -1,29 +0,0 @@
<?php
if(!extension_loaded('fileinfo')) {
dl('fileinfo.' . PHP_SHLIB_SUFFIX);
}
if(!extension_loaded('fileinfo')) {
die("fileinfo extension is not avaliable, please compile it.\n");
}
// normal operation
$res = finfo_open(FILEINFO_MIME); /* return mime type ala mimetype extension */
$files = glob("*");
foreach ($files as $file) {
echo finfo_file($res, $file) . "\n";
}
finfo_close($res);
// OO mode
/*
* FILEINFO_PRESERVE_ATIME - if possible preserve the original access time
* FILEINFO_SYMLINK - follow symlinks
* FILEINFO_DEVICES - look at the contents of blocks or character special devices
* FILEINFO_COMPRESS - decompress compressed files
*/
$fi = new finfo(FILEINFO_PRESERVE_ATIME|FILEINFO_SYMLINK|FILEINFO_DEVICES|FILEINFO_COMPRESS);
$files = glob("*");
foreach ($files as $file) {
echo $fi->buffer(file_get_contents($file)) . "\n";
}
?>
-43
View File
@@ -1,43 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE package SYSTEM "../pear/package.dtd">
<package>
<name>Fileinfo</name>
<summary>libmagic bindings</summary>
<maintainers>
<maintainer>
<user>iliaa</user>
<name>Ilia Alshanetsky</name>
<email>ilia@php.net</email>
<role>lead</role>
</maintainer>
</maintainers>
<description>
This extension allows retrieval of information regarding vast majority of file.
This information may include dimensions, quality, length etc...
Additionally it can also be used to retrieve the mime type for a particular
file and for text files proper language encoding.
</description>
<license>PHP</license>
<release>
<state>stable</state>
<version>1.0</version>
<date>2005-06-30</date>
<notes>
1) Fixed library detection routines.
</notes>
<filelist>
<file role="src" name="config.m4"/>
<file role="src" name="fileinfo.c"/>
<file role="src" name="php_fileinfo.h"/>
<file role="doc" name="CREDITS"/>
<file role="doc" name="EXPERIMENTAL"/>
<file role="doc" name="fileinfo.php"/>
</filelist>
<deps>
</deps>
</release>
</package>
<!--
vim:et:ts=1:sw=1
-->
-61
View File
@@ -1,61 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2004 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Ilia Alshanetsky <ilia@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef PHP_FILEINFO_H
#define PHP_FILEINFO_H
extern zend_module_entry fileinfo_module_entry;
#define phpext_fileinfo_ptr &fileinfo_module_entry
#ifdef PHP_WIN32
#define PHP_FILEINFO_API __declspec(dllexport)
#else
#define PHP_FILEINFO_API
#endif
#ifdef ZTS
#include "TSRM.h"
#endif
PHP_MINFO_FUNCTION(fileinfo);
PHP_FUNCTION(finfo_open);
PHP_FUNCTION(finfo_close);
PHP_FUNCTION(finfo_set_flags);
PHP_FUNCTION(finfo_file);
PHP_FUNCTION(finfo_buffer);
#ifdef ZTS
#define FILEINFO_G(v) TSRMG(fileinfo_globals_id, zend_fileinfo_globals *, v)
#else
#define FILEINFO_G(v) (fileinfo_globals.v)
#endif
#endif /* PHP_FILEINFO_H */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/
-2
View File
@@ -1,2 +0,0 @@
PHP hash
Sara Golemon, Rasmus Lerdorf, Stefan Esser, Michael Wallner
View File
Whitespace-only changes.
-19
View File
@@ -1,19 +0,0 @@
Generic hashing framework for PHP
Simplest usages:
$digest = hash($algoname, $message);
$digest = hash_file($algoname, $filename);
Examples:
$digest = hash('md5', 'The quick brown fox jumped over the lazy dog.');
Feeder usage:
$context = hash_init($algoname);
hash_update($context, $message);
$digest = hash_final($context);
hash(), hash_file(), and hash_final() each support an optional boolean parameter $raw_output which behaves in the same
manner as sha1()'s optional parameter.
-92
View File
@@ -1,92 +0,0 @@
<?php
/* $Id$ */
/*
This gives rather interesting results :)
Measures on a Notebook P4M-1.7 256MB Windows 2000:
sha1 0.556691
tiger160,3 0.774469
tiger192,3 0.776314
tiger128,3 0.777004
ripemd128 0.896674
sha256 1.011164
md5 1.016032
tiger160,4 1.056617
tiger128,4 1.063101
tiger192,4 1.069258
haval160,3 1.125099
haval128,3 1.125679
haval224,3 1.128017
haval192,3 1.130026
haval256,3 1.134846
ripemd160 1.150693
haval128,4 1.686261
haval192,4 1.687274
haval160,4 1.693091
haval256,4 1.699323
haval224,4 1.743094
haval160,5 2.003452
haval192,5 2.008341
haval256,5 2.009048
haval128,5 2.009555
haval224,5 2.015539
sha384 3.370734
sha512 3.381121
whirlpool 6.912327
snefru 9.268168
Measures on a Desktop P4-2.4 512MB Debian (Linux-2.4):
md5 0.147739
haval128,3 0.317006
haval192,3 0.317524
haval256,3 0.317526
haval160,3 0.323035
haval224,3 0.333318
ripemd128 0.353447
sha1 0.376200
ripemd160 0.413758
sha256 0.435957
haval160,4 0.452357
haval224,4 0.454531
haval128,4 0.458026
haval256,4 0.459051
haval192,4 0.468094
haval128,5 0.524262
haval160,5 0.529573
haval224,5 0.533655
haval256,5 0.534446
haval192,5 0.543726
tiger128,3 0.577975
tiger160,3 0.579951
tiger192,3 0.597111
tiger192,4 0.781408
tiger160,4 0.801243
tiger128,4 0.812239
sha512 1.298627
sha384 1.313607
whirlpool 1.556159
snefru 5.703742
*/
error_reporting(E_ALL&~E_NOTICE);
$data = file_get_contents(__FILE__);
$time = array();
for ($j = 0; $j < 10; $j++) {
foreach (hash_algos() as $algo) {
$start = microtime(true);
for ($i = 0; $i < 1000; $i++) {
hash($algo, $data);
}
$time[$algo] += microtime(true)-$start;
}
}
asort($time, SORT_NUMERIC);
foreach ($time as $a => $t) {
printf("%-12s %02.6f\n", $a, $t);
}
?>
-26
View File
@@ -1,26 +0,0 @@
dnl $Id$
dnl config.m4 for extension hash
PHP_ARG_ENABLE(hash, whether to enable hash support,
[ --enable-hash Enable hash support])
if test "$PHP_HASH" != "no"; then
AC_DEFINE(HAVE_HASH_EXT,1,[Have HASH Extension])
AC_CHECK_SIZEOF(short, 2)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(long, 4)
AC_CHECK_SIZEOF(long long, 8)
EXT_HASH_SOURCES="hash.c hash_md.c hash_sha.c hash_ripemd.c hash_haval.c \
hash_tiger.c hash_gost.c hash_snefru.c hash_whirlpool.c hash_adler32.c \
hash_crc32.c"
EXT_HASH_HEADERS="php_hash.h php_hash_md.h php_hash_sha.h php_hash_ripemd.h \
php_hash_haval.h php_hash_tiger.h php_hash_gost.h php_hash_snefru.h \
php_hash_whirlpool.h php_hash_adler32.h php_hash_crc32.h php_hash_types.h"
PHP_NEW_EXTENSION(hash, $EXT_HASH_SOURCES, $ext_shared)
ifdef([PHP_INSTALL_HEADERS], [
PHP_INSTALL_HEADERS(ext/hash, $EXT_HASH_HEADERS)
])
fi
-12
View File
@@ -1,12 +0,0 @@
// $Id$
// vim:ft=javascript
ARG_ENABLE("hash", "enable hash support", "no");
if (PHP_HASH != "no") {
AC_DEFINE('HAVE_HASH_EXT', 1);
EXTENSION("hash", "hash.c hash_md.c hash_sha.c hash_ripemd.c hash_haval.c "
+ "hash_tiger.c hash_gost.c hash_snefru.c hash_whirlpool.c "
+ "hash_adler32.c hash_crc32.c");
}
-660
View File
@@ -1,660 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2005 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Sara Golemon <pollita@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "php_hash.h"
#include "ext/standard/info.h"
#include "ext/standard/file.h"
static int php_hash_le_hash;
HashTable php_hash_hashtable;
#if (PHP_MAJOR_VERSION >= 5)
# define DEFAULT_CONTEXT FG(default_context)
#else
# define DEFAULT_CONTEXT NULL
#endif
/* Hash Registry Access */
PHP_HASH_API php_hash_ops *php_hash_fetch_ops(const char *algo, int algo_len)
{
php_hash_ops *ops;
char *lower = estrndup(algo, algo_len);
zend_str_tolower(lower, algo_len);
if (SUCCESS != zend_hash_find(&php_hash_hashtable, lower, algo_len + 1, (void**)&ops)) {
ops = NULL;
}
efree(lower);
return ops;
}
PHP_HASH_API void php_hash_register_algo(const char *algo, php_hash_ops *ops)
{
int algo_len = strlen(algo);
char *lower = estrndup(algo, algo_len);
zend_str_tolower(lower, algo_len);
zend_hash_add(&php_hash_hashtable, lower, algo_len + 1, ops, sizeof(php_hash_ops), NULL);
efree(lower);
}
/* Userspace */
static void php_hash_do_hash(INTERNAL_FUNCTION_PARAMETERS, int isfilename)
{
char *algo, *data, *digest;
int algo_len, data_len;
zend_bool raw_output = 0;
php_hash_ops *ops;
void *context;
php_stream *stream = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|b", &algo, &algo_len, &data, &data_len, &raw_output) == FAILURE) {
return;
}
ops = php_hash_fetch_ops(algo, algo_len);
if (!ops) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown hashing algorithm: %s", algo);
RETURN_FALSE;
}
if (isfilename) {
stream = php_stream_open_wrapper_ex(data, "rb", REPORT_ERRORS | ENFORCE_SAFE_MODE, NULL, DEFAULT_CONTEXT);
if (!stream) {
/* Stream will report errors opening file */
RETURN_FALSE;
}
}
context = emalloc(ops->context_size);
ops->hash_init(context);
if (isfilename) {
char buf[1024];
int n;
while ((n = php_stream_read(stream, buf, sizeof(buf))) > 0) {
ops->hash_update(context, buf, n);
}
php_stream_close(stream);
} else {
ops->hash_update(context, data, data_len);
}
digest = emalloc(ops->digest_size + 1);
ops->hash_final(digest, context);
efree(context);
if (raw_output) {
digest[ops->digest_size] = 0;
RETURN_STRINGL(digest, ops->digest_size, 0);
} else {
char *hex_digest = safe_emalloc(ops->digest_size, 2, 1);
php_hash_bin2hex(hex_digest, digest, ops->digest_size);
hex_digest[2 * ops->digest_size] = 0;
efree(digest);
RETURN_STRINGL(hex_digest, 2 * ops->digest_size, 0);
}
}
/* {{{ proto string hash(string algo, string data[, bool raw_output = false])
Generate a hash of a given input string
Returns lowercase hexits by default */
PHP_FUNCTION(hash) {
php_hash_do_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
}
/* }}} */
/* {{{ proto string hash_file(string algo, string filename[, bool raw_output = false])
Generate a hash of a given file
Returns lowercase hexits by default */
PHP_FUNCTION(hash_file) {
php_hash_do_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
}
/* }}} */
static void php_hash_do_hash_hmac(INTERNAL_FUNCTION_PARAMETERS, int isfilename)
{
char *algo, *data, *digest, *key, *K;
int algo_len, data_len, key_len, i;
zend_bool raw_output = 0;
php_hash_ops *ops;
void *context;
php_stream *stream = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|b", &algo, &algo_len, &data, &data_len,
&key, &key_len, &raw_output) == FAILURE) {
return;
}
ops = php_hash_fetch_ops(algo, algo_len);
if (!ops) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown hashing algorithm: %s", algo);
RETURN_FALSE;
}
if (isfilename) {
stream = php_stream_open_wrapper_ex(data, "rb", REPORT_ERRORS | ENFORCE_SAFE_MODE, NULL, DEFAULT_CONTEXT);
if (!stream) {
/* Stream will report errors opening file */
RETURN_FALSE;
}
}
context = emalloc(ops->context_size);
ops->hash_init(context);
K = emalloc(ops->block_size);
memset(K, 0, ops->block_size);
if (key_len > ops->block_size) {
/* Reduce the key first */
ops->hash_update(context, key, key_len);
ops->hash_final(K, context);
/* Make the context ready to start over */
ops->hash_init(context);
} else {
memcpy(K, key, key_len);
}
/* XOR ipad */
for(i=0; i < ops->block_size; i++) {
K[i] ^= 0x36;
}
ops->hash_update(context, K, ops->block_size);
if (isfilename) {
char buf[1024];
int n;
while ((n = php_stream_read(stream, buf, sizeof(buf))) > 0) {
ops->hash_update(context, buf, n);
}
php_stream_close(stream);
} else {
ops->hash_update(context, data, data_len);
}
digest = emalloc(ops->digest_size + 1);
ops->hash_final(digest, context);
/* Convert K to opad -- 0x6A = 0x36 ^ 0x5C */
for(i=0; i < ops->block_size; i++) {
K[i] ^= 0x6A;
}
/* Feed this result into the outter hash */
ops->hash_init(context);
ops->hash_update(context, K, ops->block_size);
ops->hash_update(context, digest, ops->digest_size);
ops->hash_final(digest, context);
/* Zero the key */
memset(K, 0, ops->block_size);
efree(K);
efree(context);
if (raw_output) {
digest[ops->digest_size] = 0;
RETURN_STRINGL(digest, ops->digest_size, 0);
} else {
char *hex_digest = safe_emalloc(ops->digest_size, 2, 1);
php_hash_bin2hex(hex_digest, digest, ops->digest_size);
hex_digest[2 * ops->digest_size] = 0;
efree(digest);
RETURN_STRINGL(hex_digest, 2 * ops->digest_size, 0);
}
}
/* {{{ proto string hash_hmac(string algo, string data, string key[, bool raw_output = false])
Generate a hash of a given input string with a key using HMAC
Returns lowercase hexits by default */
PHP_FUNCTION(hash_hmac) {
php_hash_do_hash_hmac(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
}
/* }}} */
/* {{{ proto string hash_hmac_file(string algo, string filename, string key[, bool raw_output = false])
Generate a hash of a given file with a key using HMAC
Returns lowercase hexits by default */
PHP_FUNCTION(hash_hmac_file) {
php_hash_do_hash_hmac(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
}
/* }}} */
/* {{{ proto resource hash_init(string algo[, int options, string key])
Initialize a hashing context */
PHP_FUNCTION(hash_init)
{
char *algo, *key = NULL;
int algo_len, key_len = 0, argc = ZEND_NUM_ARGS();
long options = 0;
void *context;
php_hash_ops *ops;
php_hash_data *hash;
if (zend_parse_parameters(argc TSRMLS_CC, "s|ls", &algo, &algo_len, &options, &key, &key_len) == FAILURE) {
return;
}
ops = php_hash_fetch_ops(algo, algo_len);
if (!ops) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown hashing algorithm: %s", algo);
RETURN_FALSE;
}
if (options & PHP_HASH_HMAC &&
key_len <= 0) {
/* Note: a zero length key is no key at all */
php_error_docref(NULL TSRMLS_CC, E_WARNING, "HMAC requested without a key");
RETURN_FALSE;
}
context = emalloc(ops->context_size);
ops->hash_init(context);
hash = emalloc(sizeof(php_hash_data));
hash->ops = ops;
hash->context = context;
hash->options = options;
hash->key = NULL;
if (options & PHP_HASH_HMAC) {
char *K = emalloc(ops->block_size);
int i;
memset(K, 0, ops->block_size);
if (key_len > ops->block_size) {
/* Reduce the key first */
ops->hash_update(context, key, key_len);
ops->hash_final(K, context);
/* Make the context ready to start over */
ops->hash_init(context);
} else {
memcpy(K, key, key_len);
}
/* XOR ipad */
for(i=0; i < ops->block_size; i++) {
K[i] ^= 0x36;
}
ops->hash_update(context, K, ops->block_size);
hash->key = K;
}
ZEND_REGISTER_RESOURCE(return_value, hash, php_hash_le_hash);
}
/* }}} */
/* {{{ proto bool hash_update(resource context, string data)
Pump data into the hashing algorithm */
PHP_FUNCTION(hash_update)
{
zval *zhash;
php_hash_data *hash;
char *data;
int data_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &zhash, &data, &data_len) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(hash, php_hash_data*, &zhash, -1, PHP_HASH_RESNAME, php_hash_le_hash);
hash->ops->hash_update(hash->context, data, data_len);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto int hash_update_stream(resource context, resource handle[, integer length])
Pump data into the hashing algorithm from an open stream */
PHP_FUNCTION(hash_update_stream)
{
zval *zhash, *zstream;
php_hash_data *hash;
php_stream *stream = NULL;
long length = -1, didread = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|l", &zhash, &zstream, &length) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(hash, php_hash_data*, &zhash, -1, PHP_HASH_RESNAME, php_hash_le_hash);
php_stream_from_zval(stream, &zstream);
while (length) {
char buf[1024];
long n, toread = 1024;
if (length > 0 && toread > length) {
toread = length;
}
if ((n = php_stream_read(stream, buf, toread)) <= 0) {
/* Nada mas */
RETURN_LONG(didread);
}
hash->ops->hash_update(hash->context, buf, n);
length -= n;
didread += n;
}
RETURN_LONG(didread);
}
/* }}} */
/* {{{ proto bool hash_update_file(resource context, string filename[, resource context])
Pump data into the hashing algorithm from a file */
PHP_FUNCTION(hash_update_file)
{
zval *zhash, *zcontext = NULL;
php_hash_data *hash;
php_stream_context *context;
php_stream *stream;
char *filename, buf[1024];
int filename_len, n;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|r", &zhash, &filename, &filename_len, &zcontext) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(hash, php_hash_data*, &zhash, -1, PHP_HASH_RESNAME, php_hash_le_hash);
context = php_stream_context_from_zval(zcontext, 0);
stream = php_stream_open_wrapper_ex(filename, "rb", REPORT_ERRORS | ENFORCE_SAFE_MODE, NULL, context);
if (!stream) {
/* Stream will report errors opening file */
RETURN_FALSE;
}
while ((n = php_stream_read(stream, buf, sizeof(buf))) > 0) {
hash->ops->hash_update(hash->context, buf, n);
}
php_stream_close(stream);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto string hash_final(resource context[, bool raw_output=false])
Output resulting digest */
PHP_FUNCTION(hash_final)
{
zval *zhash;
php_hash_data *hash;
zend_bool raw_output = 0;
zend_rsrc_list_entry *le;
char *digest;
int digest_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|b", &zhash, &raw_output) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(hash, php_hash_data*, &zhash, -1, PHP_HASH_RESNAME, php_hash_le_hash);
digest_len = hash->ops->digest_size;
digest = emalloc(digest_len + 1);
hash->ops->hash_final(digest, hash->context);
if (hash->options & PHP_HASH_HMAC) {
int i;
/* Convert K to opad -- 0x6A = 0x36 ^ 0x5C */
for(i=0; i < hash->ops->block_size; i++) {
hash->key[i] ^= 0x6A;
}
/* Feed this result into the outter hash */
hash->ops->hash_init(hash->context);
hash->ops->hash_update(hash->context, hash->key, hash->ops->block_size);
hash->ops->hash_update(hash->context, digest, hash->ops->digest_size);
hash->ops->hash_final(digest, hash->context);
/* Zero the key */
memset(hash->key, 0, hash->ops->block_size);
efree(hash->key);
hash->key = NULL;
}
digest[digest_len] = 0;
efree(hash->context);
hash->context = NULL;
/* zend_list_REAL_delete() */
if (zend_hash_index_find(&EG(regular_list), Z_RESVAL_P(zhash), (void **) &le)==SUCCESS) {
/* This is a hack to avoid letting the resource hide elsewhere (like in separated vars)
FETCH_RESOURCE is intelligent enough to handle dealing with any issues this causes */
le->refcount = 1;
} /* FAILURE is not an option */
zend_list_delete(Z_RESVAL_P(zhash));
if (raw_output) {
RETURN_STRINGL(digest, digest_len, 0);
} else {
char *hex_digest = safe_emalloc(digest_len,2,1);
php_hash_bin2hex(hex_digest, digest, digest_len);
hex_digest[2 * digest_len] = 0;
efree(digest);
RETURN_STRINGL(hex_digest, 2 * digest_len, 0);
}
}
/* }}} */
/* {{{ proto array hash_algos(void)
Return a list of registered hashing algorithms */
PHP_FUNCTION(hash_algos)
{
HashPosition pos;
char *str;
int str_len;
long idx, type;
array_init(return_value);
for(zend_hash_internal_pointer_reset_ex(&php_hash_hashtable, &pos);
(type = zend_hash_get_current_key_ex(&php_hash_hashtable, &str, &str_len, &idx, 0, &pos)) != HASH_KEY_NON_EXISTANT;
zend_hash_move_forward_ex(&php_hash_hashtable, &pos)) {
add_next_index_stringl(return_value, str, str_len-1, 1);
}
}
/* }}} */
/* Module Housekeeping */
static void php_hash_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
{
php_hash_data *hash = (php_hash_data*)rsrc->ptr;
/* Just in case the algo has internally allocated resources */
if (hash->context) {
char *dummy = emalloc(hash->ops->digest_size);
hash->ops->hash_final(dummy, hash->context);
efree(dummy);
efree(hash->context);
}
if (hash->key) {
memset(hash->key, 0, hash->ops->block_size);
efree(hash->key);
}
efree(hash);
}
#define PHP_HASH_HAVAL_REGISTER(p,b) php_hash_register_algo("haval" #b "," #p , &php_hash_##p##haval##b##_ops);
/* {{{ PHP_MINIT_FUNCTION
*/
PHP_MINIT_FUNCTION(hash)
{
php_hash_le_hash = zend_register_list_destructors_ex(php_hash_dtor, NULL, PHP_HASH_RESNAME, module_number);
zend_hash_init(&php_hash_hashtable, 35, NULL, NULL, 1);
php_hash_register_algo("md4", &php_hash_md4_ops);
php_hash_register_algo("md5", &php_hash_md5_ops);
php_hash_register_algo("sha1", &php_hash_sha1_ops);
php_hash_register_algo("sha256", &php_hash_sha256_ops);
php_hash_register_algo("sha384", &php_hash_sha384_ops);
php_hash_register_algo("sha512", &php_hash_sha512_ops);
php_hash_register_algo("ripemd128", &php_hash_ripemd128_ops);
php_hash_register_algo("ripemd160", &php_hash_ripemd160_ops);
php_hash_register_algo("whirlpool", &php_hash_whirlpool_ops);
php_hash_register_algo("tiger128,3", &php_hash_3tiger128_ops);
php_hash_register_algo("tiger160,3", &php_hash_3tiger160_ops);
php_hash_register_algo("tiger192,3", &php_hash_3tiger192_ops);
php_hash_register_algo("tiger128,4", &php_hash_4tiger128_ops);
php_hash_register_algo("tiger160,4", &php_hash_4tiger160_ops);
php_hash_register_algo("tiger192,4", &php_hash_4tiger192_ops);
php_hash_register_algo("snefru", &php_hash_snefru_ops);
php_hash_register_algo("gost", &php_hash_gost_ops);
php_hash_register_algo("adler32", &php_hash_adler32_ops);
php_hash_register_algo("crc32", &php_hash_crc32_ops);
php_hash_register_algo("crc32b", &php_hash_crc32b_ops);
PHP_HASH_HAVAL_REGISTER(3,128);
PHP_HASH_HAVAL_REGISTER(3,160);
PHP_HASH_HAVAL_REGISTER(3,192);
PHP_HASH_HAVAL_REGISTER(3,224);
PHP_HASH_HAVAL_REGISTER(3,256);
PHP_HASH_HAVAL_REGISTER(4,128);
PHP_HASH_HAVAL_REGISTER(4,160);
PHP_HASH_HAVAL_REGISTER(4,192);
PHP_HASH_HAVAL_REGISTER(4,224);
PHP_HASH_HAVAL_REGISTER(4,256);
PHP_HASH_HAVAL_REGISTER(5,128);
PHP_HASH_HAVAL_REGISTER(5,160);
PHP_HASH_HAVAL_REGISTER(5,192);
PHP_HASH_HAVAL_REGISTER(5,224);
PHP_HASH_HAVAL_REGISTER(5,256);
REGISTER_LONG_CONSTANT("HASH_HMAC", PHP_HASH_HMAC, CONST_CS | CONST_PERSISTENT);
return SUCCESS;
}
/* }}} */
/* {{{ PHP_MSHUTDOWN_FUNCTION
*/
PHP_MSHUTDOWN_FUNCTION(hash)
{
zend_hash_destroy(&php_hash_hashtable);
return SUCCESS;
}
/* }}} */
/* {{{ PHP_MINFO_FUNCTION
*/
PHP_MINFO_FUNCTION(hash)
{
HashPosition pos;
char buffer[2048];
char *s = buffer, *e = s + sizeof(buffer), *str;
long idx, type;
for(zend_hash_internal_pointer_reset_ex(&php_hash_hashtable, &pos);
(type = zend_hash_get_current_key_ex(&php_hash_hashtable, &str, NULL, &idx, 0, &pos)) != HASH_KEY_NON_EXISTANT;
zend_hash_move_forward_ex(&php_hash_hashtable, &pos)) {
s += snprintf(s, e - s, "%s ", str);
}
*s = 0;
php_info_print_table_start();
php_info_print_table_header(2, "hash support", "enabled");
php_info_print_table_header(2, "Hashing Engines", buffer);
php_info_print_table_end();
}
/* }}} */
/* {{{ hash_functions[]
*/
zend_function_entry hash_functions[] = {
PHP_FE(hash, NULL)
PHP_FE(hash_file, NULL)
PHP_FE(hash_hmac, NULL)
PHP_FE(hash_hmac_file, NULL)
PHP_FE(hash_init, NULL)
PHP_FE(hash_update, NULL)
PHP_FE(hash_update_stream, NULL)
PHP_FE(hash_update_file, NULL)
PHP_FE(hash_final, NULL)
PHP_FE(hash_algos, NULL)
/* BC Land */
#ifdef PHP_HASH_MD5_NOT_IN_CORE
PHP_NAMED_FE(md5, php_if_md5, NULL)
PHP_NAMED_FE(md5_file, php_if_md5_file, NULL)
#endif /* PHP_HASH_MD5_NOT_IN_CORE */
#ifdef PHP_HASH_SHA1_NOT_IN_CORE
PHP_NAMED_FE(sha1, php_if_sha1, NULL)
PHP_NAMED_FE(sha1_file, php_if_sha1_file, NULL)
#endif /* PHP_HASH_SHA1_NOT_IN_CORE */
{NULL, NULL, NULL}
};
/* }}} */
/* {{{ hash_module_entry
*/
zend_module_entry hash_module_entry = {
#if ZEND_MODULE_API_NO >= 20010901
STANDARD_MODULE_HEADER,
#endif
PHP_HASH_EXTNAME,
hash_functions,
PHP_MINIT(hash),
PHP_MSHUTDOWN(hash),
NULL, /* RINIT */
NULL, /* RSHUTDOWN */
PHP_MINFO(hash),
#if ZEND_MODULE_API_NO >= 20010901
PHP_HASH_EXTVER, /* Replace with version number for your extension */
#endif
STANDARD_MODULE_PROPERTIES
};
/* }}} */
#ifdef COMPILE_DL_HASH
ZEND_GET_MODULE(hash)
#endif
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/
-66
View File
@@ -1,66 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2005 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Michael Wallner <mike@php.net> |
| Sara Golemon <pollita@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#include "php_hash.h"
#include "php_hash_adler32.h"
PHP_HASH_API void PHP_ADLER32Init(PHP_ADLER32_CTX *context)
{
context->state = 1;
}
PHP_HASH_API void PHP_ADLER32Update(PHP_ADLER32_CTX *context, const unsigned char *input, size_t len)
{
php_hash_uint32 i, s[2] = { context->state & 0xffff, (context->state >> 16) & 0xffff };
for (i = 0; i < len; ++i) {
s[0] = (s[0] + input[i]) % 65521;
s[1] = (s[1] + s[0]) % 65521;
}
context->state = s[0] + (s[1] << 16);
}
PHP_HASH_API void PHP_ADLER32Final(unsigned char digest[4], PHP_ADLER32_CTX *context)
{
digest[3] = (unsigned char) ((context->state >> 24) & 0xff);
digest[2] = (unsigned char) ((context->state >> 16) & 0xff);
digest[1] = (unsigned char) ((context->state >> 8) & 0xff);
digest[0] = (unsigned char) (context->state & 0xff);
context->state = 0;
}
php_hash_ops php_hash_adler32_ops = {
(php_hash_init_func_t) PHP_ADLER32Init,
(php_hash_update_func_t) PHP_ADLER32Update,
(php_hash_final_func_t) PHP_ADLER32Final,
4, /* what to say here? */
4,
sizeof(PHP_ADLER32_CTX)
};
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: sw=4 ts=4 fdm=marker
* vim<600: sw=4 ts=4
*/
-84
View File
@@ -1,84 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2005 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Michael Wallner <mike@php.net> |
| Sara Golemon <pollita@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#include "php_hash.h"
#include "php_hash_crc32.h"
#include "php_hash_crc32_tables.h"
PHP_HASH_API void PHP_CRC32Init(PHP_CRC32_CTX *context)
{
context->state = ~0;
}
PHP_HASH_API void PHP_CRC32Update(PHP_CRC32_CTX *context, const unsigned char *input, size_t len)
{
size_t i;
for (i = 0; i < len; ++i) {
context->state = (context->state << 8) ^ crc32_table[(context->state >> 24) ^ (input[i] & 0xff)];
}
}
PHP_HASH_API void PHP_CRC32BUpdate(PHP_CRC32_CTX *context, const unsigned char *input, size_t len)
{
size_t i;
for (i = 0; i < len; ++i) {
context->state = (context->state >> 8) ^ crc32b_table[(context->state ^ input[i]) & 0xff];
}
}
PHP_HASH_API void PHP_CRC32Final(unsigned char digest[4], PHP_CRC32_CTX *context)
{
context->state=~context->state;
digest[3] = (unsigned char) ((context->state >> 24) & 0xff);
digest[2] = (unsigned char) ((context->state >> 16) & 0xff);
digest[1] = (unsigned char) ((context->state >> 8) & 0xff);
digest[0] = (unsigned char) (context->state & 0xff);
context->state = 0;
}
php_hash_ops php_hash_crc32_ops = {
(php_hash_init_func_t) PHP_CRC32Init,
(php_hash_update_func_t) PHP_CRC32Update,
(php_hash_final_func_t) PHP_CRC32Final,
4, /* what to say here? */
4,
sizeof(PHP_CRC32_CTX)
};
php_hash_ops php_hash_crc32b_ops = {
(php_hash_init_func_t) PHP_CRC32Init,
(php_hash_update_func_t) PHP_CRC32BUpdate,
(php_hash_final_func_t) PHP_CRC32Final,
4, /* what to say here? */
4,
sizeof(PHP_CRC32_CTX)
};
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: sw=4 ts=4 fdm=marker
* vim<600: sw=4 ts=4
*/
-321
View File
@@ -1,321 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2005 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Michael Wallner <mike@php.net> |
| Sara Golemon <pollita@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#include "php_hash.h"
#include "php_hash_gost.h"
#include "php_hash_gost_tables.h"
/* {{{ Gost()
* derived from gost_compress() by Markku-Juhani Saarinen <mjos@ssh.fi>
*/
#define round(k1, k2) \
t = (k1) + r; \
l ^= tables[0][t & 0xff] ^ tables[1][(t >> 8) & 0xff] ^ \
tables[2][(t >> 16) & 0xff] ^ tables[3][t >> 24]; \
t = (k2) + l; \
r ^= tables[0][t & 0xff] ^ tables[1][(t >> 8) & 0xff] ^ \
tables[2][(t >> 16) & 0xff] ^ tables[3][t >> 24];
#define R(key, h, i, t, l, r) \
r = h[i]; \
l = h[i + 1]; \
round(key[0], key[1]) \
round(key[2], key[3]) \
round(key[4], key[5]) \
round(key[6], key[7]) \
round(key[0], key[1]) \
round(key[2], key[3]) \
round(key[4], key[5]) \
round(key[6], key[7]) \
round(key[0], key[1]) \
round(key[2], key[3]) \
round(key[4], key[5]) \
round(key[6], key[7]) \
round(key[7], key[6]) \
round(key[5], key[4]) \
round(key[3], key[2]) \
round(key[1], key[0]) \
t = r; \
r = l; \
l = t; \
#define X(w, u, v) \
w[0] = u[0] ^ v[0]; \
w[1] = u[1] ^ v[1]; \
w[2] = u[2] ^ v[2]; \
w[3] = u[3] ^ v[3]; \
w[4] = u[4] ^ v[4]; \
w[5] = u[5] ^ v[5]; \
w[6] = u[6] ^ v[6]; \
w[7] = u[7] ^ v[7];
#define P(key, w) \
key[0] = (w[0] & 0x000000ff) | ((w[2] & 0x000000ff) << 8) | \
((w[4] & 0x000000ff) << 16) | ((w[6] & 0x000000ff) << 24); \
key[1] = ((w[0] & 0x0000ff00) >> 8) | (w[2] & 0x0000ff00) | \
((w[4] & 0x0000ff00) << 8) | ((w[6] & 0x0000ff00) << 16); \
key[2] = ((w[0] & 0x00ff0000) >> 16) | ((w[2] & 0x00ff0000) >> 8) | \
(w[4] & 0x00ff0000) | ((w[6] & 0x00ff0000) << 8); \
key[3] = ((w[0] & 0xff000000) >> 24) | ((w[2] & 0xff000000) >> 16) | \
((w[4] & 0xff000000) >> 8) | (w[6] & 0xff000000); \
key[4] = (w[1] & 0x000000ff) | ((w[3] & 0x000000ff) << 8) | \
((w[5] & 0x000000ff) << 16) | ((w[7] & 0x000000ff) << 24); \
key[5] = ((w[1] & 0x0000ff00) >> 8) | (w[3] & 0x0000ff00) | \
((w[5] & 0x0000ff00) << 8) | ((w[7] & 0x0000ff00) << 16); \
key[6] = ((w[1] & 0x00ff0000) >> 16) | ((w[3] & 0x00ff0000) >> 8) | \
(w[5] & 0x00ff0000) | ((w[7] & 0x00ff0000) << 8); \
key[7] = ((w[1] & 0xff000000) >> 24) | ((w[3] & 0xff000000) >> 16) | \
((w[5] & 0xff000000) >> 8) | (w[7] & 0xff000000);
#define A(x, l, r) \
l = x[0] ^ x[2]; \
r = x[1] ^ x[3]; \
x[0] = x[2]; \
x[1] = x[3]; \
x[2] = x[4]; \
x[3] = x[5]; \
x[4] = x[6]; \
x[5] = x[7]; \
x[6] = l; \
x[7] = r;
#define AA(x, l, r) \
l = x[0]; \
r = x[2]; \
x[0] = x[4]; \
x[2] = x[6]; \
x[4] = l ^ r; \
x[6] = x[0] ^ r; \
l = x[1]; \
r = x[3]; \
x[1] = x[5]; \
x[3] = x[7]; \
x[5] = l ^ r; \
x[7] = x[1] ^ r;
#define C(x) \
x[0] ^= 0xff00ff00; \
x[1] ^= 0xff00ff00; \
x[2] ^= 0x00ff00ff; \
x[3] ^= 0x00ff00ff; \
x[4] ^= 0x00ffff00; \
x[5] ^= 0xff0000ff; \
x[6] ^= 0x000000ff; \
x[7] ^= 0xff00ffff;
#define S(s, l, r) \
s[i] = r; \
s[i + 1] = l;
#define SHIFT12(u, m, s) \
u[0] = m[0] ^ s[6]; \
u[1] = m[1] ^ s[7]; \
u[2] = m[2] ^ (s[0] << 16) ^ (s[0] >> 16) ^ (s[0] & 0xffff) ^ \
(s[1] & 0xffff) ^ (s[1] >> 16) ^ (s[2] << 16) ^ s[6] ^ (s[6] << 16) ^ \
(s[7] & 0xffff0000) ^ (s[7] >> 16); \
u[3] = m[3] ^ (s[0] & 0xffff) ^ (s[0] << 16) ^ (s[1] & 0xffff) ^ \
(s[1] << 16) ^ (s[1] >> 16) ^ (s[2] << 16) ^ (s[2] >> 16) ^ \
(s[3] << 16) ^ s[6] ^ (s[6] << 16) ^ (s[6] >> 16) ^ (s[7] & 0xffff) ^ \
(s[7] << 16) ^ (s[7] >> 16); \
u[4] = m[4] ^ \
(s[0] & 0xffff0000) ^ (s[0] << 16) ^ (s[0] >> 16) ^ \
(s[1] & 0xffff0000) ^ (s[1] >> 16) ^ (s[2] << 16) ^ (s[2] >> 16) ^ \
(s[3] << 16) ^ (s[3] >> 16) ^ (s[4] << 16) ^ (s[6] << 16) ^ \
(s[6] >> 16) ^(s[7] & 0xffff) ^ (s[7] << 16) ^ (s[7] >> 16); \
u[5] = m[5] ^ (s[0] << 16) ^ (s[0] >> 16) ^ (s[0] & 0xffff0000) ^ \
(s[1] & 0xffff) ^ s[2] ^ (s[2] >> 16) ^ (s[3] << 16) ^ (s[3] >> 16) ^ \
(s[4] << 16) ^ (s[4] >> 16) ^ (s[5] << 16) ^ (s[6] << 16) ^ \
(s[6] >> 16) ^ (s[7] & 0xffff0000) ^ (s[7] << 16) ^ (s[7] >> 16); \
u[6] = m[6] ^ s[0] ^ (s[1] >> 16) ^ (s[2] << 16) ^ s[3] ^ (s[3] >> 16) ^ \
(s[4] << 16) ^ (s[4] >> 16) ^ (s[5] << 16) ^ (s[5] >> 16) ^ s[6] ^ \
(s[6] << 16) ^ (s[6] >> 16) ^ (s[7] << 16); \
u[7] = m[7] ^ (s[0] & 0xffff0000) ^ (s[0] << 16) ^ (s[1] & 0xffff) ^ \
(s[1] << 16) ^ (s[2] >> 16) ^ (s[3] << 16) ^ s[4] ^ (s[4] >> 16) ^ \
(s[5] << 16) ^ (s[5] >> 16) ^ (s[6] >> 16) ^ (s[7] & 0xffff) ^ \
(s[7] << 16) ^ (s[7] >> 16);
#define SHIFT16(h, v, u) \
v[0] = h[0] ^ (u[1] << 16) ^ (u[0] >> 16); \
v[1] = h[1] ^ (u[2] << 16) ^ (u[1] >> 16); \
v[2] = h[2] ^ (u[3] << 16) ^ (u[2] >> 16); \
v[3] = h[3] ^ (u[4] << 16) ^ (u[3] >> 16); \
v[4] = h[4] ^ (u[5] << 16) ^ (u[4] >> 16); \
v[5] = h[5] ^ (u[6] << 16) ^ (u[5] >> 16); \
v[6] = h[6] ^ (u[7] << 16) ^ (u[6] >> 16); \
v[7] = h[7] ^ (u[0] & 0xffff0000) ^ (u[0] << 16) ^ (u[7] >> 16) ^ \
(u[1] & 0xffff0000) ^ (u[1] << 16) ^ (u[6] << 16) ^ (u[7] & 0xffff0000);
#define SHIFT61(h, v) \
h[0] = (v[0] & 0xffff0000) ^ (v[0] << 16) ^ (v[0] >> 16) ^ (v[1] >> 16) ^ \
(v[1] & 0xffff0000) ^ (v[2] << 16) ^ (v[3] >> 16) ^ (v[4] << 16) ^ \
(v[5] >> 16) ^ v[5] ^ (v[6] >> 16) ^ (v[7] << 16) ^ (v[7] >> 16) ^ \
(v[7] & 0xffff); \
h[1] = (v[0] << 16) ^ (v[0] >> 16) ^ (v[0] & 0xffff0000) ^ (v[1] & 0xffff) ^ \
v[2] ^ (v[2] >> 16) ^ (v[3] << 16) ^ (v[4] >> 16) ^ (v[5] << 16) ^ \
(v[6] << 16) ^ v[6] ^ (v[7] & 0xffff0000) ^ (v[7] >> 16); \
h[2] = (v[0] & 0xffff) ^ (v[0] << 16) ^ (v[1] << 16) ^ (v[1] >> 16) ^ \
(v[1] & 0xffff0000) ^ (v[2] << 16) ^ (v[3] >> 16) ^ v[3] ^ (v[4] << 16) ^ \
(v[5] >> 16) ^ v[6] ^ (v[6] >> 16) ^ (v[7] & 0xffff) ^ (v[7] << 16) ^ \
(v[7] >> 16); \
h[3] = (v[0] << 16) ^ (v[0] >> 16) ^ (v[0] & 0xffff0000) ^ \
(v[1] & 0xffff0000) ^ (v[1] >> 16) ^ (v[2] << 16) ^ (v[2] >> 16) ^ v[2] ^ \
(v[3] << 16) ^ (v[4] >> 16) ^ v[4] ^ (v[5] << 16) ^ (v[6] << 16) ^ \
(v[7] & 0xffff) ^ (v[7] >> 16); \
h[4] = (v[0] >> 16) ^ (v[1] << 16) ^ v[1] ^ (v[2] >> 16) ^ v[2] ^ \
(v[3] << 16) ^ (v[3] >> 16) ^ v[3] ^ (v[4] << 16) ^ (v[5] >> 16) ^ \
v[5] ^ (v[6] << 16) ^ (v[6] >> 16) ^ (v[7] << 16); \
h[5] = (v[0] << 16) ^ (v[0] & 0xffff0000) ^ (v[1] << 16) ^ (v[1] >> 16) ^ \
(v[1] & 0xffff0000) ^ (v[2] << 16) ^ v[2] ^ (v[3] >> 16) ^ v[3] ^ \
(v[4] << 16) ^ (v[4] >> 16) ^ v[4] ^ (v[5] << 16) ^ (v[6] << 16) ^ \
(v[6] >> 16) ^ v[6] ^ (v[7] << 16) ^ (v[7] >> 16) ^ (v[7] & 0xffff0000); \
h[6] = v[0] ^ v[2] ^ (v[2] >> 16) ^ v[3] ^ (v[3] << 16) ^ v[4] ^ \
(v[4] >> 16) ^ (v[5] << 16) ^ (v[5] >> 16) ^ v[5] ^ (v[6] << 16) ^ \
(v[6] >> 16) ^ v[6] ^ (v[7] << 16) ^ v[7]; \
h[7] = v[0] ^ (v[0] >> 16) ^ (v[1] << 16) ^ (v[1] >> 16) ^ (v[2] << 16) ^ \
(v[3] >> 16) ^ v[3] ^ (v[4] << 16) ^ v[4] ^ (v[5] >> 16) ^ v[5] ^ \
(v[6] << 16) ^ (v[6] >> 16) ^ (v[7] << 16) ^ v[7];
#define PASS \
X(w, u, v); \
P(key, w); \
R(key, h, i, t, l, r); \
S(s, l, r); \
if (i != 6) { \
A(u, l, r); \
if (i == 2) { \
C(u); \
} \
AA(v, l, r); \
}
static inline void Gost(php_hash_uint32 state[8], php_hash_uint32 data[8])
{
int i;
php_hash_uint32 l, r, t, key[8], u[8], v[8], w[8], s[8], *h = state, *m = data;
memcpy(u, state, sizeof(u));
memcpy(v, data, sizeof(v));
for (i = 0; i < 8; i += 2) {
PASS;
}
SHIFT12(u, m, s);
SHIFT16(h, v, u);
SHIFT61(h, v);
}
/* }}} */
static inline void GostTransform(PHP_GOST_CTX *context, const unsigned char input[32])
{
int i, j;
php_hash_uint32 data[8], temp = 0, save = 0;
for (i = 0, j = 0; i < 8; ++i, j += 4) {
data[i] = ((php_hash_uint32) input[j]) | (((php_hash_uint32) input[j + 1]) << 8) |
(((php_hash_uint32) input[j + 2]) << 16) | (((php_hash_uint32) input[j + 3]) << 24);
save = context->state[i + 8];
context->state[i + 8] += data[i] + temp;
temp = ((context->state[i + 8] < data[i]) || (context->state[i + 8] < save)) ? 1 : 0;
}
Gost(context->state, data);
}
PHP_HASH_API void PHP_GOSTInit(PHP_GOST_CTX *context)
{
memset(context, 0, sizeof(*context));
}
static const php_hash_uint32 MAX32 = 0xffffffffLU;
PHP_HASH_API void PHP_GOSTUpdate(PHP_GOST_CTX *context, const unsigned char *input, size_t len)
{
if ((MAX32 - context->count[0]) < (len * 8)) {
context->count[1]++;
context->count[0] = MAX32 - context->count[0];
context->count[0] = (len * 8) - context->count[0];
} else {
context->count[0] += len * 8;
}
if (context->length + len < 32) {
memcpy(&context->buffer[context->length], input, len);
context->length += len;
} else {
size_t i = 0, r = (context->length + len) % 32;
if (context->length) {
i = 32 - context->length;
memcpy(&context->buffer[context->length], input, i);
GostTransform(context, context->buffer);
}
for (; i + 32 <= len; i += 32) {
GostTransform(context, input + i);
}
memcpy(context->buffer, input + i, r);
memset(&context->buffer[r], 0, 32 - r);
context->length = r;
}
}
PHP_HASH_API void PHP_GOSTFinal(unsigned char digest[32], PHP_GOST_CTX *context)
{
php_hash_uint32 i, j, l[8] = {0};
if (context->length) {
GostTransform(context, context->buffer);
}
memcpy(l, context->count, sizeof(context->count));
Gost(context->state, l);
memcpy(l, &context->state[8], sizeof(l));
Gost(context->state, l);
for (i = 0, j = 0; j < 32; i++, j += 4) {
digest[j] = (unsigned char) (context->state[i] & 0xff);
digest[j + 1] = (unsigned char) ((context->state[i] >> 8) & 0xff);
digest[j + 2] = (unsigned char) ((context->state[i] >> 16) & 0xff);
digest[j + 3] = (unsigned char) ((context->state[i] >> 24) & 0xff);
}
memset(context, 0, sizeof(*context));
}
php_hash_ops php_hash_gost_ops = {
(php_hash_init_func_t) PHP_GOSTInit,
(php_hash_update_func_t) PHP_GOSTUpdate,
(php_hash_final_func_t) PHP_GOSTFinal,
32,
32,
sizeof(PHP_GOST_CTX)
};
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: sw=4 ts=4 fdm=marker
* vim<600: sw=4 ts=4
*/
-550
View File
@@ -1,550 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2005 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Sara Golemon <pollita@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#include "php_hash.h"
#include "php_hash_haval.h"
static unsigned char PADDING[128] ={
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
static php_hash_uint32 D0[8] = {
0x243F6A88, 0x85A308D3, 0x13198A2E, 0x03707344, 0xA4093822, 0x299F31D0, 0x082EFA98, 0xEC4E6C89 };
static php_hash_uint32 K2[32] = {
0x452821E6, 0x38D01377, 0xBE5466CF, 0x34E90C6C, 0xC0AC29B7, 0xC97C50DD, 0x3F84D5B5, 0xB5470917,
0x9216D5D9, 0x8979FB1B, 0xD1310BA6, 0x98DFB5AC, 0x2FFD72DB, 0xD01ADFB7, 0xB8E1AFED, 0x6A267E96,
0xBA7C9045, 0xF12C7F99, 0x24A19947, 0xB3916CF7, 0x0801F2E2, 0x858EFC16, 0x636920D8, 0x71574E69,
0xA458FEA3, 0xF4933D7E, 0x0D95748F, 0x728EB658, 0x718BCD58, 0x82154AEE, 0x7B54A41D, 0xC25A59B5 };
static php_hash_uint32 K3[32] = {
0x9C30D539, 0x2AF26013, 0xC5D1B023, 0x286085F0, 0xCA417918, 0xB8DB38EF, 0x8E79DCB0, 0x603A180E,
0x6C9E0E8B, 0xB01E8A3E, 0xD71577C1, 0xBD314B27, 0x78AF2FDA, 0x55605C60, 0xE65525F3, 0xAA55AB94,
0x57489862, 0x63E81440, 0x55CA396A, 0x2AAB10B6, 0xB4CC5C34, 0x1141E8CE, 0xA15486AF, 0x7C72E993,
0xB3EE1411, 0x636FBC2A, 0x2BA9C55D, 0x741831F6, 0xCE5C3E16, 0x9B87931E, 0xAFD6BA33, 0x6C24CF5C };
static php_hash_uint32 K4[32] = {
0x7A325381, 0x28958677, 0x3B8F4898, 0x6B4BB9AF, 0xC4BFE81B, 0x66282193, 0x61D809CC, 0xFB21A991,
0x487CAC60, 0x5DEC8032, 0xEF845D5D, 0xE98575B1, 0xDC262302, 0xEB651B88, 0x23893E81, 0xD396ACC5,
0x0F6D6FF3, 0x83F44239, 0x2E0B4482, 0xA4842004, 0x69C8F04A, 0x9E1F9B5E, 0x21C66842, 0xF6E96C9A,
0x670C9C61, 0xABD388F0, 0x6A51A0D2, 0xD8542F68, 0x960FA728, 0xAB5133A3, 0x6EEF0B6C, 0x137A3BE4 };
static php_hash_uint32 K5[32] = {
0xBA3BF050, 0x7EFB2A98, 0xA1F1651D, 0x39AF0176, 0x66CA593E, 0x82430E88, 0x8CEE8619, 0x456F9FB4,
0x7D84A5C3, 0x3B8B5EBE, 0xE06F75D8, 0x85C12073, 0x401A449F, 0x56C16AA6, 0x4ED3AA62, 0x363F7706,
0x1BFEDF72, 0x429B023D, 0x37D0D724, 0xD00A1248, 0xDB0FEAD3, 0x49F1C09B, 0x075372C9, 0x80991B7B,
0x25D479D8, 0xF6E8DEF7, 0xE3FE501A, 0xB6794C3B, 0x976CE0BD, 0x04C006BA, 0xC1A94FB6, 0x409F60C4 };
static short I2[32] = { 5, 14, 26, 18, 11, 28, 7, 16, 0, 23, 20, 22, 1, 10, 4, 8,
30, 3, 21, 9, 17, 24, 29, 6, 19, 12, 15, 13, 2, 25, 31, 27 };
static short I3[32] = { 19, 9, 4, 20, 28, 17, 8, 22, 29, 14, 25, 12, 24, 30, 16, 26,
31, 15, 7, 3, 1, 0, 18, 27, 13, 6, 21, 10, 23, 11, 5, 2 };
static short I4[32] = { 24, 4, 0, 14, 2, 7, 28, 23, 26, 6, 30, 20, 18, 25, 19, 3,
22, 11, 31, 21, 8, 27, 12, 9, 1, 29, 5, 15, 17, 10, 16, 13 };
static short I5[32] = { 27, 3, 21, 26, 17, 11, 20, 29, 19, 0, 12, 7, 13, 8, 31, 10,
5, 9, 14, 30, 18, 6, 28, 24, 2, 23, 16, 22, 4, 1, 25, 15 };
static short M0[32] = { 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1,
0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1 };
static short M1[32] = { 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2,
1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2 };
static short M2[32] = { 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3,
2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3 };
static short M3[32] = { 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4,
3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4 };
static short M4[32] = { 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5,
4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5 };
static short M5[32] = { 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6,
5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6 };
static short M6[32] = { 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7,
6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7 };
static short M7[32] = { 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0,
7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0 };
/* {{{ Encode
Encodes input (php_hash_uint32) into output (unsigned char). Assumes len is
a multiple of 4.
*/
static void Encode(unsigned char *output, php_hash_uint32 *input, unsigned int len)
{
unsigned int i, j;
for (i = 0, j = 0; j < len; i++, j += 4) {
output[j] = (unsigned char) (input[i] & 0xff);
output[j + 1] = (unsigned char) ((input[i] >> 8) & 0xff);
output[j + 2] = (unsigned char) ((input[i] >> 16) & 0xff);
output[j + 3] = (unsigned char) ((input[i] >> 24) & 0xff);
}
}
/* }}} */
/* {{{ Decode
Decodes input (unsigned char) into output (php_hash_uint32). Assumes len is
a multiple of 4.
*/
static void Decode(php_hash_uint32 *output, const unsigned char *input, unsigned int len)
{
unsigned int i, j;
for (i = 0, j = 0; j < len; i++, j += 4) {
output[i] = ((php_hash_uint32) input[j]) | (((php_hash_uint32) input[j + 1]) << 8) |
(((php_hash_uint32) input[j + 2]) << 16) | (((php_hash_uint32) input[j + 3]) << 24);
}
}
/* }}} */
#define F1(x6,x5,x4,x3,x2,x1,x0) ( ((x1) & (x4)) ^ ((x2) & (x5)) ^ ((x3) & (x6)) ^ ((x0) & (x1)) ^ (x0) )
#define F2(x6,x5,x4,x3,x2,x1,x0) ( ((x1) & (x2) & (x3)) ^ ((x2) & (x4) & (x5)) ^ ((x1) & (x2)) ^ ((x1) & (x4)) ^ \
((x2) & (x6)) ^ ((x3) & (x5)) ^ ((x4) & (x5)) ^ ((x0) & (x2)) ^ (x0) )
#define F3(x6,x5,x4,x3,x2,x1,x0) ( ((x1) & (x2) & (x3)) ^ ((x1) & (x4)) ^ ((x2) & (x5)) ^ ((x3) & (x6)) ^ ((x0) & (x3)) ^ (x0) )
#define F4(x6,x5,x4,x3,x2,x1,x0) ( ((x1) & (x2) & (x3)) ^ ((x2) & (x4) & (x5)) ^ ((x3) & (x4) & (x6)) ^ \
((x1) & (x4)) ^ ((x2) & (x6)) ^ ((x3) & (x4)) ^ ((x3) & (x5)) ^ \
((x3) & (x6)) ^ ((x4) & (x5)) ^ ((x4) & (x6)) ^ ((x0) & (x4)) ^ (x0) )
#define F5(x6,x5,x4,x3,x2,x1,x0) ( ((x1) & (x4)) ^ ((x2) & (x5)) ^ ((x3) & (x6)) ^ \
((x0) & (x1) & (x2) & (x3)) ^ ((x0) & (x5)) ^ (x0) )
#define ROTR(x,n) (((x) >> (n)) | ((x) << (32 - (n))))
/* {{{ PHP_3HAVALTransform
*/
static void PHP_3HAVALTransform(php_hash_uint32 state[8], const unsigned char block[128])
{
php_hash_uint32 E[8];
php_hash_uint32 x[32];
int i;
Decode(x, block, 128);
for(i = 0; i < 8; i++) {
E[i] = state[i];
}
for(i = 0; i < 32; i++) {
E[7 - (i % 8)] = ROTR(F1(E[M1[i]],E[M0[i]],E[M3[i]],E[M5[i]],E[M6[i]],E[M2[i]],E[M4[i]]),7) + ROTR(E[M7[i]],11) + x[i];
}
for(i = 0; i < 32; i++) {
E[7 - (i % 8)] = ROTR(F2(E[M4[i]],E[M2[i]],E[M1[i]],E[M0[i]],E[M5[i]],E[M3[i]],E[M6[i]]),7) + ROTR(E[M7[i]],11) + x[I2[i]] + K2[i];
}
for(i = 0; i < 32; i++) {
E[7 - (i % 8)] = ROTR(F3(E[M6[i]],E[M1[i]],E[M2[i]],E[M3[i]],E[M4[i]],E[M5[i]],E[M0[i]]),7) + ROTR(E[M7[i]],11) + x[I3[i]] + K3[i];
}
/* Update digest */
for(i = 0; i < 8; i++) {
state[i] += E[i];
}
/* Zeroize sensitive information. */
memset((unsigned char*) x, 0, sizeof(x));
}
/* }}} */
/* {{{ PHP_4HAVALTransform
*/
static void PHP_4HAVALTransform(php_hash_uint32 state[8], const unsigned char block[128])
{
php_hash_uint32 E[8];
php_hash_uint32 x[32];
int i;
Decode(x, block, 128);
for(i = 0; i < 8; i++) {
E[i] = state[i];
}
for(i = 0; i < 32; i++) {
E[7 - (i % 8)] = ROTR(F1(E[M2[i]],E[M6[i]],E[M1[i]],E[M4[i]],E[M5[i]],E[M3[i]],E[M0[i]]),7) + ROTR(E[M7[i]],11) + x[i];
}
for(i = 0; i < 32; i++) {
E[7 - (i % 8)] = ROTR(F2(E[M3[i]],E[M5[i]],E[M2[i]],E[M0[i]],E[M1[i]],E[M6[i]],E[M4[i]]),7) + ROTR(E[M7[i]],11) + x[I2[i]] + K2[i];
}
for(i = 0; i < 32; i++) {
E[7 - (i % 8)] = ROTR(F3(E[M1[i]],E[M4[i]],E[M3[i]],E[M6[i]],E[M0[i]],E[M2[i]],E[M5[i]]),7) + ROTR(E[M7[i]],11) + x[I3[i]] + K3[i];
}
for(i = 0; i < 32; i++) {
E[7 - (i % 8)] = ROTR(F4(E[M6[i]],E[M4[i]],E[M0[i]],E[M5[i]],E[M2[i]],E[M1[i]],E[M3[i]]),7) + ROTR(E[M7[i]],11) + x[I4[i]] + K4[i];
}
/* Update digest */
for(i = 0; i < 8; i++) {
state[i] += E[i];
}
/* Zeroize sensitive information. */
memset((unsigned char*) x, 0, sizeof(x));
}
/* }}} */
/* {{{ PHP_5HAVALTransform
*/
static void PHP_5HAVALTransform(php_hash_uint32 state[8], const unsigned char block[128])
{
php_hash_uint32 E[8];
php_hash_uint32 x[32];
int i;
Decode(x, block, 128);
for(i = 0; i < 8; i++) {
E[i] = state[i];
}
for(i = 0; i < 32; i++) {
E[7 - (i % 8)] = ROTR(F1(E[M3[i]],E[M4[i]],E[M1[i]],E[M0[i]],E[M5[i]],E[M2[i]],E[M6[i]]),7) + ROTR(E[M7[i]],11) + x[i];
}
for(i = 0; i < 32; i++) {
E[7 - (i % 8)] = ROTR(F2(E[M6[i]],E[M2[i]],E[M1[i]],E[M0[i]],E[M3[i]],E[M4[i]],E[M5[i]]),7) + ROTR(E[M7[i]],11) + x[I2[i]] + K2[i];
}
for(i = 0; i < 32; i++) {
E[7 - (i % 8)] = ROTR(F3(E[M2[i]],E[M6[i]],E[M0[i]],E[M4[i]],E[M3[i]],E[M1[i]],E[M5[i]]),7) + ROTR(E[M7[i]],11) + x[I3[i]] + K3[i];
}
for(i = 0; i < 32; i++) {
E[7 - (i % 8)] = ROTR(F4(E[M1[i]],E[M5[i]],E[M3[i]],E[M2[i]],E[M0[i]],E[M4[i]],E[M6[i]]),7) + ROTR(E[M7[i]],11) + x[I4[i]] + K4[i];
}
for(i = 0; i < 32; i++) {
E[7 - (i % 8)] = ROTR(F5(E[M2[i]],E[M5[i]],E[M0[i]],E[M6[i]],E[M4[i]],E[M3[i]],E[M1[i]]),7) + ROTR(E[M7[i]],11) + x[I5[i]] + K5[i];
}
/* Update digest */
for(i = 0; i < 8; i++) {
state[i] += E[i];
}
/* Zeroize sensitive information. */
memset((unsigned char*) x, 0, sizeof(x));
}
/* }}} */
#define PHP_HASH_HAVAL_INIT(p,b) \
php_hash_ops php_hash_##p##haval##b##_ops = { \
(php_hash_init_func_t) PHP_##p##HAVAL##b##Init, \
(php_hash_update_func_t) PHP_HAVALUpdate, \
(php_hash_final_func_t) PHP_HAVAL##b##Final, \
((b) / 8), 128, sizeof(PHP_HAVAL_CTX) }; \
PHP_HASH_API void PHP_##p##HAVAL##b##Init(PHP_HAVAL_CTX *context) \
{ int i; context->count[0] = context->count[1] = 0; \
for(i = 0; i < 8; i++) context->state[i] = D0[i]; \
context->passes = p; context->output = b; \
context->Transform = PHP_##p##HAVALTransform; }
PHP_HASH_HAVAL_INIT(3,128)
PHP_HASH_HAVAL_INIT(3,160)
PHP_HASH_HAVAL_INIT(3,192)
PHP_HASH_HAVAL_INIT(3,224)
PHP_HASH_HAVAL_INIT(3,256)
PHP_HASH_HAVAL_INIT(4,128)
PHP_HASH_HAVAL_INIT(4,160)
PHP_HASH_HAVAL_INIT(4,192)
PHP_HASH_HAVAL_INIT(4,224)
PHP_HASH_HAVAL_INIT(4,256)
PHP_HASH_HAVAL_INIT(5,128)
PHP_HASH_HAVAL_INIT(5,160)
PHP_HASH_HAVAL_INIT(5,192)
PHP_HASH_HAVAL_INIT(5,224)
PHP_HASH_HAVAL_INIT(5,256)
/* {{{ PHP_HAVALUpdate
*/
PHP_HASH_API void PHP_HAVALUpdate(PHP_HAVAL_CTX *context, const unsigned char *input, unsigned int inputLen)
{
unsigned int i, index, partLen;
/* Compute number of bytes mod 128 */
index = (unsigned int) ((context->count[0] >> 3) & 0x7F);
/* Update number of bits */
if ((context->count[0] += ((php_hash_uint32) inputLen << 3)) < ((php_hash_uint32) inputLen << 3)) {
context->count[1]++;
}
context->count[1] += ((php_hash_uint32) inputLen >> 29);
partLen = 128 - index;
/* Transform as many times as possible.
*/
if (inputLen >= partLen) {
memcpy((unsigned char*) & context->buffer[index], (unsigned char*) input, partLen);
context->Transform(context->state, context->buffer);
for (i = partLen; i + 127 < inputLen; i += 128) {
context->Transform(context->state, &input[i]);
}
index = 0;
} else {
i = 0;
}
/* Buffer remaining input */
memcpy((unsigned char*) &context->buffer[index], (unsigned char*) &input[i], inputLen - i);
}
/* }}} */
#define PHP_HASH_HAVAL_VERSION 0x01
/* {{{ PHP_HAVAL128Final
*/
PHP_HASH_API void PHP_HAVAL128Final(unsigned char *digest, PHP_HAVAL_CTX * context)
{
unsigned char bits[10];
unsigned int index, padLen;
/* Version, Passes, and Digest Length */
bits[0] = (PHP_HASH_HAVAL_VERSION & 0x07) |
((context->passes & 0x07) << 3) |
((context->output & 0x03) << 6);
bits[1] = (context->output >> 2);
/* Save number of bits */
Encode(bits + 2, context->count, 8);
/* Pad out to 118 mod 128.
*/
index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
padLen = (index < 118) ? (118 - index) : (246 - index);
PHP_HAVALUpdate(context, PADDING, padLen);
/* Append version, passes, digest length, and message length */
PHP_HAVALUpdate(context, bits, 10);
/* Store state in digest */
context->state[3] += (context->state[7] & 0xFF000000) |
(context->state[6] & 0x00FF0000) |
(context->state[5] & 0x0000FF00) |
(context->state[4] & 0x000000FF);
context->state[2] += (((context->state[7] & 0x00FF0000) |
(context->state[6] & 0x0000FF00) |
(context->state[5] & 0x000000FF)) << 8) |
((context->state[4] & 0xFF000000) >> 24);
context->state[1] += (((context->state[7] & 0x0000FF00) |
(context->state[6] & 0x000000FF)) << 16) |
(((context->state[5] & 0xFF000000) |
(context->state[4] & 0x00FF0000)) >> 16);
context->state[0] += ((context->state[7] & 0x000000FF) << 24) |
(((context->state[6] & 0xFF000000) |
(context->state[5] & 0x00FF0000) |
(context->state[4] & 0x0000FF00)) >> 8);
Encode(digest, context->state, 16);
/* Zeroize sensitive information.
*/
memset((unsigned char*) context, 0, sizeof(*context));
}
/* }}} */
/* {{{ PHP_HAVAL160Final
*/
PHP_HASH_API void PHP_HAVAL160Final(unsigned char *digest, PHP_HAVAL_CTX * context)
{
unsigned char bits[10];
unsigned int index, padLen;
/* Version, Passes, and Digest Length */
bits[0] = (PHP_HASH_HAVAL_VERSION & 0x07) |
((context->passes & 0x07) << 3) |
((context->output & 0x03) << 6);
bits[1] = (context->output >> 2);
/* Save number of bits */
Encode(bits + 2, context->count, 8);
/* Pad out to 118 mod 128.
*/
index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
padLen = (index < 118) ? (118 - index) : (246 - index);
PHP_HAVALUpdate(context, PADDING, padLen);
/* Append version, passes, digest length, and message length */
PHP_HAVALUpdate(context, bits, 10);
/* Store state in digest */
context->state[4] += ((context->state[7] & 0xFE000000) |
(context->state[6] & 0x01F80000) |
(context->state[5] & 0x0007F000)) >> 12;
context->state[3] += ((context->state[7] & 0x01F80000) |
(context->state[6] & 0x0007F000) |
(context->state[5] & 0x00000FC0)) >> 6;
context->state[2] += (context->state[7] & 0x0007F000) |
(context->state[6] & 0x00000FC0) |
(context->state[5] & 0x0000003F);
context->state[1] += ROTR((context->state[7] & 0x00000FC0) |
(context->state[6] & 0x0000003F) |
(context->state[5] & 0xFE000000), 25);
context->state[0] += ROTR((context->state[7] & 0x0000003F) |
(context->state[6] & 0xFE000000) |
(context->state[5] & 0x01F80000), 19);
Encode(digest, context->state, 20);
/* Zeroize sensitive information.
*/
memset((unsigned char*) context, 0, sizeof(*context));
}
/* }}} */
/* {{{ PHP_HAVAL192Final
*/
PHP_HASH_API void PHP_HAVAL192Final(unsigned char *digest, PHP_HAVAL_CTX * context)
{
unsigned char bits[10];
unsigned int index, padLen;
/* Version, Passes, and Digest Length */
bits[0] = (PHP_HASH_HAVAL_VERSION & 0x07) |
((context->passes & 0x07) << 3) |
((context->output & 0x03) << 6);
bits[1] = (context->output >> 2);
/* Save number of bits */
Encode(bits + 2, context->count, 8);
/* Pad out to 118 mod 128.
*/
index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
padLen = (index < 118) ? (118 - index) : (246 - index);
PHP_HAVALUpdate(context, PADDING, padLen);
/* Append version, passes, digest length, and message length */
PHP_HAVALUpdate(context, bits, 10);
/* Store state in digest */
context->state[5] += ((context->state[7] & 0xFC000000) | (context->state[6] & 0x03E00000)) >> 21;
context->state[4] += ((context->state[7] & 0x03E00000) | (context->state[6] & 0x001F0000)) >> 16;
context->state[3] += ((context->state[7] & 0x001F0000) | (context->state[6] & 0x0000FC00)) >> 10;
context->state[2] += ((context->state[7] & 0x0000FC00) | (context->state[6] & 0x000003E0)) >> 5;
context->state[1] += (context->state[7] & 0x000003E0) | (context->state[6] & 0x0000001F);
context->state[0] += ROTR((context->state[7] & 0x0000001F) | (context->state[6] & 0xFC000000), 26);
Encode(digest, context->state, 24);
/* Zeroize sensitive information.
*/
memset((unsigned char*) context, 0, sizeof(*context));
}
/* }}} */
/* {{{ PHP_HAVAL224Final
*/
PHP_HASH_API void PHP_HAVAL224Final(unsigned char *digest, PHP_HAVAL_CTX * context)
{
unsigned char bits[10];
unsigned int index, padLen;
/* Version, Passes, and Digest Length */
bits[0] = (PHP_HASH_HAVAL_VERSION & 0x07) |
((context->passes & 0x07) << 3) |
((context->output & 0x03) << 6);
bits[1] = (context->output >> 2);
/* Save number of bits */
Encode(bits + 2, context->count, 8);
/* Pad out to 118 mod 128.
*/
index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
padLen = (index < 118) ? (118 - index) : (246 - index);
PHP_HAVALUpdate(context, PADDING, padLen);
/* Append version, passes, digest length, and message length */
PHP_HAVALUpdate(context, bits, 10);
/* Store state in digest */
context->state[6] += context->state[7] & 0x0000000F;
context->state[5] += (context->state[7] >> 4) & 0x0000001F;
context->state[4] += (context->state[7] >> 9) & 0x0000000F;
context->state[3] += (context->state[7] >> 13) & 0x0000001F;
context->state[2] += (context->state[7] >> 18) & 0x0000000F;
context->state[1] += (context->state[7] >> 22) & 0x0000001F;
context->state[0] += (context->state[7] >> 27) & 0x0000001F;
Encode(digest, context->state, 28);
/* Zeroize sensitive information.
*/
memset((unsigned char*) context, 0, sizeof(*context));
}
/* }}} */
/* {{{ PHP_HAVAL256Final
*/
PHP_HASH_API void PHP_HAVAL256Final(unsigned char *digest, PHP_HAVAL_CTX * context)
{
unsigned char bits[10];
unsigned int index, padLen;
/* Version, Passes, and Digest Length */
bits[0] = (PHP_HASH_HAVAL_VERSION & 0x07) |
((context->passes & 0x07) << 3) |
((context->output & 0x03) << 6);
bits[1] = (context->output >> 2);
/* Save number of bits */
Encode(bits + 2, context->count, 8);
/* Pad out to 118 mod 128.
*/
index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
padLen = (index < 118) ? (118 - index) : (246 - index);
PHP_HAVALUpdate(context, PADDING, padLen);
/* Append version, passes, digest length, and message length */
PHP_HAVALUpdate(context, bits, 10);
/* Store state in digest */
Encode(digest, context->state, 32);
/* Zeroize sensitive information.
*/
memset((unsigned char*) context, 0, sizeof(*context));
}
/* }}} */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: sw=4 ts=4 fdm=marker
* vim<600: sw=4 ts=4
*/
-589
View File
@@ -1,589 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2005 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Taken from: ext/standard/md5.c |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#include "php_hash.h"
#include "php_hash_md.h"
php_hash_ops php_hash_md5_ops = {
(php_hash_init_func_t) PHP_MD5Init,
(php_hash_update_func_t) PHP_MD5Update,
(php_hash_final_func_t) PHP_MD5Final,
16,
64,
sizeof(PHP_MD5_CTX)
};
php_hash_ops php_hash_md4_ops = {
(php_hash_init_func_t) PHP_MD4Init,
(php_hash_update_func_t) PHP_MD4Update,
(php_hash_final_func_t) PHP_MD4Final,
16,
64,
sizeof(PHP_MD4_CTX)
};
/* MD common stuff */
static unsigned char PADDING[64] =
{
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
/* {{{ Encode
Encodes input (php_hash_uint32) into output (unsigned char). Assumes len is
a multiple of 4.
*/
static void Encode(unsigned char *output, php_hash_uint32 *input, unsigned int len)
{
unsigned int i, j;
for (i = 0, j = 0; j < len; i++, j += 4) {
output[j] = (unsigned char) (input[i] & 0xff);
output[j + 1] = (unsigned char) ((input[i] >> 8) & 0xff);
output[j + 2] = (unsigned char) ((input[i] >> 16) & 0xff);
output[j + 3] = (unsigned char) ((input[i] >> 24) & 0xff);
}
}
/* }}} */
/* {{{ Decode
Decodes input (unsigned char) into output (php_hash_uint32). Assumes len is
a multiple of 4.
*/
static void Decode(php_hash_uint32 *output, const unsigned char *input, unsigned int len)
{
unsigned int i, j;
for (i = 0, j = 0; j < len; i++, j += 4)
output[i] = ((php_hash_uint32) input[j]) | (((php_hash_uint32) input[j + 1]) << 8) |
(((php_hash_uint32) input[j + 2]) << 16) | (((php_hash_uint32) input[j + 3]) << 24);
}
/* }}} */
#ifdef PHP_HASH_MD5_NOT_IN_CORE
/* MD5 */
PHP_HASH_API void make_digest(char *md5str, unsigned char *digest)
{
php_hash_bin2hex(md5str, digest, 16);
md5str[32] = '\0';
}
/* {{{ proto string md5(string str, [ bool raw_output])
Calculate the md5 hash of a string */
PHP_NAMED_FUNCTION(php_if_md5)
{
char *arg;
int arg_len;
zend_bool raw_output = 0;
char md5str[33];
PHP_MD5_CTX context;
unsigned char digest[16];
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &arg, &arg_len, &raw_output) == FAILURE) {
return;
}
md5str[0] = '\0';
PHP_MD5Init(&context);
PHP_MD5Update(&context, arg, arg_len);
PHP_MD5Final(digest, &context);
if (raw_output) {
RETURN_STRINGL(digest, 16, 1);
} else {
make_digest(md5str, digest);
RETVAL_STRING(md5str, 1);
}
}
/* }}} */
/* {{{ proto string md5_file(string filename [, bool raw_output])
Calculate the md5 hash of given filename */
PHP_NAMED_FUNCTION(php_if_md5_file)
{
char *arg;
int arg_len;
zend_bool raw_output = 0;
char md5str[33];
unsigned char buf[1024];
unsigned char digest[16];
PHP_MD5_CTX context;
int n;
php_stream *stream;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &arg, &arg_len, &raw_output) == FAILURE) {
return;
}
stream = php_stream_open_wrapper(arg, "rb", REPORT_ERRORS | ENFORCE_SAFE_MODE, NULL);
if (!stream) {
RETURN_FALSE;
}
PHP_MD5Init(&context);
while ((n = php_stream_read(stream, buf, sizeof(buf))) > 0) {
PHP_MD5Update(&context, buf, n);
}
PHP_MD5Final(digest, &context);
php_stream_close(stream);
if (n<0) {
RETURN_FALSE;
}
if (raw_output) {
RETURN_STRINGL(digest, 16, 1);
} else {
make_digest(md5str, digest);
RETVAL_STRING(md5str, 1);
}
}
/* }}} */
/*
* The remaining code is the reference MD5 code (md5c.c) from rfc1321
*/
/* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm
*/
/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
rights reserved.
License to copy and use this software is granted provided that it
is identified as the "RSA Data Security, Inc. MD5 Message-Digest
Algorithm" in all material mentioning or referencing this software
or this function.
License is also granted to make and use derivative works provided
that such works are identified as "derived from the RSA Data
Security, Inc. MD5 Message-Digest Algorithm" in all material
mentioning or referencing the derived work.
RSA Data Security, Inc. makes no representations concerning either
the merchantability of this software or the suitability of this
software for any particular purpose. It is provided "as is"
without express or implied warranty of any kind.
These notices must be retained in any copies of any part of this
documentation and/or software.
*/
/* Constants for MD5Transform routine.
*/
#define S11 7
#define S12 12
#define S13 17
#define S14 22
#define S21 5
#define S22 9
#define S23 14
#define S24 20
#define S31 4
#define S32 11
#define S33 16
#define S34 23
#define S41 6
#define S42 10
#define S43 15
#define S44 21
static void MD5Transform(php_hash_uint32[4], const unsigned char[64]);
/* F, G, H and I are basic MD5 functions.
*/
#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
#define H(x, y, z) ((x) ^ (y) ^ (z))
#define I(x, y, z) ((y) ^ ((x) | (~z)))
/* ROTATE_LEFT rotates x left n bits.
*/
#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
Rotation is separate from addition to prevent recomputation.
*/
#define FF(a, b, c, d, x, s, ac) { \
(a) += F ((b), (c), (d)) + (x) + (php_hash_uint32)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
#define GG(a, b, c, d, x, s, ac) { \
(a) += G ((b), (c), (d)) + (x) + (php_hash_uint32)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
#define HH(a, b, c, d, x, s, ac) { \
(a) += H ((b), (c), (d)) + (x) + (php_hash_uint32)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
#define II(a, b, c, d, x, s, ac) { \
(a) += I ((b), (c), (d)) + (x) + (php_hash_uint32)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
/* {{{ PHP_MD5Init
* MD5 initialization. Begins an MD5 operation, writing a new context.
*/
PHP_HASH_API void PHP_MD5Init(PHP_MD5_CTX * context)
{
context->count[0] = context->count[1] = 0;
/* Load magic initialization constants.
*/
context->state[0] = 0x67452301;
context->state[1] = 0xefcdab89;
context->state[2] = 0x98badcfe;
context->state[3] = 0x10325476;
}
/* }}} */
/* {{{ PHP_MD5Update
MD5 block update operation. Continues an MD5 message-digest
operation, processing another message block, and updating the
context.
*/
PHP_HASH_API void PHP_MD5Update(PHP_MD5_CTX * context, const unsigned char *input,
unsigned int inputLen)
{
unsigned int i, index, partLen;
/* Compute number of bytes mod 64 */
index = (unsigned int) ((context->count[0] >> 3) & 0x3F);
/* Update number of bits */
if ((context->count[0] += ((php_hash_uint32) inputLen << 3))
< ((php_hash_uint32) inputLen << 3))
context->count[1]++;
context->count[1] += ((php_hash_uint32) inputLen >> 29);
partLen = 64 - index;
/* Transform as many times as possible.
*/
if (inputLen >= partLen) {
memcpy
((unsigned char*) & context->buffer[index], (unsigned char*) input, partLen);
MD5Transform(context->state, context->buffer);
for (i = partLen; i + 63 < inputLen; i += 64)
MD5Transform(context->state, &input[i]);
index = 0;
} else
i = 0;
/* Buffer remaining input */
memcpy
((unsigned char*) & context->buffer[index], (unsigned char*) & input[i],
inputLen - i);
}
/* }}} */
/* {{{ PHP_MD5Final
MD5 finalization. Ends an MD5 message-digest operation, writing the
the message digest and zeroizing the context.
*/
PHP_HASH_API void PHP_MD5Final(unsigned char digest[16], PHP_MD5_CTX * context)
{
unsigned char bits[8];
unsigned int index, padLen;
/* Save number of bits */
Encode(bits, context->count, 8);
/* Pad out to 56 mod 64.
*/
index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
padLen = (index < 56) ? (56 - index) : (120 - index);
PHP_MD5Update(context, PADDING, padLen);
/* Append length (before padding) */
PHP_MD5Update(context, bits, 8);
/* Store state in digest */
Encode(digest, context->state, 16);
/* Zeroize sensitive information.
*/
memset((unsigned char*) context, 0, sizeof(*context));
}
/* }}} */
/* {{{ MD5Transform
* MD5 basic transformation. Transforms state based on block.
*/
static void MD5Transform(state, block)
php_hash_uint32 state[4];
const unsigned char block[64];
{
php_hash_uint32 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
Decode(x, block, 64);
/* Round 1 */
FF(a, b, c, d, x[0], S11, 0xd76aa478); /* 1 */
FF(d, a, b, c, x[1], S12, 0xe8c7b756); /* 2 */
FF(c, d, a, b, x[2], S13, 0x242070db); /* 3 */
FF(b, c, d, a, x[3], S14, 0xc1bdceee); /* 4 */
FF(a, b, c, d, x[4], S11, 0xf57c0faf); /* 5 */
FF(d, a, b, c, x[5], S12, 0x4787c62a); /* 6 */
FF(c, d, a, b, x[6], S13, 0xa8304613); /* 7 */
FF(b, c, d, a, x[7], S14, 0xfd469501); /* 8 */
FF(a, b, c, d, x[8], S11, 0x698098d8); /* 9 */
FF(d, a, b, c, x[9], S12, 0x8b44f7af); /* 10 */
FF(c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */
FF(b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */
FF(a, b, c, d, x[12], S11, 0x6b901122); /* 13 */
FF(d, a, b, c, x[13], S12, 0xfd987193); /* 14 */
FF(c, d, a, b, x[14], S13, 0xa679438e); /* 15 */
FF(b, c, d, a, x[15], S14, 0x49b40821); /* 16 */
/* Round 2 */
GG(a, b, c, d, x[1], S21, 0xf61e2562); /* 17 */
GG(d, a, b, c, x[6], S22, 0xc040b340); /* 18 */
GG(c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */
GG(b, c, d, a, x[0], S24, 0xe9b6c7aa); /* 20 */
GG(a, b, c, d, x[5], S21, 0xd62f105d); /* 21 */
GG(d, a, b, c, x[10], S22, 0x2441453); /* 22 */
GG(c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */
GG(b, c, d, a, x[4], S24, 0xe7d3fbc8); /* 24 */
GG(a, b, c, d, x[9], S21, 0x21e1cde6); /* 25 */
GG(d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */
GG(c, d, a, b, x[3], S23, 0xf4d50d87); /* 27 */
GG(b, c, d, a, x[8], S24, 0x455a14ed); /* 28 */
GG(a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */
GG(d, a, b, c, x[2], S22, 0xfcefa3f8); /* 30 */
GG(c, d, a, b, x[7], S23, 0x676f02d9); /* 31 */
GG(b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */
/* Round 3 */
HH(a, b, c, d, x[5], S31, 0xfffa3942); /* 33 */
HH(d, a, b, c, x[8], S32, 0x8771f681); /* 34 */
HH(c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */
HH(b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */
HH(a, b, c, d, x[1], S31, 0xa4beea44); /* 37 */
HH(d, a, b, c, x[4], S32, 0x4bdecfa9); /* 38 */
HH(c, d, a, b, x[7], S33, 0xf6bb4b60); /* 39 */
HH(b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */
HH(a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */
HH(d, a, b, c, x[0], S32, 0xeaa127fa); /* 42 */
HH(c, d, a, b, x[3], S33, 0xd4ef3085); /* 43 */
HH(b, c, d, a, x[6], S34, 0x4881d05); /* 44 */
HH(a, b, c, d, x[9], S31, 0xd9d4d039); /* 45 */
HH(d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */
HH(c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */
HH(b, c, d, a, x[2], S34, 0xc4ac5665); /* 48 */
/* Round 4 */
II(a, b, c, d, x[0], S41, 0xf4292244); /* 49 */
II(d, a, b, c, x[7], S42, 0x432aff97); /* 50 */
II(c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */
II(b, c, d, a, x[5], S44, 0xfc93a039); /* 52 */
II(a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */
II(d, a, b, c, x[3], S42, 0x8f0ccc92); /* 54 */
II(c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */
II(b, c, d, a, x[1], S44, 0x85845dd1); /* 56 */
II(a, b, c, d, x[8], S41, 0x6fa87e4f); /* 57 */
II(d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */
II(c, d, a, b, x[6], S43, 0xa3014314); /* 59 */
II(b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */
II(a, b, c, d, x[4], S41, 0xf7537e82); /* 61 */
II(d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */
II(c, d, a, b, x[2], S43, 0x2ad7d2bb); /* 63 */
II(b, c, d, a, x[9], S44, 0xeb86d391); /* 64 */
state[0] += a;
state[1] += b;
state[2] += c;
state[3] += d;
/* Zeroize sensitive information. */
memset((unsigned char*) x, 0, sizeof(x));
}
/* }}} */
#endif /* PHP_HASH_MD5_NOT_IN_CORE */
/* MD4 */
#define MD4_F(x,y,z) (((x) & (y)) | ((~(x)) & (z)))
#define MD4_G(x,y,z) (((x) & (y)) | ((x) & (z)) | ((y) & (z)))
#define MD4_H(x,y,z) ((x) ^ (y) ^ (z))
#define ROTL32(s,v) (((v) << (s)) | ((v) >> (32 - (s))))
#define MD4_R1(a,b,c,d,k,s) a = ROTL32(s, a + MD4_F(b,c,d) + x[k])
#define MD4_R2(a,b,c,d,k,s) a = ROTL32(s, a + MD4_G(b,c,d) + x[k] + 0x5A827999)
#define MD4_R3(a,b,c,d,k,s) a = ROTL32(s, a + MD4_H(b,c,d) + x[k] + 0x6ED9EBA1)
static void MD4Transform(php_hash_uint32 state[4], const unsigned char block[64])
{
php_hash_uint32 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
Decode(x, block, 64);
/* Round 1 */
MD4_R1(a,b,c,d, 0, 3);
MD4_R1(d,a,b,c, 1, 7);
MD4_R1(c,d,a,b, 2,11);
MD4_R1(b,c,d,a, 3,19);
MD4_R1(a,b,c,d, 4, 3);
MD4_R1(d,a,b,c, 5, 7);
MD4_R1(c,d,a,b, 6,11);
MD4_R1(b,c,d,a, 7,19);
MD4_R1(a,b,c,d, 8, 3);
MD4_R1(d,a,b,c, 9, 7);
MD4_R1(c,d,a,b,10,11);
MD4_R1(b,c,d,a,11,19);
MD4_R1(a,b,c,d,12, 3);
MD4_R1(d,a,b,c,13, 7);
MD4_R1(c,d,a,b,14,11);
MD4_R1(b,c,d,a,15,19);
/* Round 2 */
MD4_R2(a,b,c,d, 0, 3);
MD4_R2(d,a,b,c, 4, 5);
MD4_R2(c,d,a,b, 8, 9);
MD4_R2(b,c,d,a,12,13);
MD4_R2(a,b,c,d, 1, 3);
MD4_R2(d,a,b,c, 5, 5);
MD4_R2(c,d,a,b, 9, 9);
MD4_R2(b,c,d,a,13,13);
MD4_R2(a,b,c,d, 2, 3);
MD4_R2(d,a,b,c, 6, 5);
MD4_R2(c,d,a,b,10, 9);
MD4_R2(b,c,d,a,14,13);
MD4_R2(a,b,c,d, 3, 3);
MD4_R2(d,a,b,c, 7, 5);
MD4_R2(c,d,a,b,11, 9);
MD4_R2(b,c,d,a,15,13);
/* Round 3 */
MD4_R3(a,b,c,d, 0, 3);
MD4_R3(d,a,b,c, 8, 9);
MD4_R3(c,d,a,b, 4,11);
MD4_R3(b,c,d,a,12,15);
MD4_R3(a,b,c,d, 2, 3);
MD4_R3(d,a,b,c,10, 9);
MD4_R3(c,d,a,b, 6,11);
MD4_R3(b,c,d,a,14,15);
MD4_R3(a,b,c,d, 1, 3);
MD4_R3(d,a,b,c, 9, 9);
MD4_R3(c,d,a,b, 5,11);
MD4_R3(b,c,d,a,13,15);
MD4_R3(a,b,c,d, 3, 3);
MD4_R3(d,a,b,c,11, 9);
MD4_R3(c,d,a,b, 7,11);
MD4_R3(b,c,d,a,15,15);
state[0] += a;
state[1] += b;
state[2] += c;
state[3] += d;
}
/* {{{ PHP_MD4Update
MD4 block update operation. Continues an MD5 message-digest
operation, processing another message block, and updating the
context.
*/
PHP_HASH_API void PHP_MD4Update(PHP_MD4_CTX * context, const unsigned char *input, unsigned int inputLen)
{
unsigned int i, index, partLen;
/* Compute number of bytes mod 64 */
index = (unsigned int) ((context->count[0] >> 3) & 0x3F);
/* Update number of bits */
if ((context->count[0] += ((php_hash_uint32) inputLen << 3))
< ((php_hash_uint32) inputLen << 3))
context->count[1]++;
context->count[1] += ((php_hash_uint32) inputLen >> 29);
partLen = 64 - index;
/* Transform as many times as possible.
*/
if (inputLen >= partLen) {
memcpy((unsigned char*) & context->buffer[index], (unsigned char*) input, partLen);
MD4Transform(context->state, context->buffer);
for (i = partLen; i + 63 < inputLen; i += 64) {
MD4Transform(context->state, &input[i]);
}
index = 0;
} else {
i = 0;
}
/* Buffer remaining input */
memcpy((unsigned char*) & context->buffer[index], (unsigned char*) & input[i], inputLen - i);
}
/* }}} */
/* {{{ PHP_MD4Final
MD4 finalization. Ends an MD4 message-digest operation, writing the
the message digest and zeroizing the context.
*/
PHP_HASH_API void PHP_MD4Final(unsigned char digest[16], PHP_MD4_CTX * context)
{
unsigned char bits[8];
unsigned int index, padLen;
/* Save number of bits */
Encode(bits, context->count, 8);
/* Pad out to 56 mod 64.
*/
index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
padLen = (index < 56) ? (56 - index) : (120 - index);
PHP_MD4Update(context, PADDING, padLen);
/* Append length (before padding) */
PHP_MD4Update(context, bits, 8);
/* Store state in digest */
Encode(digest, context->state, 16);
/* Zeroize sensitive information.
*/
memset((unsigned char*) context, 0, sizeof(*context));
}
/* }}} */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: sw=4 ts=4 fdm=marker
* vim<600: sw=4 ts=4
*/
-433
View File
@@ -1,433 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2005 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Sara Golemon <pollita@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
/* Heavily borrowed from md5.c & sha1.c of PHP archival fame
Note that ripemd laughs in the face of logic and uses
little endian byte ordering */
#include "php_hash.h"
#include "php_hash_ripemd.h"
php_hash_ops php_hash_ripemd128_ops = {
(php_hash_init_func_t) PHP_RIPEMD128Init,
(php_hash_update_func_t) PHP_RIPEMD128Update,
(php_hash_final_func_t) PHP_RIPEMD128Final,
16,
64,
sizeof(PHP_RIPEMD128_CTX)
};
php_hash_ops php_hash_ripemd160_ops = {
(php_hash_init_func_t) PHP_RIPEMD160Init,
(php_hash_update_func_t) PHP_RIPEMD160Update,
(php_hash_final_func_t) PHP_RIPEMD160Final,
20,
64,
sizeof(PHP_RIPEMD160_CTX)
};
/* {{{ PHP_RIPEMD128Init
* ripemd128 initialization. Begins a ripemd128 operation, writing a new context.
*/
PHP_HASH_API void PHP_RIPEMD128Init(PHP_RIPEMD128_CTX * context)
{
context->count[0] = context->count[1] = 0;
/* Load magic initialization constants.
*/
context->state[0] = 0x67452301;
context->state[1] = 0xEFCDAB89;
context->state[2] = 0x98BADCFE;
context->state[3] = 0x10325476;
}
/* }}} */
/* {{{ PHP_RIPEMD160Init
* ripemd128 initialization. Begins a ripemd128 operation, writing a new context.
*/
PHP_HASH_API void PHP_RIPEMD160Init(PHP_RIPEMD160_CTX * context)
{
context->count[0] = context->count[1] = 0;
/* Load magic initialization constants.
*/
context->state[0] = 0x67452301;
context->state[1] = 0xEFCDAB89;
context->state[2] = 0x98BADCFE;
context->state[3] = 0x10325476;
context->state[4] = 0xC3D2E1F0;
}
/* }}} */
/* Basic ripemd function */
#define F0(x,y,z) ((x) ^ (y) ^ (z))
#define F1(x,y,z) (((x) & (y)) | ((~(x)) & (z)))
#define F2(x,y,z) (((x) | (~(y))) ^ (z))
#define F3(x,y,z) (((x) & (z)) | ((y) & (~(z))))
#define F4(x,y,z) ((x) ^ ((y) | (~(z))))
static php_hash_uint32 K_values[5] = { 0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E };
static php_hash_uint32 KK_values[4] = { 0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x00000000 };
static php_hash_uint32 KK160_values[5] = { 0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000 };
#define K(n) K_values[ (n) >> 4]
#define KK(n) KK_values[(n) >> 4]
#define KK160(n) KK160_values[(n) >> 4]
static unsigned char R[80] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,
3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,
1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,
4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13 };
static unsigned char RR[80] = {
5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,
6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,
15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,
8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,
12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11 };
static unsigned char S[80] = {
11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,
7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,
11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,
11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,
9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 };
static unsigned char SS[80] = {
8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,
9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,
9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,
15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,
8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 };
#define ROLS(j, x) (((x) << S[j]) | ((x) >> (32 - S[j])))
#define ROLSS(j, x) (((x) << SS[j]) | ((x) >> (32 - SS[j])))
#define ROL(n, x) (((x) << n) | ((x) >> (32 - n)))
/* {{{ RIPEMDDecode
Decodes input (unsigned char) into output (php_hash_uint32). Assumes len is
a multiple of 4.
*/
static void RIPEMDDecode(php_hash_uint32 *output, const unsigned char *input, unsigned int len)
{
unsigned int i, j;
for (i = 0, j = 0; j < len; i++, j += 4)
output[i] = ((php_hash_uint32) input[j + 0]) | (((php_hash_uint32) input[j + 1]) << 8) |
(((php_hash_uint32) input[j + 2]) << 16) | (((php_hash_uint32) input[j + 3]) << 24);
}
/* }}} */
/* {{{ RIPEMD128Transform
* ripemd128 basic transformation. Transforms state based on block.
*/
static void RIPEMD128Transform(php_hash_uint32 state[4], const unsigned char block[64])
{
php_hash_uint32 a = state[0], b = state[1], c = state[2], d = state[3];
php_hash_uint32 aa = state[0], bb = state[1], cc = state[2], dd = state[3];
php_hash_uint32 tmp, x[16];
int j;
RIPEMDDecode(x, block, 64);
for(j = 0; j < 16; j++) {
tmp = ROLS( j, a + F0(b, c, d) + x[R[j]] + K(j));
a = d; d = c; c = b; b = tmp;
tmp = ROLSS(j, aa + F3(bb, cc, dd) + x[RR[j]] + KK(j));
aa = dd; dd = cc; cc = bb; bb = tmp;
}
for(j = 16; j < 32; j++) {
tmp = ROLS( j, a + F1(b, c, d) + x[R[j]] + K(j));
a = d; d = c; c = b; b = tmp;
tmp = ROLSS(j, aa + F2(bb, cc, dd) + x[RR[j]] + KK(j));
aa = dd; dd = cc; cc = bb; bb = tmp;
}
for(j = 32; j < 48; j++) {
tmp = ROLS( j, a + F2(b, c, d) + x[R[j]] + K(j));
a = d; d = c; c = b; b = tmp;
tmp = ROLSS(j, aa + F1(bb, cc, dd) + x[RR[j]] + KK(j));
aa = dd; dd = cc; cc = bb; bb = tmp;
}
for(j = 48; j < 64; j++) {
tmp = ROLS( j, a + F3(b, c, d) + x[R[j]] + K(j));
a = d; d = c; c = b; b = tmp;
tmp = ROLSS(j, aa + F0(bb, cc, dd) + x[RR[j]] + KK(j));
aa = dd; dd = cc; cc = bb; bb = tmp;
}
tmp = state[1] + c + dd;
state[1] = state[2] + d + aa;
state[2] = state[3] + a + bb;
state[3] = state[0] + b + cc;
state[0] = tmp;
tmp = 0;
memset(x, 0, sizeof(x));
}
/* }}} */
/* {{{ PHP_RIPEMD128Update
ripemd128 block update operation. Continues a ripemd128 message-digest
operation, processing another message block, and updating the
context.
*/
PHP_HASH_API void PHP_RIPEMD128Update(PHP_RIPEMD128_CTX * context, const unsigned char *input, unsigned int inputLen)
{
unsigned int i, index, partLen;
/* Compute number of bytes mod 64 */
index = (unsigned int) ((context->count[0] >> 3) & 0x3F);
/* Update number of bits */
if ((context->count[0] += ((php_hash_uint32) inputLen << 3)) < ((php_hash_uint32) inputLen << 3)) {
context->count[1]++;
}
context->count[1] += ((php_hash_uint32) inputLen >> 29);
partLen = 64 - index;
/* Transform as many times as possible.
*/
if (inputLen >= partLen) {
memcpy((unsigned char*) & context->buffer[index], (unsigned char*) input, partLen);
RIPEMD128Transform(context->state, context->buffer);
for (i = partLen; i + 63 < inputLen; i += 64) {
RIPEMD128Transform(context->state, &input[i]);
}
index = 0;
} else {
i = 0;
}
/* Buffer remaining input */
memcpy((unsigned char*) & context->buffer[index], (unsigned char*) & input[i], inputLen - i);
}
/* }}} */
/* {{{ RIPEMD160Transform
* ripemd160 basic transformation. Transforms state based on block.
*/
static void RIPEMD160Transform(php_hash_uint32 state[5], const unsigned char block[64])
{
php_hash_uint32 a = state[0], b = state[1], c = state[2], d = state[3], e = state[4];
php_hash_uint32 aa = state[0], bb = state[1], cc = state[2], dd = state[3], ee = state[4];
php_hash_uint32 tmp, x[16];
int j;
RIPEMDDecode(x, block, 64);
for(j = 0; j < 16; j++) {
tmp = ROLS( j, a + F0(b, c, d) + x[R[j]] + K(j)) + e;
a = e; e = d; d = ROL(10, c); c = b; b = tmp;
tmp = ROLSS(j, aa + F4(bb, cc, dd) + x[RR[j]] + KK160(j)) + ee;
aa = ee; ee = dd; dd = ROL(10, cc); cc = bb; bb = tmp;
}
for(j = 16; j < 32; j++) {
tmp = ROLS( j, a + F1(b, c, d) + x[R[j]] + K(j)) + e;
a = e; e = d; d = ROL(10, c); c = b; b = tmp;
tmp = ROLSS(j, aa + F3(bb, cc, dd) + x[RR[j]] + KK160(j)) + ee;
aa = ee; ee = dd; dd = ROL(10, cc); cc = bb; bb = tmp;
}
for(j = 32; j < 48; j++) {
tmp = ROLS( j, a + F2(b, c, d) + x[R[j]] + K(j)) + e;
a = e; e = d; d = ROL(10, c); c = b; b = tmp;
tmp = ROLSS(j, aa + F2(bb, cc, dd) + x[RR[j]] + KK160(j)) + ee;
aa = ee; ee = dd; dd = ROL(10, cc); cc = bb; bb = tmp;
}
for(j = 48; j < 64; j++) {
tmp = ROLS( j, a + F3(b, c, d) + x[R[j]] + K(j)) + e;
a = e; e = d; d = ROL(10, c); c = b; b = tmp;
tmp = ROLSS(j, aa + F1(bb, cc, dd) + x[RR[j]] + KK160(j)) + ee;
aa = ee; ee = dd; dd = ROL(10, cc); cc = bb; bb = tmp;
}
for(j = 64; j < 80; j++) {
tmp = ROLS( j, a + F4(b, c, d) + x[R[j]] + K(j)) + e;
a = e; e = d; d = ROL(10, c); c = b; b = tmp;
tmp = ROLSS(j, aa + F0(bb, cc, dd) + x[RR[j]] + KK160(j)) + ee;
aa = ee; ee = dd; dd = ROL(10, cc); cc = bb; bb = tmp;
}
tmp = state[1] + c + dd;
state[1] = state[2] + d + ee;
state[2] = state[3] + e + aa;
state[3] = state[4] + a + bb;
state[4] = state[0] + b + cc;
state[0] = tmp;
tmp = 0;
memset(x, 0, sizeof(x));
}
/* }}} */
/* {{{ PHP_RIPEMD160Update
ripemd160 block update operation. Continues a ripemd128 message-digest
operation, processing another message block, and updating the
context.
*/
PHP_HASH_API void PHP_RIPEMD160Update(PHP_RIPEMD160_CTX * context, const unsigned char *input, unsigned int inputLen)
{
unsigned int i, index, partLen;
/* Compute number of bytes mod 64 */
index = (unsigned int) ((context->count[0] >> 3) & 0x3F);
/* Update number of bits */
if ((context->count[0] += ((php_hash_uint32) inputLen << 3)) < ((php_hash_uint32) inputLen << 3)) {
context->count[1]++;
}
context->count[1] += ((php_hash_uint32) inputLen >> 29);
partLen = 64 - index;
/* Transform as many times as possible.
*/
if (inputLen >= partLen) {
memcpy((unsigned char*) & context->buffer[index], (unsigned char*) input, partLen);
RIPEMD160Transform(context->state, context->buffer);
for (i = partLen; i + 63 < inputLen; i += 64) {
RIPEMD160Transform(context->state, &input[i]);
}
index = 0;
} else {
i = 0;
}
/* Buffer remaining input */
memcpy((unsigned char*) & context->buffer[index], (unsigned char*) & input[i], inputLen - i);
}
/* }}} */
static unsigned char PADDING[64] =
{
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
/* {{{ RIPEMDEncode
Encodes input (php_hash_uint32) into output (unsigned char). Assumes len is
a multiple of 4.
*/
static void RIPEMDEncode(unsigned char *output, php_hash_uint32 *input, unsigned int len)
{
unsigned int i, j;
for (i = 0, j = 0; j < len; i++, j += 4) {
output[j + 3] = (unsigned char) ((input[i] >> 24) & 0xff);
output[j + 2] = (unsigned char) ((input[i] >> 16) & 0xff);
output[j + 1] = (unsigned char) ((input[i] >> 8) & 0xff);
output[j + 0] = (unsigned char) (input[i] & 0xff);
}
}
/* }}} */
/* {{{ PHP_RIPEMD128Final
ripemd128 finalization. Ends a ripemd128 message-digest operation, writing the
the message digest and zeroizing the context.
*/
PHP_HASH_API void PHP_RIPEMD128Final(unsigned char digest[16], PHP_RIPEMD128_CTX * context)
{
unsigned char bits[8];
unsigned int index, padLen;
/* Save number of bits */
bits[0] = (unsigned char) (context->count[0] & 0xFF);
bits[1] = (unsigned char) ((context->count[0] >> 8) & 0xFF);
bits[2] = (unsigned char) ((context->count[0] >> 16) & 0xFF);
bits[3] = (unsigned char) ((context->count[0] >> 24) & 0xFF);
bits[4] = (unsigned char) (context->count[1] & 0xFF);
bits[5] = (unsigned char) ((context->count[1] >> 8) & 0xFF);
bits[6] = (unsigned char) ((context->count[1] >> 16) & 0xFF);
bits[7] = (unsigned char) ((context->count[1] >> 24) & 0xFF);
/* Pad out to 56 mod 64.
*/
index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
padLen = (index < 56) ? (56 - index) : (120 - index);
PHP_RIPEMD128Update(context, PADDING, padLen);
/* Append length (before padding) */
PHP_RIPEMD128Update(context, bits, 8);
/* Store state in digest */
RIPEMDEncode(digest, context->state, 16);
/* Zeroize sensitive information.
*/
memset((unsigned char*) context, 0, sizeof(*context));
}
/* }}} */
/* {{{ PHP_RIPEMD160Final
ripemd160 finalization. Ends a ripemd160 message-digest operation, writing the
the message digest and zeroizing the context.
*/
PHP_HASH_API void PHP_RIPEMD160Final(unsigned char digest[20], PHP_RIPEMD160_CTX * context)
{
unsigned char bits[8];
unsigned int index, padLen;
/* Save number of bits */
bits[0] = (unsigned char) (context->count[0] & 0xFF);
bits[1] = (unsigned char) ((context->count[0] >> 8) & 0xFF);
bits[2] = (unsigned char) ((context->count[0] >> 16) & 0xFF);
bits[3] = (unsigned char) ((context->count[0] >> 24) & 0xFF);
bits[4] = (unsigned char) (context->count[1] & 0xFF);
bits[5] = (unsigned char) ((context->count[1] >> 8) & 0xFF);
bits[6] = (unsigned char) ((context->count[1] >> 16) & 0xFF);
bits[7] = (unsigned char) ((context->count[1] >> 24) & 0xFF);
/* Pad out to 56 mod 64.
*/
index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
padLen = (index < 56) ? (56 - index) : (120 - index);
PHP_RIPEMD160Update(context, PADDING, padLen);
/* Append length (before padding) */
PHP_RIPEMD160Update(context, bits, 8);
/* Store state in digest */
RIPEMDEncode(digest, context->state, 20);
/* Zeroize sensitive information.
*/
memset((unsigned char*) context, 0, sizeof(*context));
}
/* }}} */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: sw=4 ts=4 fdm=marker
* vim<600: sw=4 ts=4
*/
-222
View File
@@ -1,222 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2005 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Michael Wallner <mike@php.net> |
| Sara Golemon <pollita@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#include "php_hash.h"
#include "php_hash_salsa.h"
#define R(a,b) (((a) << (b)) | ((a) >> (32 - (b))))
/* {{{ Salsa10
The 64-byte input x to Salsa10 is viewed in little-endian form as 16 integers
x0, x1, x2, ..., x15 in {0,1,...,2^32-1}. These 16 integers are fed through
320 invertible modifications, where each modification changes one integer.
The modifications involve, overall,
* 10 additions of constants modulo 2^32;
* 320 more additions modulo 2^32;
* 80 ``or'' operations;
* 240 ``xor'' operations; and
* 320 constant-distance rotations.
The resulting 16 integers are added to the original x0, x1, x2, ..., x15
respectively modulo 2^32, producing, in little-endian form, the 64-byte output
Salsa10(x).
D.J.Bernstein
*/
static void Salsa10(php_hash_uint32 x[16], php_hash_uint32 in[16])
{
int i;
for (i = 10; i > 0; --i) {
x[ 4] ^= R(x[ 0]+x[12], 6); x[ 8] ^= R(x[ 4]+x[ 0],17);
x[12] += R(x[ 8]|x[ 4],16); x[ 0] += R(x[12]^x[ 8], 5);
x[ 9] += R(x[ 5]|x[ 1], 8); x[13] += R(x[ 9]|x[ 5], 7);
x[ 1] ^= R(x[13]+x[ 9],17); x[ 5] += R(x[ 1]^x[13],12);
x[14] ^= R(x[10]+x[ 6], 7); x[ 2] += R(x[14]^x[10],15);
x[ 6] ^= R(x[ 2]+x[14],13); x[10] ^= R(x[ 6]+x[ 2],15);
x[ 3] += R(x[15]|x[11],20); x[ 7] ^= R(x[ 3]+x[15],16);
x[11] += R(x[ 7]^x[ 3], 7); x[15] += R(x[11]^x[ 7], 8);
x[ 1] += R(x[ 0]|x[ 3], 8)^i;x[ 2] ^= R(x[ 1]+x[ 0],14);
x[ 3] ^= R(x[ 2]+x[ 1], 6); x[ 0] += R(x[ 3]^x[ 2],18);
x[ 6] += R(x[ 5]^x[ 4], 8); x[ 7] += R(x[ 6]^x[ 5],12);
x[ 4] += R(x[ 7]|x[ 6],13); x[ 5] ^= R(x[ 4]+x[ 7],15);
x[11] ^= R(x[10]+x[ 9],18); x[ 8] += R(x[11]^x[10],11);
x[ 9] ^= R(x[ 8]+x[11], 8); x[10] += R(x[ 9]|x[ 8], 6);
x[12] += R(x[15]^x[14],17); x[13] ^= R(x[12]+x[15],15);
x[14] += R(x[13]|x[12], 9); x[15] += R(x[14]^x[13], 7);
}
for (i = 0; i < 16; ++i) {
x[i] += in[i];
}
}
/* }}} */
/* {{{ Salsa20
The 64-byte input x to Salsa20 is viewed in little-endian form as 16 words
x0, x1, x2, ..., x15 in {0,1,...,2^32-1}. These 16 words are fed through 320
invertible modifications, where each modification changes one word. The
resulting 16 words are added to the original x0, x1, x2, ..., x15 respectively
modulo 2^32, producing, in little-endian form, the 64-byte output Salsa20(x).
Each modification involves xor'ing into one word a rotated version of the sum
of two other words modulo 2^32. Thus the 320 modifications involve, overall,
320 additions, 320 xor's, and 320 rotations. The rotations are all by constant
distances.
The entire series of modifications is a series of 10 identical double-rounds.
Each double-round is a series of 2 rounds. Each round is a set of 4 parallel
quarter-rounds. Each quarter-round modifies 4 words.
D.J.Bernstein
*/
static void Salsa20(php_hash_uint32 x[16], php_hash_uint32 in[16])
{
int i;
for (i = 20; i > 0; i -= 2) {
x[ 4] ^= R(x[ 0]+x[12], 7); x[ 8] ^= R(x[ 4]+x[ 0], 9);
x[12] ^= R(x[ 8]+x[ 4],13); x[ 0] ^= R(x[12]+x[ 8],18);
x[ 9] ^= R(x[ 5]+x[ 1], 7); x[13] ^= R(x[ 9]+x[ 5], 9);
x[ 1] ^= R(x[13]+x[ 9],13); x[ 5] ^= R(x[ 1]+x[13],18);
x[14] ^= R(x[10]+x[ 6], 7); x[ 2] ^= R(x[14]+x[10], 9);
x[ 6] ^= R(x[ 2]+x[14],13); x[10] ^= R(x[ 6]+x[ 2],18);
x[ 3] ^= R(x[15]+x[11], 7); x[ 7] ^= R(x[ 3]+x[15], 9);
x[11] ^= R(x[ 7]+x[ 3],13); x[15] ^= R(x[11]+x[ 7],18);
x[ 1] ^= R(x[ 0]+x[ 3], 7); x[ 2] ^= R(x[ 1]+x[ 0], 9);
x[ 3] ^= R(x[ 2]+x[ 1],13); x[ 0] ^= R(x[ 3]+x[ 2],18);
x[ 6] ^= R(x[ 5]+x[ 4], 7); x[ 7] ^= R(x[ 6]+x[ 5], 9);
x[ 4] ^= R(x[ 7]+x[ 6],13); x[ 5] ^= R(x[ 4]+x[ 7],18);
x[11] ^= R(x[10]+x[ 9], 7); x[ 8] ^= R(x[11]+x[10], 9);
x[ 9] ^= R(x[ 8]+x[11],13); x[10] ^= R(x[ 9]+x[ 8],18);
x[12] ^= R(x[15]+x[14], 7); x[13] ^= R(x[12]+x[15], 9);
x[14] ^= R(x[13]+x[12],13); x[15] ^= R(x[14]+x[13],18);
}
for (i = 0; i < 16; ++i) {
x[i] += in[i];
}
}
/* }}} */
static inline void SalsaTransform(PHP_SALSA_CTX *context, const unsigned char input[64])
{
php_hash_uint32 i, j, a[16];
#if 0
fprintf(stderr, "> INPUT: %.*s\n", 64, input);
#endif
for (i = 0, j = 0; j < 64; i++, j += 4) {
a[i] = ((php_hash_uint32) input[j + 3]) | (((php_hash_uint32) input[j + 2]) << 8) |
(((php_hash_uint32) input[j + 1]) << 16) | (((php_hash_uint32) input[j]) << 24);
}
if (!context->init) {
memcpy(context->state, a, sizeof(a));
context->init = 1;
}
context->Transform(context->state, a);
memset(a, 0, sizeof(a));
}
PHP_HASH_API void PHP_SALSA10Init(PHP_SALSA_CTX *context)
{
memset(context, 0, sizeof(*context));
context->Transform = Salsa10;
}
PHP_HASH_API void PHP_SALSA20Init(PHP_SALSA_CTX *context)
{
memset(context, 0, sizeof(*context));
context->Transform = Salsa20;
}
PHP_HASH_API void PHP_SALSAUpdate(PHP_SALSA_CTX *context, const unsigned char *input, size_t len)
{
if (context->length + len < 64) {
memcpy(&context->buffer[context->length], input, len);
context->length += len;
} else {
size_t i = 0, r = (context->length + len) % 64;
if (context->length) {
i = 64 - context->length;
memcpy(&context->buffer[context->length], input, i);
SalsaTransform(context, context->buffer);
memset(context->buffer, 0, 64);
}
for (; i + 64 <= len; i += 64) {
SalsaTransform(context, input + i);
}
memcpy(context->buffer, input + i, r);
context->length = r;
}
}
PHP_HASH_API void PHP_SALSAFinal(unsigned char digest[64], PHP_SALSA_CTX *context)
{
php_hash_uint32 i, j;
if (context->length) {
SalsaTransform(context, context->buffer);
}
for (i = 0, j = 0; j < 64; i++, j += 4) {
digest[j] = (unsigned char) ((context->state[i] >> 24) & 0xff);
digest[j + 1] = (unsigned char) ((context->state[i] >> 16) & 0xff);
digest[j + 2] = (unsigned char) ((context->state[i] >> 8) & 0xff);
digest[j + 3] = (unsigned char) (context->state[i] & 0xff);
}
memset(context, 0, sizeof(*context));
}
php_hash_ops php_hash_salsa10_ops = {
(php_hash_init_func_t) PHP_SALSA10Init,
(php_hash_update_func_t) PHP_SALSAUpdate,
(php_hash_final_func_t) PHP_SALSAFinal,
64,
64,
sizeof(PHP_SALSA_CTX)
};
php_hash_ops php_hash_salsa20_ops = {
(php_hash_init_func_t) PHP_SALSA20Init,
(php_hash_update_func_t) PHP_SALSAUpdate,
(php_hash_final_func_t) PHP_SALSAFinal,
64,
64,
sizeof(PHP_SALSA_CTX)
};
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: sw=4 ts=4 fdm=marker
* vim<600: sw=4 ts=4
*/
-934
View File
@@ -1,934 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2005 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Steffan Esser <sesser@php.net> |
| Sara Golemon <pollita@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#include "php_hash.h"
#include "php_hash_sha.h"
static unsigned char PADDING[128] =
{
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
/* {{{ SHAEncode32
Encodes input (php_hash_uint32) into output (unsigned char). Assumes len is
a multiple of 4.
*/
static void SHAEncode32(unsigned char *output, php_hash_uint32 *input, unsigned int len)
{
unsigned int i, j;
for (i = 0, j = 0; j < len; i++, j += 4) {
output[j] = (unsigned char) ((input[i] >> 24) & 0xff);
output[j + 1] = (unsigned char) ((input[i] >> 16) & 0xff);
output[j + 2] = (unsigned char) ((input[i] >> 8) & 0xff);
output[j + 3] = (unsigned char) (input[i] & 0xff);
}
}
/* }}} */
/* {{{ SHADecode32
Decodes input (unsigned char) into output (php_hash_uint32). Assumes len is
a multiple of 4.
*/
static void SHADecode32(php_hash_uint32 *output, const unsigned char *input, unsigned int len)
{
unsigned int i, j;
for (i = 0, j = 0; j < len; i++, j += 4)
output[i] = ((php_hash_uint32) input[j + 3]) | (((php_hash_uint32) input[j + 2]) << 8) |
(((php_hash_uint32) input[j + 1]) << 16) | (((php_hash_uint32) input[j]) << 24);
}
/* }}} */
php_hash_ops php_hash_sha1_ops = {
(php_hash_init_func_t) PHP_SHA1Init,
(php_hash_update_func_t) PHP_SHA1Update,
(php_hash_final_func_t) PHP_SHA1Final,
20,
64,
sizeof(PHP_SHA1_CTX)
};
#ifdef PHP_HASH_SHA1_NOT_IN_CORE
PHP_HASH_API void make_sha1_digest(char *sha1str, unsigned char *digest)
{
php_hash_bin2hex(sha1str, digest, 20);
sha1str[40] = '\0';
}
/* {{{ proto string sha1(string str [, bool raw_output])
Calculate the sha1 hash of a string */
PHP_FUNCTION(sha1)
{
char *arg;
int arg_len;
zend_bool raw_output = 0;
char sha1str[41];
PHP_SHA1_CTX context;
unsigned char digest[20];
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &arg, &arg_len, &raw_output) == FAILURE) {
return;
}
sha1str[0] = '\0';
PHP_SHA1Init(&context);
PHP_SHA1Update(&context, arg, arg_len);
PHP_SHA1Final(digest, &context);
if (raw_output) {
RETURN_STRINGL(digest, 20, 1);
} else {
make_sha1_digest(sha1str, digest);
RETVAL_STRING(sha1str, 1);
}
}
/* }}} */
/* {{{ proto string sha1_file(string filename [, bool raw_output])
Calculate the sha1 hash of given filename */
PHP_FUNCTION(sha1_file)
{
char *arg;
int arg_len;
zend_bool raw_output = 0;
char sha1str[41];
unsigned char buf[1024];
unsigned char digest[20];
PHP_SHA1_CTX context;
int n;
php_stream *stream;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &arg, &arg_len, &raw_output) == FAILURE) {
return;
}
stream = php_stream_open_wrapper(arg, "rb", REPORT_ERRORS | ENFORCE_SAFE_MODE, NULL);
if (!stream) {
RETURN_FALSE;
}
PHP_SHA1Init(&context);
while ((n = php_stream_read(stream, buf, sizeof(buf))) > 0) {
PHP_SHA1Update(&context, buf, n);
}
PHP_SHA1Final(digest, &context);
php_stream_close(stream);
if (n<0) {
RETURN_FALSE;
}
if (raw_output) {
RETURN_STRINGL(digest, 20, 1);
} else {
make_sha1_digest(sha1str, digest);
RETVAL_STRING(sha1str, 1);
}
}
/* }}} */
/* F, G, H and I are basic SHA1 functions.
*/
#define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z))))
#define G(x, y, z) ((x) ^ (y) ^ (z))
#define H(x, y, z) (((x) & (y)) | ((z) & ((x) | (y))))
#define I(x, y, z) ((x) ^ (y) ^ (z))
/* ROTATE_LEFT rotates x left n bits.
*/
#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
/* W[i]
*/
#define W(i) ( tmp=x[(i-3)&15]^x[(i-8)&15]^x[(i-14)&15]^x[i&15], \
(x[i&15]=ROTATE_LEFT(tmp, 1)) )
/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
*/
#define FF(a, b, c, d, e, w) { \
(e) += F ((b), (c), (d)) + (w) + (php_hash_uint32)(0x5A827999); \
(e) += ROTATE_LEFT ((a), 5); \
(b) = ROTATE_LEFT((b), 30); \
}
#define GG(a, b, c, d, e, w) { \
(e) += G ((b), (c), (d)) + (w) + (php_hash_uint32)(0x6ED9EBA1); \
(e) += ROTATE_LEFT ((a), 5); \
(b) = ROTATE_LEFT((b), 30); \
}
#define HH(a, b, c, d, e, w) { \
(e) += H ((b), (c), (d)) + (w) + (php_hash_uint32)(0x8F1BBCDC); \
(e) += ROTATE_LEFT ((a), 5); \
(b) = ROTATE_LEFT((b), 30); \
}
#define II(a, b, c, d, e, w) { \
(e) += I ((b), (c), (d)) + (w) + (php_hash_uint32)(0xCA62C1D6); \
(e) += ROTATE_LEFT ((a), 5); \
(b) = ROTATE_LEFT((b), 30); \
}
/* {{{ PHP_SHA1Init
* SHA1 initialization. Begins an SHA1 operation, writing a new context.
*/
PHP_HASH_API void PHP_SHA1Init(PHP_SHA1_CTX * context)
{
context->count[0] = context->count[1] = 0;
/* Load magic initialization constants.
*/
context->state[0] = 0x67452301;
context->state[1] = 0xefcdab89;
context->state[2] = 0x98badcfe;
context->state[3] = 0x10325476;
context->state[4] = 0xc3d2e1f0;
}
/* }}} */
/* {{{ SHA1Transform
* SHA1 basic transformation. Transforms state based on block.
*/
static void SHA1Transform(php_hash_uint32 state[5], const unsigned char block[64])
{
php_hash_uint32 a = state[0], b = state[1], c = state[2];
php_hash_uint32 d = state[3], e = state[4], x[16], tmp;
SHADecode32(x, block, 64);
/* Round 1 */
FF(a, b, c, d, e, x[0]); /* 1 */
FF(e, a, b, c, d, x[1]); /* 2 */
FF(d, e, a, b, c, x[2]); /* 3 */
FF(c, d, e, a, b, x[3]); /* 4 */
FF(b, c, d, e, a, x[4]); /* 5 */
FF(a, b, c, d, e, x[5]); /* 6 */
FF(e, a, b, c, d, x[6]); /* 7 */
FF(d, e, a, b, c, x[7]); /* 8 */
FF(c, d, e, a, b, x[8]); /* 9 */
FF(b, c, d, e, a, x[9]); /* 10 */
FF(a, b, c, d, e, x[10]); /* 11 */
FF(e, a, b, c, d, x[11]); /* 12 */
FF(d, e, a, b, c, x[12]); /* 13 */
FF(c, d, e, a, b, x[13]); /* 14 */
FF(b, c, d, e, a, x[14]); /* 15 */
FF(a, b, c, d, e, x[15]); /* 16 */
FF(e, a, b, c, d, W(16)); /* 17 */
FF(d, e, a, b, c, W(17)); /* 18 */
FF(c, d, e, a, b, W(18)); /* 19 */
FF(b, c, d, e, a, W(19)); /* 20 */
/* Round 2 */
GG(a, b, c, d, e, W(20)); /* 21 */
GG(e, a, b, c, d, W(21)); /* 22 */
GG(d, e, a, b, c, W(22)); /* 23 */
GG(c, d, e, a, b, W(23)); /* 24 */
GG(b, c, d, e, a, W(24)); /* 25 */
GG(a, b, c, d, e, W(25)); /* 26 */
GG(e, a, b, c, d, W(26)); /* 27 */
GG(d, e, a, b, c, W(27)); /* 28 */
GG(c, d, e, a, b, W(28)); /* 29 */
GG(b, c, d, e, a, W(29)); /* 30 */
GG(a, b, c, d, e, W(30)); /* 31 */
GG(e, a, b, c, d, W(31)); /* 32 */
GG(d, e, a, b, c, W(32)); /* 33 */
GG(c, d, e, a, b, W(33)); /* 34 */
GG(b, c, d, e, a, W(34)); /* 35 */
GG(a, b, c, d, e, W(35)); /* 36 */
GG(e, a, b, c, d, W(36)); /* 37 */
GG(d, e, a, b, c, W(37)); /* 38 */
GG(c, d, e, a, b, W(38)); /* 39 */
GG(b, c, d, e, a, W(39)); /* 40 */
/* Round 3 */
HH(a, b, c, d, e, W(40)); /* 41 */
HH(e, a, b, c, d, W(41)); /* 42 */
HH(d, e, a, b, c, W(42)); /* 43 */
HH(c, d, e, a, b, W(43)); /* 44 */
HH(b, c, d, e, a, W(44)); /* 45 */
HH(a, b, c, d, e, W(45)); /* 46 */
HH(e, a, b, c, d, W(46)); /* 47 */
HH(d, e, a, b, c, W(47)); /* 48 */
HH(c, d, e, a, b, W(48)); /* 49 */
HH(b, c, d, e, a, W(49)); /* 50 */
HH(a, b, c, d, e, W(50)); /* 51 */
HH(e, a, b, c, d, W(51)); /* 52 */
HH(d, e, a, b, c, W(52)); /* 53 */
HH(c, d, e, a, b, W(53)); /* 54 */
HH(b, c, d, e, a, W(54)); /* 55 */
HH(a, b, c, d, e, W(55)); /* 56 */
HH(e, a, b, c, d, W(56)); /* 57 */
HH(d, e, a, b, c, W(57)); /* 58 */
HH(c, d, e, a, b, W(58)); /* 59 */
HH(b, c, d, e, a, W(59)); /* 60 */
/* Round 4 */
II(a, b, c, d, e, W(60)); /* 61 */
II(e, a, b, c, d, W(61)); /* 62 */
II(d, e, a, b, c, W(62)); /* 63 */
II(c, d, e, a, b, W(63)); /* 64 */
II(b, c, d, e, a, W(64)); /* 65 */
II(a, b, c, d, e, W(65)); /* 66 */
II(e, a, b, c, d, W(66)); /* 67 */
II(d, e, a, b, c, W(67)); /* 68 */
II(c, d, e, a, b, W(68)); /* 69 */
II(b, c, d, e, a, W(69)); /* 70 */
II(a, b, c, d, e, W(70)); /* 71 */
II(e, a, b, c, d, W(71)); /* 72 */
II(d, e, a, b, c, W(72)); /* 73 */
II(c, d, e, a, b, W(73)); /* 74 */
II(b, c, d, e, a, W(74)); /* 75 */
II(a, b, c, d, e, W(75)); /* 76 */
II(e, a, b, c, d, W(76)); /* 77 */
II(d, e, a, b, c, W(77)); /* 78 */
II(c, d, e, a, b, W(78)); /* 79 */
II(b, c, d, e, a, W(79)); /* 80 */
state[0] += a;
state[1] += b;
state[2] += c;
state[3] += d;
state[4] += e;
/* Zeroize sensitive information. */
memset((unsigned char*) x, 0, sizeof(x));
}
/* }}} */
/* {{{ PHP_SHA1Update
SHA1 block update operation. Continues an SHA1 message-digest
operation, processing another message block, and updating the
context.
*/
PHP_HASH_API void PHP_SHA1Update(PHP_SHA1_CTX * context, const unsigned char *input,
unsigned int inputLen)
{
unsigned int i, index, partLen;
/* Compute number of bytes mod 64 */
index = (unsigned int) ((context->count[0] >> 3) & 0x3F);
/* Update number of bits */
if ((context->count[0] += ((php_hash_uint32) inputLen << 3))
< ((php_hash_uint32) inputLen << 3))
context->count[1]++;
context->count[1] += ((php_hash_uint32) inputLen >> 29);
partLen = 64 - index;
/* Transform as many times as possible.
*/
if (inputLen >= partLen) {
memcpy
((unsigned char*) & context->buffer[index], (unsigned char*) input, partLen);
SHA1Transform(context->state, context->buffer);
for (i = partLen; i + 63 < inputLen; i += 64)
SHA1Transform(context->state, &input[i]);
index = 0;
} else
i = 0;
/* Buffer remaining input */
memcpy
((unsigned char*) & context->buffer[index], (unsigned char*) & input[i],
inputLen - i);
}
/* }}} */
/* {{{ PHP_SHA1Final
SHA1 finalization. Ends an SHA1 message-digest operation, writing the
the message digest and zeroizing the context.
*/
PHP_HASH_API void PHP_SHA1Final(unsigned char digest[20], PHP_SHA1_CTX * context)
{
unsigned char bits[8];
unsigned int index, padLen;
/* Save number of bits */
bits[7] = context->count[0] & 0xFF;
bits[6] = (context->count[0] >> 8) & 0xFF;
bits[5] = (context->count[0] >> 16) & 0xFF;
bits[4] = (context->count[0] >> 24) & 0xFF;
bits[3] = context->count[1] & 0xFF;
bits[2] = (context->count[1] >> 8) & 0xFF;
bits[1] = (context->count[1] >> 16) & 0xFF;
bits[0] = (context->count[1] >> 24) & 0xFF;
/* Pad out to 56 mod 64.
*/
index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
padLen = (index < 56) ? (56 - index) : (120 - index);
PHP_SHA1Update(context, PADDING, padLen);
/* Append length (before padding) */
PHP_SHA1Update(context, bits, 8);
/* Store state in digest */
SHAEncode32(digest, context->state, 20);
/* Zeroize sensitive information.
*/
memset((unsigned char*) context, 0, sizeof(*context));
}
/* }}} */
#endif /* PHP_HASH_SHA1_NOT_IN_CORE */
/* sha256 */
php_hash_ops php_hash_sha256_ops = {
(php_hash_init_func_t) PHP_SHA256Init,
(php_hash_update_func_t) PHP_SHA256Update,
(php_hash_final_func_t) PHP_SHA256Final,
32,
64,
sizeof(PHP_SHA256_CTX)
};
#define ROTR32(b,x) ((x >> b) | (x << (32 - b)))
#define ROTR64(b,x) ((x >> b) | (x << (64 - b)))
#define SHR(b, x) (x >> b)
/* Ch */
#define SHA256_F0(x,y,z) (((x) & (y)) ^ ((~(x)) & (z)))
/* Maj */
#define SHA256_F1(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z)))
/* SUM0 */
#define SHA256_F2(x) (ROTR32( 2,(x)) ^ ROTR32(13,(x)) ^ ROTR32(22,(x)))
/* SUM1 */
#define SHA256_F3(x) (ROTR32( 6,(x)) ^ ROTR32(11,(x)) ^ ROTR32(25,(x)))
/* OM0 */
#define SHA256_F4(x) (ROTR32( 7,(x)) ^ ROTR32(18,(x)) ^ SHR( 3,(x)))
/* OM1 */
#define SHA256_F5(x) (ROTR32(17,(x)) ^ ROTR32(19,(x)) ^ SHR(10,(x)))
static php_hash_uint32 SHA256_K[64] = {
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 };
/* {{{ PHP_SHA256Init
* SHA256 initialization. Begins an SHA256 operation, writing a new context.
*/
PHP_HASH_API void PHP_SHA256Init(PHP_SHA256_CTX * context)
{
context->count[0] = context->count[1] = 0;
/* Load magic initialization constants.
*/
context->state[0] = 0x6a09e667;
context->state[1] = 0xbb67ae85;
context->state[2] = 0x3c6ef372;
context->state[3] = 0xa54ff53a;
context->state[4] = 0x510e527f;
context->state[5] = 0x9b05688c;
context->state[6] = 0x1f83d9ab;
context->state[7] = 0x5be0cd19;
}
/* }}} */
/* {{{ SHA256Transform
* SHA256 basic transformation. Transforms state based on block.
*/
static void SHA256Transform(php_hash_uint32 state[8], const unsigned char block[64])
{
php_hash_uint32 a = state[0], b = state[1], c = state[2], d = state[3];
php_hash_uint32 e = state[4], f = state[5], g = state[6], h = state[7];
php_hash_uint32 x[16], T1, T2, W[64];
int i;
SHADecode32(x, block, 64);
/* Schedule */
for(i = 0; i < 16; i++) {
W[i] = x[i];
}
for(i = 16; i < 64; i++) {
W[i] = SHA256_F5(W[i-2]) + W[i-7] + SHA256_F4(W[i-15]) + W[i-16];
}
for (i = 0; i < 64; i++) {
T1 = h + SHA256_F3(e) + SHA256_F0(e,f,g) + SHA256_K[i] + W[i];
T2 = SHA256_F2(a) + SHA256_F1(a,b,c);
h = g; g = f; f = e; e = d + T1;
d = c; c = b; b = a; a = T1 + T2;
}
state[0] += a;
state[1] += b;
state[2] += c;
state[3] += d;
state[4] += e;
state[5] += f;
state[6] += g;
state[7] += h;
/* Zeroize sensitive information. */
memset((unsigned char*) x, 0, sizeof(x));
}
/* }}} */
/* {{{ PHP_SHA256Update
SHA256 block update operation. Continues an SHA256 message-digest
operation, processing another message block, and updating the
context.
*/
PHP_HASH_API void PHP_SHA256Update(PHP_SHA256_CTX * context, const unsigned char *input, unsigned int inputLen)
{
unsigned int i, index, partLen;
/* Compute number of bytes mod 64 */
index = (unsigned int) ((context->count[0] >> 3) & 0x3F);
/* Update number of bits */
if ((context->count[0] += ((php_hash_uint32) inputLen << 3)) < ((php_hash_uint32) inputLen << 3)) {
context->count[1]++;
}
context->count[1] += ((php_hash_uint32) inputLen >> 29);
partLen = 64 - index;
/* Transform as many times as possible.
*/
if (inputLen >= partLen) {
memcpy((unsigned char*) & context->buffer[index], (unsigned char*) input, partLen);
SHA256Transform(context->state, context->buffer);
for (i = partLen; i + 63 < inputLen; i += 64) {
SHA256Transform(context->state, &input[i]);
}
index = 0;
} else {
i = 0;
}
/* Buffer remaining input */
memcpy((unsigned char*) & context->buffer[index], (unsigned char*) & input[i], inputLen - i);
}
/* }}} */
/* {{{ PHP_SHA256Final
SHA256 finalization. Ends an SHA256 message-digest operation, writing the
the message digest and zeroizing the context.
*/
PHP_HASH_API void PHP_SHA256Final(unsigned char digest[32], PHP_SHA256_CTX * context)
{
unsigned char bits[8];
unsigned int index, padLen;
/* Save number of bits */
bits[7] = (unsigned char) (context->count[0] & 0xFF);
bits[6] = (unsigned char) ((context->count[0] >> 8) & 0xFF);
bits[5] = (unsigned char) ((context->count[0] >> 16) & 0xFF);
bits[4] = (unsigned char) ((context->count[0] >> 24) & 0xFF);
bits[3] = (unsigned char) (context->count[1] & 0xFF);
bits[2] = (unsigned char) ((context->count[1] >> 8) & 0xFF);
bits[1] = (unsigned char) ((context->count[1] >> 16) & 0xFF);
bits[0] = (unsigned char) ((context->count[1] >> 24) & 0xFF);
/* Pad out to 56 mod 64.
*/
index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
padLen = (index < 56) ? (56 - index) : (120 - index);
PHP_SHA256Update(context, PADDING, padLen);
/* Append length (before padding) */
PHP_SHA256Update(context, bits, 8);
/* Store state in digest */
SHAEncode32(digest, context->state, 32);
/* Zeroize sensitive information.
*/
memset((unsigned char*) context, 0, sizeof(*context));
}
/* }}} */
/* sha384/sha512 */
/* Ch */
#define SHA512_F0(x,y,z) (((x) & (y)) ^ ((~(x)) & (z)))
/* Maj */
#define SHA512_F1(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z)))
/* SUM0 */
#define SHA512_F2(x) (ROTR64(28, x) ^ ROTR64(34, x) ^ ROTR64(39, x))
/* SUM1 */
#define SHA512_F3(x) (ROTR64(14, x) ^ ROTR64(18, x) ^ ROTR64(41, x))
/* OM0 */
#define SHA512_F4(x) (ROTR64( 1, x) ^ ROTR64( 8, x) ^ SHR(7, x))
/* OM1 */
#define SHA512_F5(x) (ROTR64(19, x) ^ ROTR64(61, x) ^ SHR(6, x))
static php_hash_uint64 SHA512_K[128] = {
L64(0x428a2f98d728ae22), L64(0x7137449123ef65cd), L64(0xb5c0fbcfec4d3b2f), L64(0xe9b5dba58189dbbc),
L64(0x3956c25bf348b538), L64(0x59f111f1b605d019), L64(0x923f82a4af194f9b), L64(0xab1c5ed5da6d8118),
L64(0xd807aa98a3030242), L64(0x12835b0145706fbe), L64(0x243185be4ee4b28c), L64(0x550c7dc3d5ffb4e2),
L64(0x72be5d74f27b896f), L64(0x80deb1fe3b1696b1), L64(0x9bdc06a725c71235), L64(0xc19bf174cf692694),
L64(0xe49b69c19ef14ad2), L64(0xefbe4786384f25e3), L64(0x0fc19dc68b8cd5b5), L64(0x240ca1cc77ac9c65),
L64(0x2de92c6f592b0275), L64(0x4a7484aa6ea6e483), L64(0x5cb0a9dcbd41fbd4), L64(0x76f988da831153b5),
L64(0x983e5152ee66dfab), L64(0xa831c66d2db43210), L64(0xb00327c898fb213f), L64(0xbf597fc7beef0ee4),
L64(0xc6e00bf33da88fc2), L64(0xd5a79147930aa725), L64(0x06ca6351e003826f), L64(0x142929670a0e6e70),
L64(0x27b70a8546d22ffc), L64(0x2e1b21385c26c926), L64(0x4d2c6dfc5ac42aed), L64(0x53380d139d95b3df),
L64(0x650a73548baf63de), L64(0x766a0abb3c77b2a8), L64(0x81c2c92e47edaee6), L64(0x92722c851482353b),
L64(0xa2bfe8a14cf10364), L64(0xa81a664bbc423001), L64(0xc24b8b70d0f89791), L64(0xc76c51a30654be30),
L64(0xd192e819d6ef5218), L64(0xd69906245565a910), L64(0xf40e35855771202a), L64(0x106aa07032bbd1b8),
L64(0x19a4c116b8d2d0c8), L64(0x1e376c085141ab53), L64(0x2748774cdf8eeb99), L64(0x34b0bcb5e19b48a8),
L64(0x391c0cb3c5c95a63), L64(0x4ed8aa4ae3418acb), L64(0x5b9cca4f7763e373), L64(0x682e6ff3d6b2b8a3),
L64(0x748f82ee5defb2fc), L64(0x78a5636f43172f60), L64(0x84c87814a1f0ab72), L64(0x8cc702081a6439ec),
L64(0x90befffa23631e28), L64(0xa4506cebde82bde9), L64(0xbef9a3f7b2c67915), L64(0xc67178f2e372532b),
L64(0xca273eceea26619c), L64(0xd186b8c721c0c207), L64(0xeada7dd6cde0eb1e), L64(0xf57d4f7fee6ed178),
L64(0x06f067aa72176fba), L64(0x0a637dc5a2c898a6), L64(0x113f9804bef90dae), L64(0x1b710b35131c471b),
L64(0x28db77f523047d84), L64(0x32caab7b40c72493), L64(0x3c9ebe0a15c9bebc), L64(0x431d67c49c100d4c),
L64(0x4cc5d4becb3e42b6), L64(0x597f299cfc657e2a), L64(0x5fcb6fab3ad6faec), L64(0x6c44198c4a475817) };
/* {{{ SHAEncode64
Encodes input (php_hash_uint64) into output (unsigned char). Assumes len is
a multiple of 8.
*/
static void SHAEncode64(unsigned char *output, php_hash_uint64 *input, unsigned int len)
{
unsigned int i, j;
for (i = 0, j = 0; j < len; i++, j += 8) {
output[j] = (unsigned char) ((input[i] >> 56) & 0xff);
output[j + 1] = (unsigned char) ((input[i] >> 48) & 0xff);
output[j + 2] = (unsigned char) ((input[i] >> 40) & 0xff);
output[j + 3] = (unsigned char) ((input[i] >> 32) & 0xff);
output[j + 4] = (unsigned char) ((input[i] >> 24) & 0xff);
output[j + 5] = (unsigned char) ((input[i] >> 16) & 0xff);
output[j + 6] = (unsigned char) ((input[i] >> 8) & 0xff);
output[j + 7] = (unsigned char) (input[i] & 0xff);
}
}
/* }}} */
/* {{{ SHADecode64
Decodes input (unsigned char) into output (php_hash_uint64). Assumes len is
a multiple of 8.
*/
static void SHADecode64(php_hash_uint64 *output, const unsigned char *input, unsigned int len)
{
unsigned int i, j;
for (i = 0, j = 0; j < len; i++, j += 8)
output[i] =
((php_hash_uint64) input[j + 7]) | (((php_hash_uint64) input[j + 6]) << 8) |
(((php_hash_uint64) input[j + 5]) << 16) | (((php_hash_uint64) input[j + 4]) << 24) |
(((php_hash_uint64) input[j + 3]) << 32) | (((php_hash_uint64) input[j + 2]) << 40) |
(((php_hash_uint64) input[j + 1]) << 48) | (((php_hash_uint64) input[j]) << 56);
}
/* }}} */
/* {{{ PHP_SHA384Init
* SHA384 initialization. Begins an SHA384 operation, writing a new context.
*/
PHP_HASH_API void PHP_SHA384Init(PHP_SHA384_CTX * context)
{
context->count[0] = context->count[1] = 0;
/* Load magic initialization constants.
*/
context->state[0] = L64(0xcbbb9d5dc1059ed8);
context->state[1] = L64(0x629a292a367cd507);
context->state[2] = L64(0x9159015a3070dd17);
context->state[3] = L64(0x152fecd8f70e5939);
context->state[4] = L64(0x67332667ffc00b31);
context->state[5] = L64(0x8eb44a8768581511);
context->state[6] = L64(0xdb0c2e0d64f98fa7);
context->state[7] = L64(0x47b5481dbefa4fa4);
}
/* }}} */
/* {{{ SHA512Transform
* SHA512 basic transformation. Transforms state based on block.
* SHA384 uses the exact same algorithm
*/
static void SHA512Transform(php_hash_uint64 state[8], const unsigned char block[128])
{
php_hash_uint64 a = state[0], b = state[1], c = state[2], d = state[3];
php_hash_uint64 e = state[4], f = state[5], g = state[6], h = state[7];
php_hash_uint64 x[16], T1, T2, W[80];
int i;
SHADecode64(x, block, 128);
/* Schedule */
for(i = 0; i < 16; i++) {
W[i] = x[i];
}
for(i = 16; i < 80; i++) {
W[i] = SHA512_F5(W[i-2]) + W[i-7] + SHA512_F4(W[i-15]) + W[i-16];
}
for (i = 0; i < 80; i++) {
T1 = h + SHA512_F3(e) + SHA512_F0(e,f,g) + SHA512_K[i] + W[i];
T2 = SHA512_F2(a) + SHA512_F1(a,b,c);
h = g; g = f; f = e; e = d + T1;
d = c; c = b; b = a; a = T1 + T2;
}
state[0] += a;
state[1] += b;
state[2] += c;
state[3] += d;
state[4] += e;
state[5] += f;
state[6] += g;
state[7] += h;
/* Zeroize sensitive information. */
memset((unsigned char*) x, 0, sizeof(x));
}
/* }}} */
/* {{{ PHP_SHA384Update
SHA384 block update operation. Continues an SHA384 message-digest
operation, processing another message block, and updating the
context.
*/
PHP_HASH_API void PHP_SHA384Update(PHP_SHA384_CTX * context, const unsigned char *input, unsigned int inputLen)
{
unsigned int i, index, partLen;
/* Compute number of bytes mod 128 */
index = (unsigned int) ((context->count[0] >> 3) & 0x7F);
/* Update number of bits */
if ((context->count[0] += ((php_hash_uint64) inputLen << 3)) < ((php_hash_uint64) inputLen << 3)) {
context->count[1]++;
}
context->count[1] += ((php_hash_uint64) inputLen >> 61);
partLen = 128 - index;
/* Transform as many times as possible.
*/
if (inputLen >= partLen) {
memcpy((unsigned char*) & context->buffer[index], (unsigned char*) input, partLen);
SHA512Transform(context->state, context->buffer);
for (i = partLen; i + 127 < inputLen; i += 128) {
SHA512Transform(context->state, &input[i]);
}
index = 0;
} else {
i = 0;
}
/* Buffer remaining input */
memcpy((unsigned char*) & context->buffer[index], (unsigned char*) & input[i], inputLen - i);
}
/* }}} */
/* {{{ PHP_SHA384Final
SHA384 finalization. Ends an SHA384 message-digest operation, writing the
the message digest and zeroizing the context.
*/
PHP_HASH_API void PHP_SHA384Final(unsigned char digest[48], PHP_SHA384_CTX * context)
{
unsigned char bits[16];
unsigned int index, padLen;
/* Save number of bits */
bits[15] = (unsigned char) (context->count[0] & 0xFF);
bits[14] = (unsigned char) ((context->count[0] >> 8) & 0xFF);
bits[13] = (unsigned char) ((context->count[0] >> 16) & 0xFF);
bits[12] = (unsigned char) ((context->count[0] >> 24) & 0xFF);
bits[11] = (unsigned char) ((context->count[0] >> 32) & 0xFF);
bits[10] = (unsigned char) ((context->count[0] >> 40) & 0xFF);
bits[9] = (unsigned char) ((context->count[0] >> 48) & 0xFF);
bits[8] = (unsigned char) ((context->count[0] >> 56) & 0xFF);
bits[7] = (unsigned char) (context->count[1] & 0xFF);
bits[6] = (unsigned char) ((context->count[1] >> 8) & 0xFF);
bits[5] = (unsigned char) ((context->count[1] >> 16) & 0xFF);
bits[4] = (unsigned char) ((context->count[1] >> 24) & 0xFF);
bits[3] = (unsigned char) ((context->count[1] >> 32) & 0xFF);
bits[2] = (unsigned char) ((context->count[1] >> 40) & 0xFF);
bits[1] = (unsigned char) ((context->count[1] >> 48) & 0xFF);
bits[0] = (unsigned char) ((context->count[1] >> 56) & 0xFF);
/* Pad out to 112 mod 128.
*/
index = (unsigned int) ((context->count[0] >> 3) & 0x7f);
padLen = (index < 112) ? (112 - index) : (240 - index);
PHP_SHA384Update(context, PADDING, padLen);
/* Append length (before padding) */
PHP_SHA384Update(context, bits, 16);
/* Store state in digest */
SHAEncode64(digest, context->state, 48);
/* Zeroize sensitive information.
*/
memset((unsigned char*) context, 0, sizeof(*context));
}
/* }}} */
php_hash_ops php_hash_sha384_ops = {
(php_hash_init_func_t) PHP_SHA384Init,
(php_hash_update_func_t) PHP_SHA384Update,
(php_hash_final_func_t) PHP_SHA384Final,
48,
128,
sizeof(PHP_SHA384_CTX)
};
/* {{{ PHP_SHA512Init
* SHA512 initialization. Begins an SHA512 operation, writing a new context.
*/
PHP_HASH_API void PHP_SHA512Init(PHP_SHA512_CTX * context)
{
context->count[0] = context->count[1] = 0;
/* Load magic initialization constants.
*/
context->state[0] = L64(0x6a09e667f3bcc908);
context->state[1] = L64(0xbb67ae8584caa73b);
context->state[2] = L64(0x3c6ef372fe94f82b);
context->state[3] = L64(0xa54ff53a5f1d36f1);
context->state[4] = L64(0x510e527fade682d1);
context->state[5] = L64(0x9b05688c2b3e6c1f);
context->state[6] = L64(0x1f83d9abfb41bd6b);
context->state[7] = L64(0x5be0cd19137e2179);
}
/* }}} */
/* {{{ PHP_SHA512Update
SHA512 block update operation. Continues an SHA512 message-digest
operation, processing another message block, and updating the
context.
*/
PHP_HASH_API void PHP_SHA512Update(PHP_SHA512_CTX * context, const unsigned char *input, unsigned int inputLen)
{
unsigned int i, index, partLen;
/* Compute number of bytes mod 128 */
index = (unsigned int) ((context->count[0] >> 3) & 0x7F);
/* Update number of bits */
if ((context->count[0] += ((php_hash_uint64) inputLen << 3)) < ((php_hash_uint64) inputLen << 3)) {
context->count[1]++;
}
context->count[1] += ((php_hash_uint64) inputLen >> 61);
partLen = 128 - index;
/* Transform as many times as possible.
*/
if (inputLen >= partLen) {
memcpy((unsigned char*) & context->buffer[index], (unsigned char*) input, partLen);
SHA512Transform(context->state, context->buffer);
for (i = partLen; i + 127 < inputLen; i += 128) {
SHA512Transform(context->state, &input[i]);
}
index = 0;
} else {
i = 0;
}
/* Buffer remaining input */
memcpy((unsigned char*) & context->buffer[index], (unsigned char*) & input[i], inputLen - i);
}
/* }}} */
/* {{{ PHP_SHA512Final
SHA512 finalization. Ends an SHA384 message-digest operation, writing the
the message digest and zeroizing the context.
*/
PHP_HASH_API void PHP_SHA512Final(unsigned char digest[48], PHP_SHA512_CTX * context)
{
unsigned char bits[16];
unsigned int index, padLen;
/* Save number of bits */
bits[15] = (unsigned char) (context->count[0] & 0xFF);
bits[14] = (unsigned char) ((context->count[0] >> 8) & 0xFF);
bits[13] = (unsigned char) ((context->count[0] >> 16) & 0xFF);
bits[12] = (unsigned char) ((context->count[0] >> 24) & 0xFF);
bits[11] = (unsigned char) ((context->count[0] >> 32) & 0xFF);
bits[10] = (unsigned char) ((context->count[0] >> 40) & 0xFF);
bits[9] = (unsigned char) ((context->count[0] >> 48) & 0xFF);
bits[8] = (unsigned char) ((context->count[0] >> 56) & 0xFF);
bits[7] = (unsigned char) (context->count[1] & 0xFF);
bits[6] = (unsigned char) ((context->count[1] >> 8) & 0xFF);
bits[5] = (unsigned char) ((context->count[1] >> 16) & 0xFF);
bits[4] = (unsigned char) ((context->count[1] >> 24) & 0xFF);
bits[3] = (unsigned char) ((context->count[1] >> 32) & 0xFF);
bits[2] = (unsigned char) ((context->count[1] >> 40) & 0xFF);
bits[1] = (unsigned char) ((context->count[1] >> 48) & 0xFF);
bits[0] = (unsigned char) ((context->count[1] >> 56) & 0xFF);
/* Pad out to 112 mod 128.
*/
index = (unsigned int) ((context->count[0] >> 3) & 0x7f);
padLen = (index < 112) ? (112 - index) : (240 - index);
PHP_SHA512Update(context, PADDING, padLen);
/* Append length (before padding) */
PHP_SHA512Update(context, bits, 16);
/* Store state in digest */
SHAEncode64(digest, context->state, 64);
/* Zeroize sensitive information.
*/
memset((unsigned char*) context, 0, sizeof(*context));
}
/* }}} */
php_hash_ops php_hash_sha512_ops = {
(php_hash_init_func_t) PHP_SHA512Init,
(php_hash_update_func_t) PHP_SHA512Update,
(php_hash_final_func_t) PHP_SHA512Final,
64,
128,
sizeof(PHP_SHA512_CTX)
};
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: sw=4 ts=4 fdm=marker
* vim<600: sw=4 ts=4
*/
-212
View File
@@ -1,212 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2005 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Michael Wallner <mike@php.net> |
| Sara Golemon <pollita@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#include "php_hash.h"
#include "php_hash_snefru.h"
#include "php_hash_snefru_tables.h"
#define round(L, C, N, SB) \
SBE = SB[C & 0xff]; \
L ^= SBE; \
N ^= SBE
#ifndef DBG_SNEFRU
#define DBG_SNEFRU 0
#endif
#if DBG_SNEFRU
void ph(php_hash_uint32 h[16])
{
int i;
for (i = 0; i < 16; i++)
printf ("%08lx", h[i]); printf("\n");
}
#endif
static inline void Snefru(php_hash_uint32 input[16])
{
static int shifts[4] = {16, 8, 16, 24};
int b, index, rshift, lshift;
const php_hash_uint32 *t0,*t1;
php_hash_uint32 SBE,B00,B01,B02,B03,B04,B05,B06,B07,B08,B09,B10,B11,B12,B13,B14,B15;
B00 = input[0];
B01 = input[1];
B02 = input[2];
B03 = input[3];
B04 = input[4];
B05 = input[5];
B06 = input[6];
B07 = input[7];
B08 = input[8];
B09 = input[9];
B10 = input[10];
B11 = input[11];
B12 = input[12];
B13 = input[13];
B14 = input[14];
B15 = input[15];
for (index = 0; index < 8; index++) {
t0 = tables[2*index+0];
t1 = tables[2*index+1];
for (b = 0; b < 4; b++) {
round(B15, B00, B01, t0);
round(B00, B01, B02, t0);
round(B01, B02, B03, t1);
round(B02, B03, B04, t1);
round(B03, B04, B05, t0);
round(B04, B05, B06, t0);
round(B05, B06, B07, t1);
round(B06, B07, B08, t1);
round(B07, B08, B09, t0);
round(B08, B09, B10, t0);
round(B09, B10, B11, t1);
round(B10, B11, B12, t1);
round(B11, B12, B13, t0);
round(B12, B13, B14, t0);
round(B13, B14, B15, t1);
round(B14, B15, B00, t1);
rshift = shifts[b];
lshift = 32-rshift;
B00 = (B00 >> rshift) | (B00 << lshift);
B01 = (B01 >> rshift) | (B01 << lshift);
B02 = (B02 >> rshift) | (B02 << lshift);
B03 = (B03 >> rshift) | (B03 << lshift);
B04 = (B04 >> rshift) | (B04 << lshift);
B05 = (B05 >> rshift) | (B05 << lshift);
B06 = (B06 >> rshift) | (B06 << lshift);
B07 = (B07 >> rshift) | (B07 << lshift);
B08 = (B08 >> rshift) | (B08 << lshift);
B09 = (B09 >> rshift) | (B09 << lshift);
B10 = (B10 >> rshift) | (B10 << lshift);
B11 = (B11 >> rshift) | (B11 << lshift);
B12 = (B12 >> rshift) | (B12 << lshift);
B13 = (B13 >> rshift) | (B13 << lshift);
B14 = (B14 >> rshift) | (B14 << lshift);
B15 = (B15 >> rshift) | (B15 << lshift);
}
}
input[0] ^= B15;
input[1] ^= B14;
input[2] ^= B13;
input[3] ^= B12;
input[4] ^= B11;
input[5] ^= B10;
input[6] ^= B09;
input[7] ^= B08;
#if DBG_SNEFRU
ph(input);
#endif
}
static inline void SnefruTransform(PHP_SNEFRU_CTX *context, const unsigned char input[32])
{
int i, j;
for (i = 0, j = 0; i < 32; i += 4, ++j) {
context->state[8+j] = ((input[i] & 0xff) << 24) | ((input[i+1] & 0xff) << 16) |
((input[i+2] & 0xff) << 8) | (input[i+3] & 0xff);
}
Snefru(context->state);
memset(&context->state[8], 0, sizeof(php_hash_uint32) * 8);
}
PHP_HASH_API void PHP_SNEFRUInit(PHP_SNEFRU_CTX *context)
{
memset(context, 0, sizeof(*context));
}
static const php_hash_uint32 MAX32 = 0xffffffffLU;
PHP_HASH_API void PHP_SNEFRUUpdate(PHP_SNEFRU_CTX *context, const unsigned char *input, size_t len)
{
if ((MAX32 - context->count[1]) < (len * 8)) {
context->count[0]++;
context->count[1] = MAX32 - context->count[1];
context->count[1] = (len * 8) - context->count[1];
} else {
context->count[1] += len * 8;
}
if (context->length + len < 32) {
memcpy(&context->buffer[context->length], input, len);
context->length += len;
} else {
size_t i = 0, r = (context->length + len) % 32;
if (context->length) {
i = 32 - context->length;
memcpy(&context->buffer[context->length], input, i);
SnefruTransform(context, context->buffer);
}
for (; i + 32 <= len; i += 32) {
SnefruTransform(context, input + i);
}
memcpy(context->buffer, input + i, r);
memset(&context->buffer[r], 0, 32 - r);
context->length = r;
}
}
PHP_HASH_API void PHP_SNEFRUFinal(unsigned char digest[32], PHP_SNEFRU_CTX *context)
{
php_hash_uint32 i, j;
if (context->length) {
SnefruTransform(context, context->buffer);
}
context->state[14] = context->count[0];
context->state[15] = context->count[1];
Snefru(context->state);
for (i = 0, j = 0; j < 32; i++, j += 4) {
digest[j] = (unsigned char) ((context->state[i] >> 24) & 0xff);
digest[j + 1] = (unsigned char) ((context->state[i] >> 16) & 0xff);
digest[j + 2] = (unsigned char) ((context->state[i] >> 8) & 0xff);
digest[j + 3] = (unsigned char) (context->state[i] & 0xff);
}
memset(context, 0, sizeof(*context));
}
php_hash_ops php_hash_snefru_ops = {
(php_hash_init_func_t) PHP_SNEFRUInit,
(php_hash_update_func_t) PHP_SNEFRUUpdate,
(php_hash_final_func_t) PHP_SNEFRUFinal,
32,
32,
sizeof(PHP_SNEFRU_CTX)
};
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: sw=4 ts=4 fdm=marker
* vim<600: sw=4 ts=4
*/
-285
View File
@@ -1,285 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2005 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Michael Wallner <mike@php.net> |
| Sara Golemon <pollita@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#include "php_hash.h"
#include "php_hash_tiger.h"
#include "php_hash_tiger_tables.h"
/* {{{ */
#define save_abc \
aa = a; \
bb = b; \
cc = c;
#define round(a,b,c,x,mul) \
c ^= x; \
a -= t1[(unsigned char)(c)] ^ \
t2[(unsigned char)(((php_hash_uint32)(c))>>(2*8))] ^ \
t3[(unsigned char)((c)>>(4*8))] ^ \
t4[(unsigned char)(((php_hash_uint32)((c)>>(4*8)))>>(2*8))] ; \
b += t4[(unsigned char)(((php_hash_uint32)(c))>>(1*8))] ^ \
t3[(unsigned char)(((php_hash_uint32)(c))>>(3*8))] ^ \
t2[(unsigned char)(((php_hash_uint32)((c)>>(4*8)))>>(1*8))] ^ \
t1[(unsigned char)(((php_hash_uint32)((c)>>(4*8)))>>(3*8))]; \
b *= mul;
#define pass(a,b,c,mul) \
round(a,b,c,x0,mul) \
round(b,c,a,x1,mul) \
round(c,a,b,x2,mul) \
round(a,b,c,x3,mul) \
round(b,c,a,x4,mul) \
round(c,a,b,x5,mul) \
round(a,b,c,x6,mul) \
round(b,c,a,x7,mul)
#define key_schedule \
x0 -= x7 ^ L64(0xA5A5A5A5A5A5A5A5); \
x1 ^= x0; \
x2 += x1; \
x3 -= x2 ^ ((~x1)<<19); \
x4 ^= x3; \
x5 += x4; \
x6 -= x5 ^ ((~x4)>>23); \
x7 ^= x6; \
x0 += x7; \
x1 -= x0 ^ ((~x7)<<19); \
x2 ^= x1; \
x3 += x2; \
x4 -= x3 ^ ((~x2)>>23); \
x5 ^= x4; \
x6 += x5; \
x7 -= x6 ^ L64(0x0123456789ABCDEF);
#define feedforward \
a ^= aa; \
b -= bb; \
c += cc;
#define compress(passes) \
save_abc \
pass(a,b,c,5) \
key_schedule \
pass(c,a,b,7) \
key_schedule \
pass(b,c,a,9) \
for(pass_no=0; pass_no<passes; pass_no++) { \
key_schedule \
pass(a,b,c,9) \
tmpa=a; a=c; c=b; b=tmpa; \
} \
feedforward
#define tiger_compress(passes, str, state) \
{ \
register php_hash_uint64 a, b, c, tmpa, x0, x1, x2, x3, x4, x5, x6, x7; \
php_hash_uint64 aa, bb, cc; \
int pass_no; \
\
a = state[0]; \
b = state[1]; \
c = state[2]; \
\
x0=str[0]; x1=str[1]; x2=str[2]; x3=str[3]; \
x4=str[4]; x5=str[5]; x6=str[6]; x7=str[7]; \
\
compress(passes); \
\
state[0] = a; \
state[1] = b; \
state[2] = c; \
}
/* }}} */
static inline void TigerFinalize(PHP_TIGER_CTX *context)
{
context->passed += (php_hash_uint64) context->length << 3;
context->buffer[context->length++] = 0x1;
if (context->length % 8) {
memset(&context->buffer[context->length], 0, 8-context->length%8);
context->length += 8-context->length%8;
}
if (context->length > 56) {
memset(&context->buffer[context->length], 0, 64 - context->length);
tiger_compress(context->passes, ((php_hash_uint64 *) context->buffer), context->state);
memset(context->buffer, 0, 56);
} else {
memset(&context->buffer[context->length], 0, 56 - context->length);
}
memcpy(&context->buffer[56], &context->passed, sizeof(php_hash_uint64));
tiger_compress(context->passes, ((php_hash_uint64 *) context->buffer), context->state);
}
PHP_HASH_API void PHP_3TIGERInit(PHP_TIGER_CTX *context)
{
memset(context, 0, sizeof(*context));
context->state[0] = L64(0x0123456789ABCDEF);
context->state[1] = L64(0xFEDCBA9876543210);
context->state[2] = L64(0xF096A5B4C3B2E187);
}
PHP_HASH_API void PHP_4TIGERInit(PHP_TIGER_CTX *context)
{
memset(context, 0, sizeof(*context));
context->passes = 1;
context->state[0] = L64(0x0123456789ABCDEF);
context->state[1] = L64(0xFEDCBA9876543210);
context->state[2] = L64(0xF096A5B4C3B2E187);
}
PHP_HASH_API void PHP_TIGERUpdate(PHP_TIGER_CTX *context, const unsigned char *input, size_t len)
{
if (context->length + len < 64) {
memcpy(&context->buffer[context->length], input, len);
context->length += len;
} else {
size_t i = 0, r = (context->length + len) % 64;
if (context->length) {
i = 64 - context->length;
memcpy(&context->buffer[context->length], input, i);
tiger_compress(context->passes, ((const php_hash_uint64 *) context->buffer), context->state);
memset(context->buffer, 0, 64);
context->passed += 512;
}
for (; i + 64 <= len; i += 64) {
tiger_compress(context->passes, ((const php_hash_uint64 *) (input + i)), context->state);
context->passed += 512;
}
memcpy(context->buffer, input + i, r);
context->length = r;
}
}
PHP_HASH_API void PHP_TIGER128Final(unsigned char digest[16], PHP_TIGER_CTX *context)
{
TigerFinalize(context);
digest[0] = (unsigned char) ((context->state[0] >> 56) & 0xff);
digest[1] = (unsigned char) ((context->state[0] >> 48) & 0xff);
digest[2] = (unsigned char) ((context->state[0] >> 40) & 0xff);
digest[3] = (unsigned char) ((context->state[0] >> 32) & 0xff);
digest[4] = (unsigned char) ((context->state[0] >> 24) & 0xff);
digest[5] = (unsigned char) ((context->state[0] >> 16) & 0xff);
digest[6] = (unsigned char) ((context->state[0] >> 8) & 0xff);
digest[7] = (unsigned char) (context->state[0] & 0xff);
digest[8] = (unsigned char) ((context->state[1] >> 56) & 0xff);
digest[9] = (unsigned char) ((context->state[1] >> 48) & 0xff);
digest[10] = (unsigned char) ((context->state[1] >> 40) & 0xff);
digest[11] = (unsigned char) ((context->state[1] >> 32) & 0xff);
digest[12] = (unsigned char) ((context->state[1] >> 24) & 0xff);
digest[13] = (unsigned char) ((context->state[1] >> 16) & 0xff);
digest[14] = (unsigned char) ((context->state[1] >> 8) & 0xff);
digest[15] = (unsigned char) (context->state[1] & 0xff);
memset(context, 0, sizeof(*context));
}
PHP_HASH_API void PHP_TIGER160Final(unsigned char digest[20], PHP_TIGER_CTX *context)
{
TigerFinalize(context);
digest[0] = (unsigned char) ((context->state[0] >> 56) & 0xff);
digest[1] = (unsigned char) ((context->state[0] >> 48) & 0xff);
digest[2] = (unsigned char) ((context->state[0] >> 40) & 0xff);
digest[3] = (unsigned char) ((context->state[0] >> 32) & 0xff);
digest[4] = (unsigned char) ((context->state[0] >> 24) & 0xff);
digest[5] = (unsigned char) ((context->state[0] >> 16) & 0xff);
digest[6] = (unsigned char) ((context->state[0] >> 8) & 0xff);
digest[7] = (unsigned char) (context->state[0] & 0xff);
digest[8] = (unsigned char) ((context->state[1] >> 56) & 0xff);
digest[9] = (unsigned char) ((context->state[1] >> 48) & 0xff);
digest[10] = (unsigned char) ((context->state[1] >> 40) & 0xff);
digest[11] = (unsigned char) ((context->state[1] >> 32) & 0xff);
digest[12] = (unsigned char) ((context->state[1] >> 24) & 0xff);
digest[13] = (unsigned char) ((context->state[1] >> 16) & 0xff);
digest[14] = (unsigned char) ((context->state[1] >> 8) & 0xff);
digest[15] = (unsigned char) (context->state[1] & 0xff);
digest[16] = (unsigned char) ((context->state[2] >> 56) & 0xff);
digest[17] = (unsigned char) ((context->state[2] >> 48) & 0xff);
digest[18] = (unsigned char) ((context->state[2] >> 40) & 0xff);
digest[19] = (unsigned char) ((context->state[2] >> 32) & 0xff);
memset(context, 0, sizeof(*context));
}
PHP_HASH_API void PHP_TIGER192Final(unsigned char digest[24], PHP_TIGER_CTX *context)
{
TigerFinalize(context);
digest[0] = (unsigned char) ((context->state[0] >> 56) & 0xff);
digest[1] = (unsigned char) ((context->state[0] >> 48) & 0xff);
digest[2] = (unsigned char) ((context->state[0] >> 40) & 0xff);
digest[3] = (unsigned char) ((context->state[0] >> 32) & 0xff);
digest[4] = (unsigned char) ((context->state[0] >> 24) & 0xff);
digest[5] = (unsigned char) ((context->state[0] >> 16) & 0xff);
digest[6] = (unsigned char) ((context->state[0] >> 8) & 0xff);
digest[7] = (unsigned char) (context->state[0] & 0xff);
digest[8] = (unsigned char) ((context->state[1] >> 56) & 0xff);
digest[9] = (unsigned char) ((context->state[1] >> 48) & 0xff);
digest[10] = (unsigned char) ((context->state[1] >> 40) & 0xff);
digest[11] = (unsigned char) ((context->state[1] >> 32) & 0xff);
digest[12] = (unsigned char) ((context->state[1] >> 24) & 0xff);
digest[13] = (unsigned char) ((context->state[1] >> 16) & 0xff);
digest[14] = (unsigned char) ((context->state[1] >> 8) & 0xff);
digest[15] = (unsigned char) (context->state[1] & 0xff);
digest[16] = (unsigned char) ((context->state[2] >> 56) & 0xff);
digest[17] = (unsigned char) ((context->state[2] >> 48) & 0xff);
digest[18] = (unsigned char) ((context->state[2] >> 40) & 0xff);
digest[19] = (unsigned char) ((context->state[2] >> 32) & 0xff);
digest[20] = (unsigned char) ((context->state[2] >> 24) & 0xff);
digest[21] = (unsigned char) ((context->state[2] >> 16) & 0xff);
digest[22] = (unsigned char) ((context->state[2] >> 8) & 0xff);
digest[23] = (unsigned char) (context->state[2] & 0xff);
memset(context, 0, sizeof(*context));
}
#define PHP_HASH_TIGER_OPS(p, b) \
php_hash_ops php_hash_##p##tiger##b##_ops = { \
(php_hash_init_func_t) PHP_##p##TIGERInit, \
(php_hash_update_func_t) PHP_TIGERUpdate, \
(php_hash_final_func_t) PHP_TIGER##b##Final, \
b/8, \
64, \
sizeof(PHP_TIGER_CTX) \
}
PHP_HASH_TIGER_OPS(3, 128);
PHP_HASH_TIGER_OPS(3, 160);
PHP_HASH_TIGER_OPS(3, 192);
PHP_HASH_TIGER_OPS(4, 128);
PHP_HASH_TIGER_OPS(4, 160);
PHP_HASH_TIGER_OPS(4, 192);
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: sw=4 ts=4 fdm=marker
* vim<600: sw=4 ts=4
*/
-452
View File
@@ -1,452 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2005 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Michael Wallner <mike@php.net> |
| Sara Golemon <pollita@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#include "php_hash.h"
/*
* TODO: simplify Update and Final, those look ridiculously complex
* Mike, 2005-11-23
*/
#include "php_hash_whirlpool.h"
#include "php_hash_whirlpool_tables.h"
#define DIGESTBYTES 64
#define DIGESTBITS (8*DIGESTBYTES) /* 512 */
#define WBLOCKBYTES 64
#define WBLOCKBITS (8*WBLOCKBYTES) /* 512 */
#define LENGTHBYTES 32
#define LENGTHBITS (8*LENGTHBYTES) /* 256 */
static void WhirlpoolTransform(PHP_WHIRLPOOL_CTX *context)
{
int i, r;
php_hash_uint64 K[8]; /* the round key */
php_hash_uint64 block[8]; /* mu(buffer) */
php_hash_uint64 state[8]; /* the cipher state */
php_hash_uint64 L[8];
unsigned char *buffer = context->buffer.data;
/*
* map the buffer to a block:
*/
for (i = 0; i < 8; i++, buffer += 8) {
block[i] =
(((php_hash_uint64)buffer[0] ) << 56) ^
(((php_hash_uint64)buffer[1] & 0xffL) << 48) ^
(((php_hash_uint64)buffer[2] & 0xffL) << 40) ^
(((php_hash_uint64)buffer[3] & 0xffL) << 32) ^
(((php_hash_uint64)buffer[4] & 0xffL) << 24) ^
(((php_hash_uint64)buffer[5] & 0xffL) << 16) ^
(((php_hash_uint64)buffer[6] & 0xffL) << 8) ^
(((php_hash_uint64)buffer[7] & 0xffL) );
}
/*
* compute and apply K^0 to the cipher state:
*/
state[0] = block[0] ^ (K[0] = context->state[0]);
state[1] = block[1] ^ (K[1] = context->state[1]);
state[2] = block[2] ^ (K[2] = context->state[2]);
state[3] = block[3] ^ (K[3] = context->state[3]);
state[4] = block[4] ^ (K[4] = context->state[4]);
state[5] = block[5] ^ (K[5] = context->state[5]);
state[6] = block[6] ^ (K[6] = context->state[6]);
state[7] = block[7] ^ (K[7] = context->state[7]);
/*
* iterate over all rounds:
*/
for (r = 1; r <= R; r++) {
/*
* compute K^r from K^{r-1}:
*/
L[0] =
C0[(int)(K[0] >> 56) ] ^
C1[(int)(K[7] >> 48) & 0xff] ^
C2[(int)(K[6] >> 40) & 0xff] ^
C3[(int)(K[5] >> 32) & 0xff] ^
C4[(int)(K[4] >> 24) & 0xff] ^
C5[(int)(K[3] >> 16) & 0xff] ^
C6[(int)(K[2] >> 8) & 0xff] ^
C7[(int)(K[1] ) & 0xff] ^
rc[r];
L[1] =
C0[(int)(K[1] >> 56) ] ^
C1[(int)(K[0] >> 48) & 0xff] ^
C2[(int)(K[7] >> 40) & 0xff] ^
C3[(int)(K[6] >> 32) & 0xff] ^
C4[(int)(K[5] >> 24) & 0xff] ^
C5[(int)(K[4] >> 16) & 0xff] ^
C6[(int)(K[3] >> 8) & 0xff] ^
C7[(int)(K[2] ) & 0xff];
L[2] =
C0[(int)(K[2] >> 56) ] ^
C1[(int)(K[1] >> 48) & 0xff] ^
C2[(int)(K[0] >> 40) & 0xff] ^
C3[(int)(K[7] >> 32) & 0xff] ^
C4[(int)(K[6] >> 24) & 0xff] ^
C5[(int)(K[5] >> 16) & 0xff] ^
C6[(int)(K[4] >> 8) & 0xff] ^
C7[(int)(K[3] ) & 0xff];
L[3] =
C0[(int)(K[3] >> 56) ] ^
C1[(int)(K[2] >> 48) & 0xff] ^
C2[(int)(K[1] >> 40) & 0xff] ^
C3[(int)(K[0] >> 32) & 0xff] ^
C4[(int)(K[7] >> 24) & 0xff] ^
C5[(int)(K[6] >> 16) & 0xff] ^
C6[(int)(K[5] >> 8) & 0xff] ^
C7[(int)(K[4] ) & 0xff];
L[4] =
C0[(int)(K[4] >> 56) ] ^
C1[(int)(K[3] >> 48) & 0xff] ^
C2[(int)(K[2] >> 40) & 0xff] ^
C3[(int)(K[1] >> 32) & 0xff] ^
C4[(int)(K[0] >> 24) & 0xff] ^
C5[(int)(K[7] >> 16) & 0xff] ^
C6[(int)(K[6] >> 8) & 0xff] ^
C7[(int)(K[5] ) & 0xff];
L[5] =
C0[(int)(K[5] >> 56) ] ^
C1[(int)(K[4] >> 48) & 0xff] ^
C2[(int)(K[3] >> 40) & 0xff] ^
C3[(int)(K[2] >> 32) & 0xff] ^
C4[(int)(K[1] >> 24) & 0xff] ^
C5[(int)(K[0] >> 16) & 0xff] ^
C6[(int)(K[7] >> 8) & 0xff] ^
C7[(int)(K[6] ) & 0xff];
L[6] =
C0[(int)(K[6] >> 56) ] ^
C1[(int)(K[5] >> 48) & 0xff] ^
C2[(int)(K[4] >> 40) & 0xff] ^
C3[(int)(K[3] >> 32) & 0xff] ^
C4[(int)(K[2] >> 24) & 0xff] ^
C5[(int)(K[1] >> 16) & 0xff] ^
C6[(int)(K[0] >> 8) & 0xff] ^
C7[(int)(K[7] ) & 0xff];
L[7] =
C0[(int)(K[7] >> 56) ] ^
C1[(int)(K[6] >> 48) & 0xff] ^
C2[(int)(K[5] >> 40) & 0xff] ^
C3[(int)(K[4] >> 32) & 0xff] ^
C4[(int)(K[3] >> 24) & 0xff] ^
C5[(int)(K[2] >> 16) & 0xff] ^
C6[(int)(K[1] >> 8) & 0xff] ^
C7[(int)(K[0] ) & 0xff];
K[0] = L[0];
K[1] = L[1];
K[2] = L[2];
K[3] = L[3];
K[4] = L[4];
K[5] = L[5];
K[6] = L[6];
K[7] = L[7];
/*
* apply the r-th round transformation:
*/
L[0] =
C0[(int)(state[0] >> 56) ] ^
C1[(int)(state[7] >> 48) & 0xff] ^
C2[(int)(state[6] >> 40) & 0xff] ^
C3[(int)(state[5] >> 32) & 0xff] ^
C4[(int)(state[4] >> 24) & 0xff] ^
C5[(int)(state[3] >> 16) & 0xff] ^
C6[(int)(state[2] >> 8) & 0xff] ^
C7[(int)(state[1] ) & 0xff] ^
K[0];
L[1] =
C0[(int)(state[1] >> 56) ] ^
C1[(int)(state[0] >> 48) & 0xff] ^
C2[(int)(state[7] >> 40) & 0xff] ^
C3[(int)(state[6] >> 32) & 0xff] ^
C4[(int)(state[5] >> 24) & 0xff] ^
C5[(int)(state[4] >> 16) & 0xff] ^
C6[(int)(state[3] >> 8) & 0xff] ^
C7[(int)(state[2] ) & 0xff] ^
K[1];
L[2] =
C0[(int)(state[2] >> 56) ] ^
C1[(int)(state[1] >> 48) & 0xff] ^
C2[(int)(state[0] >> 40) & 0xff] ^
C3[(int)(state[7] >> 32) & 0xff] ^
C4[(int)(state[6] >> 24) & 0xff] ^
C5[(int)(state[5] >> 16) & 0xff] ^
C6[(int)(state[4] >> 8) & 0xff] ^
C7[(int)(state[3] ) & 0xff] ^
K[2];
L[3] =
C0[(int)(state[3] >> 56) ] ^
C1[(int)(state[2] >> 48) & 0xff] ^
C2[(int)(state[1] >> 40) & 0xff] ^
C3[(int)(state[0] >> 32) & 0xff] ^
C4[(int)(state[7] >> 24) & 0xff] ^
C5[(int)(state[6] >> 16) & 0xff] ^
C6[(int)(state[5] >> 8) & 0xff] ^
C7[(int)(state[4] ) & 0xff] ^
K[3];
L[4] =
C0[(int)(state[4] >> 56) ] ^
C1[(int)(state[3] >> 48) & 0xff] ^
C2[(int)(state[2] >> 40) & 0xff] ^
C3[(int)(state[1] >> 32) & 0xff] ^
C4[(int)(state[0] >> 24) & 0xff] ^
C5[(int)(state[7] >> 16) & 0xff] ^
C6[(int)(state[6] >> 8) & 0xff] ^
C7[(int)(state[5] ) & 0xff] ^
K[4];
L[5] =
C0[(int)(state[5] >> 56) ] ^
C1[(int)(state[4] >> 48) & 0xff] ^
C2[(int)(state[3] >> 40) & 0xff] ^
C3[(int)(state[2] >> 32) & 0xff] ^
C4[(int)(state[1] >> 24) & 0xff] ^
C5[(int)(state[0] >> 16) & 0xff] ^
C6[(int)(state[7] >> 8) & 0xff] ^
C7[(int)(state[6] ) & 0xff] ^
K[5];
L[6] =
C0[(int)(state[6] >> 56) ] ^
C1[(int)(state[5] >> 48) & 0xff] ^
C2[(int)(state[4] >> 40) & 0xff] ^
C3[(int)(state[3] >> 32) & 0xff] ^
C4[(int)(state[2] >> 24) & 0xff] ^
C5[(int)(state[1] >> 16) & 0xff] ^
C6[(int)(state[0] >> 8) & 0xff] ^
C7[(int)(state[7] ) & 0xff] ^
K[6];
L[7] =
C0[(int)(state[7] >> 56) ] ^
C1[(int)(state[6] >> 48) & 0xff] ^
C2[(int)(state[5] >> 40) & 0xff] ^
C3[(int)(state[4] >> 32) & 0xff] ^
C4[(int)(state[3] >> 24) & 0xff] ^
C5[(int)(state[2] >> 16) & 0xff] ^
C6[(int)(state[1] >> 8) & 0xff] ^
C7[(int)(state[0] ) & 0xff] ^
K[7];
state[0] = L[0];
state[1] = L[1];
state[2] = L[2];
state[3] = L[3];
state[4] = L[4];
state[5] = L[5];
state[6] = L[6];
state[7] = L[7];
}
/*
* apply the Miyaguchi-Preneel compression function:
*/
context->state[0] ^= state[0] ^ block[0];
context->state[1] ^= state[1] ^ block[1];
context->state[2] ^= state[2] ^ block[2];
context->state[3] ^= state[3] ^ block[3];
context->state[4] ^= state[4] ^ block[4];
context->state[5] ^= state[5] ^ block[5];
context->state[6] ^= state[6] ^ block[6];
context->state[7] ^= state[7] ^ block[7];
memset(state, 0, sizeof(state));
}
PHP_HASH_API void PHP_WHIRLPOOLInit(PHP_WHIRLPOOL_CTX *context)
{
memset(context, 0, sizeof(*context));
}
PHP_HASH_API void PHP_WHIRLPOOLUpdate(PHP_WHIRLPOOL_CTX *context, const unsigned char *input, size_t len)
{
php_hash_uint64 sourceBits = len * 8;
int sourcePos = 0; /* index of leftmost source unsigned char containing data (1 to 8 bits). */
int sourceGap = (8 - ((int)sourceBits & 7)) & 7; /* space on source[sourcePos]. */
int bufferRem = context->buffer.bits & 7; /* occupied bits on buffer[bufferPos]. */
const unsigned char *source = input;
unsigned char *buffer = context->buffer.data;
unsigned char *bitLength = context->bitlength;
int bufferBits = context->buffer.bits;
int bufferPos = context->buffer.pos;
php_hash_uint32 b, carry;
int i;
/*
* tally the length of the added data:
*/
php_hash_uint64 value = sourceBits;
for (i = 31, carry = 0; i >= 0 && (carry != 0 || value != L64(0)); i--) {
carry += bitLength[i] + ((php_hash_uint32)value & 0xff);
bitLength[i] = (unsigned char)carry;
carry >>= 8;
value >>= 8;
}
/*
* process data in chunks of 8 bits (a more efficient approach would be to take whole-word chunks):
*/
while (sourceBits > 8) {
/* N.B. at least source[sourcePos] and source[sourcePos+1] contain data. */
/*
* take a byte from the source:
*/
b = ((source[sourcePos] << sourceGap) & 0xff) |
((source[sourcePos + 1] & 0xff) >> (8 - sourceGap));
/*
* process this byte:
*/
buffer[bufferPos++] |= (unsigned char)(b >> bufferRem);
bufferBits += 8 - bufferRem; /* bufferBits = 8*bufferPos; */
if (bufferBits == DIGESTBITS) {
/*
* process data block:
*/
WhirlpoolTransform(context);
/*
* reset buffer:
*/
bufferBits = bufferPos = 0;
}
buffer[bufferPos] = (unsigned char) (b << (8 - bufferRem));
bufferBits += bufferRem;
/*
* proceed to remaining data:
*/
sourceBits -= 8;
sourcePos++;
}
/* now 0 <= sourceBits <= 8;
* furthermore, all data (if any is left) is in source[sourcePos].
*/
if (sourceBits > 0) {
b = (source[sourcePos] << sourceGap) & 0xff; /* bits are left-justified on b. */
/*
* process the remaining bits:
*/
buffer[bufferPos] |= b >> bufferRem;
} else {
b = 0;
}
if (bufferRem + sourceBits < 8) {
/*
* all remaining data fits on buffer[bufferPos],
* and there still remains some space.
*/
bufferBits += (int) sourceBits;
} else {
/*
* buffer[bufferPos] is full:
*/
bufferPos++;
bufferBits += 8 - bufferRem; /* bufferBits = 8*bufferPos; */
sourceBits -= 8 - bufferRem;
/* now 0 <= sourceBits < 8;
* furthermore, all data (if any is left) is in source[sourcePos].
*/
if (bufferBits == DIGESTBITS) {
/*
* process data block:
*/
WhirlpoolTransform(context);
/*
* reset buffer:
*/
bufferBits = bufferPos = 0;
}
buffer[bufferPos] = (unsigned char) (b << (8 - bufferRem));
bufferBits += (int)sourceBits;
}
context->buffer.bits = bufferBits;
context->buffer.pos = bufferPos;
}
PHP_HASH_API void PHP_WHIRLPOOLFinal(unsigned char digest[64], PHP_WHIRLPOOL_CTX *context)
{
int i;
unsigned char *buffer = context->buffer.data;
unsigned char *bitLength = context->bitlength;
int bufferBits = context->buffer.bits;
int bufferPos = context->buffer.pos;
/*
* append a '1'-bit:
*/
buffer[bufferPos] |= 0x80U >> (bufferBits & 7);
bufferPos++; /* all remaining bits on the current unsigned char are set to zero. */
/*
* pad with zero bits to complete (N*WBLOCKBITS - LENGTHBITS) bits:
*/
if (bufferPos > WBLOCKBYTES - LENGTHBYTES) {
if (bufferPos < WBLOCKBYTES) {
memset(&buffer[bufferPos], 0, WBLOCKBYTES - bufferPos);
}
/*
* process data block:
*/
WhirlpoolTransform(context);
/*
* reset buffer:
*/
bufferPos = 0;
}
if (bufferPos < WBLOCKBYTES - LENGTHBYTES) {
memset(&buffer[bufferPos], 0, (WBLOCKBYTES - LENGTHBYTES) - bufferPos);
}
bufferPos = WBLOCKBYTES - LENGTHBYTES;
/*
* append bit length of hashed data:
*/
memcpy(&buffer[WBLOCKBYTES - LENGTHBYTES], bitLength, LENGTHBYTES);
/*
* process data block:
*/
WhirlpoolTransform(context);
/*
* return the completed message digest:
*/
for (i = 0; i < DIGESTBYTES/8; i++) {
digest[0] = (unsigned char)(context->state[i] >> 56);
digest[1] = (unsigned char)(context->state[i] >> 48);
digest[2] = (unsigned char)(context->state[i] >> 40);
digest[3] = (unsigned char)(context->state[i] >> 32);
digest[4] = (unsigned char)(context->state[i] >> 24);
digest[5] = (unsigned char)(context->state[i] >> 16);
digest[6] = (unsigned char)(context->state[i] >> 8);
digest[7] = (unsigned char)(context->state[i] );
digest += 8;
}
memset(context, 0, sizeof(*context));
}
php_hash_ops php_hash_whirlpool_ops = {
(php_hash_init_func_t) PHP_WHIRLPOOLInit,
(php_hash_update_func_t) PHP_WHIRLPOOLUpdate,
(php_hash_final_func_t) PHP_WHIRLPOOLFinal,
64,
64,
sizeof(PHP_WHIRLPOOL_CTX)
};
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: sw=4 ts=4 fdm=marker
* vim<600: sw=4 ts=4
*/
-91
View File
@@ -1,91 +0,0 @@
<package version="1.0">
<name>hash</name>
<summary>pHASH Message Digest Framework</summary>
<description>
Native implementations of common message digest algorithms using a generic factory method
</description>
<license>PHP</license>
<maintainers>
<maintainer>
<user>pollita</user>
<name>Sara Golemon</name>
<email>pollita@php.net</email>
<role>lead</role>
</maintainer>
<maintainer>
<user>mike</user>
<name>Michael Wallner</name>
<email>mike@php.net</email>
<role>lead</role>
</maintainer>
</maintainers>
<release>
<version>1.0</version>
<state>stable</state>
<date>2005-12-06</date>
<notes>
Initial Release
* md4, md5
* sha1, sha256, sha384, sha512
* ripemd128, ripemd160
* tiger128, tiger160, tiger192 (3 and 4 passes)
* haval128, haval160, haval192, haval224, haval256 (3, 4 and 5 passes)
* crc32, crc32b, adler32, gost, snefru, whirlpool
</notes>
</release>
<filelist>
<file role="src" name="config.m4"/>
<file role="src" name="config.w32"/>
<file role="src" name="hash.c"/>
<file role="src" name="php_hash.h"/>
<file role="src" name="php_hash_types.h"/>
<file role="src" name="hash_md.c"/>
<file role="src" name="php_hash_md.h"/>
<file role="src" name="hash_sha.c"/>
<file role="src" name="php_hash_sha.h"/>
<file role="src" name="hash_ripemd.c"/>
<file role="src" name="php_hash_ripemd.h"/>
<file role="src" name="hash_whirlpool.c"/>
<file role="src" name="php_hash_whirlpool.h"/>
<file role="src" name="php_hash_whirlpool_tables.h"/>
<file role="src" name="hash_tiger.c"/>
<file role="src" name="php_hash_tiger.h"/>
<file role="src" name="php_hash_tiger_tables.h"/>
<file role="src" name="hash_snefru.c"/>
<file role="src" name="php_hash_snefru.h"/>
<file role="src" name="php_hash_snefru_tables.h"/>
<file role="src" name="hash_gost.c"/>
<file role="src" name="php_hash_gost.h"/>
<file role="src" name="php_hash_gost_tables.h"/>
<file role="src" name="hash_adler32.c"/>
<file role="src" name="php_hash_adler32.h"/>
<file role="src" name="hash_crc32.c"/>
<file role="src" name="php_hash_crc32.h"/>
<file role="src" name="php_hash_crc32_tables.h"/>
<file role="doc" name="README"/>
<dir role="test" name="tests">
<file role="test" name="hmac-md5.phpt"/>
<file role="test" name="md4.phpt"/>
<file role="test" name="md5.phpt"/>
<file role="test" name="sha1.phpt"/>
<file role="test" name="sha256.phpt"/>
<file role="test" name="sha384.phpt"/>
<file role="test" name="sha512.phpt"/>
<file role="test" name="ripemd128.phpt"/>
<file role="test" name="ripemd160.phpt"/>
<file role="test" name="haval.phpt"/>
<file role="test" name="tiger.phpt"/>
<file role="test" name="whirlpool.phpt"/>
<file role="test" name="gost.phpt"/>
<file role="test" name="snefru.phpt"/>
<file role="test" name="crc32.phpt"/>
<file role="test" name="adler32.phpt"/>
</dir>
</filelist>
</package>
<!--
vim: et ts=1 sw=1
-->
-144
View File
@@ -1,144 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2005 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Sara Golemon <pollita@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef PHP_HASH_H
#define PHP_HASH_H
#include "php.h"
#include "php_hash_types.h"
#define PHP_HASH_EXTNAME "hash"
#define PHP_HASH_EXTVER "1.0"
#define PHP_HASH_RESNAME "Hash Context"
#define PHP_HASH_HMAC 0x0001
typedef void (*php_hash_init_func_t)(void *context);
typedef void (*php_hash_update_func_t)(void *context, const unsigned char *buf, unsigned int count);
typedef void (*php_hash_final_func_t)(unsigned char *digest, void *context);
typedef struct _php_hash_ops {
php_hash_init_func_t hash_init;
php_hash_update_func_t hash_update;
php_hash_final_func_t hash_final;
int digest_size;
int block_size;
int context_size;
} php_hash_ops;
typedef struct _php_hash_data {
php_hash_ops *ops;
void *context;
long options;
unsigned char *key;
} php_hash_data;
extern php_hash_ops php_hash_md4_ops;
extern php_hash_ops php_hash_md5_ops;
extern php_hash_ops php_hash_sha1_ops;
extern php_hash_ops php_hash_sha256_ops;
extern php_hash_ops php_hash_sha384_ops;
extern php_hash_ops php_hash_sha512_ops;
extern php_hash_ops php_hash_ripemd128_ops;
extern php_hash_ops php_hash_ripemd160_ops;
extern php_hash_ops php_hash_whirlpool_ops;
extern php_hash_ops php_hash_3tiger128_ops;
extern php_hash_ops php_hash_3tiger160_ops;
extern php_hash_ops php_hash_3tiger192_ops;
extern php_hash_ops php_hash_4tiger128_ops;
extern php_hash_ops php_hash_4tiger160_ops;
extern php_hash_ops php_hash_4tiger192_ops;
extern php_hash_ops php_hash_snefru_ops;
extern php_hash_ops php_hash_gost_ops;
extern php_hash_ops php_hash_adler32_ops;
extern php_hash_ops php_hash_crc32_ops;
extern php_hash_ops php_hash_crc32b_ops;
#define PHP_HASH_HAVAL_OPS(p,b) extern php_hash_ops php_hash_##p##haval##b##_ops;
PHP_HASH_HAVAL_OPS(3,128)
PHP_HASH_HAVAL_OPS(3,160)
PHP_HASH_HAVAL_OPS(3,192)
PHP_HASH_HAVAL_OPS(3,224)
PHP_HASH_HAVAL_OPS(3,256)
PHP_HASH_HAVAL_OPS(4,128)
PHP_HASH_HAVAL_OPS(4,160)
PHP_HASH_HAVAL_OPS(4,192)
PHP_HASH_HAVAL_OPS(4,224)
PHP_HASH_HAVAL_OPS(4,256)
PHP_HASH_HAVAL_OPS(5,128)
PHP_HASH_HAVAL_OPS(5,160)
PHP_HASH_HAVAL_OPS(5,192)
PHP_HASH_HAVAL_OPS(5,224)
PHP_HASH_HAVAL_OPS(5,256)
extern zend_module_entry hash_module_entry;
#define phpext_hash_ptr &hash_module_entry
#ifdef PHP_WIN32
#define PHP_HASH_API __declspec(dllexport)
#else
#define PHP_HASH_API
#endif
#ifdef ZTS
#include "TSRM.h"
#endif
PHP_FUNCTION(hash);
PHP_FUNCTION(hash_file);
PHP_FUNCTION(hash_hmac);
PHP_FUNCTION(hash_hmac_file);
PHP_FUNCTION(hash_init);
PHP_FUNCTION(hash_update);
PHP_FUNCTION(hash_update_stream);
PHP_FUNCTION(hash_update_file);
PHP_FUNCTION(hash_final);
PHP_FUNCTION(hash_algos);
PHP_HASH_API php_hash_ops *php_hash_fetch_ops(const char *algo, int algo_len);
PHP_HASH_API void php_hash_register_algo(const char *algo, php_hash_ops *ops);
static inline void php_hash_bin2hex(char *out, const unsigned char *in, int in_len)
{
static const char hexits[16] = "0123456789abcdef";
int i;
for(i = 0; i < in_len; i++) {
out[i * 2] = hexits[in[i] >> 4];
out[(i * 2) + 1] = hexits[in[i] & 0x0F];
}
}
#endif /* PHP_HASH_H */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/
-43
View File
@@ -1,43 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2005 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Michael Wallner <mike@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef PHP_HASH_ADLER32_H
#define PHP_HASH_ADLER32_H
#include "ext/standard/basic_functions.h"
typedef struct {
php_hash_uint32 state;
} PHP_ADLER32_CTX;
PHP_HASH_API void PHP_ADLER32Init(PHP_ADLER32_CTX *context);
PHP_HASH_API void PHP_ADLER32Update(PHP_ADLER32_CTX *context, const unsigned char *input, size_t len);
PHP_HASH_API void PHP_ADLER32Final(unsigned char digest[4], PHP_ADLER32_CTX *context);
#endif
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: sw=4 ts=4 fdm=marker
* vim<600: sw=4 ts=4
*/
-44
View File
@@ -1,44 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2005 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Michael Wallner <mike@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef PHP_HASH_CRC32_H
#define PHP_HASH_CRC32_H
#include "ext/standard/basic_functions.h"
typedef struct {
php_hash_uint32 state;
} PHP_CRC32_CTX;
PHP_HASH_API void PHP_CRC32Init(PHP_CRC32_CTX *context);
PHP_HASH_API void PHP_CRC32Update(PHP_CRC32_CTX *context, const unsigned char *input, size_t len);
PHP_HASH_API void PHP_CRC32BUpdate(PHP_CRC32_CTX *context, const unsigned char *input, size_t len);
PHP_HASH_API void PHP_CRC32Final(unsigned char digest[4], PHP_CRC32_CTX *context);
#endif
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: sw=4 ts=4 fdm=marker
* vim<600: sw=4 ts=4
*/
-149
View File
@@ -1,149 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2005 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Michael Wallner <mike@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
static const php_hash_uint32 crc32_table[] = { 0x0,
0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b,
0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6,
0x2b4bcb61, 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd,
0x4c11db70, 0x48d0c6c7, 0x4593e01e, 0x4152fda9, 0x5f15adac,
0x5bd4b01b, 0x569796c2, 0x52568b75, 0x6a1936c8, 0x6ed82b7f,
0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3, 0x709f7b7a,
0x745e66cd, 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039,
0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, 0xbe2b5b58,
0xbaea46ef, 0xb7a96036, 0xb3687d81, 0xad2f2d84, 0xa9ee3033,
0xa4ad16ea, 0xa06c0b5d, 0xd4326d90, 0xd0f37027, 0xddb056fe,
0xd9714b49, 0xc7361b4c, 0xc3f706fb, 0xceb42022, 0xca753d95,
0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1, 0xe13ef6f4,
0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d, 0x34867077, 0x30476dc0,
0x3d044b19, 0x39c556ae, 0x278206ab, 0x23431b1c, 0x2e003dc5,
0x2ac12072, 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16,
0x018aeb13, 0x054bf6a4, 0x0808d07d, 0x0cc9cdca, 0x7897ab07,
0x7c56b6b0, 0x71159069, 0x75d48dde, 0x6b93dddb, 0x6f52c06c,
0x6211e6b5, 0x66d0fb02, 0x5e9f46bf, 0x5a5e5b08, 0x571d7dd1,
0x53dc6066, 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba,
0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e, 0xbfa1b04b,
0xbb60adfc, 0xb6238b25, 0xb2e29692, 0x8aad2b2f, 0x8e6c3698,
0x832f1041, 0x87ee0df6, 0x99a95df3, 0x9d684044, 0x902b669d,
0x94ea7b2a, 0xe0b41de7, 0xe4750050, 0xe9362689, 0xedf73b3e,
0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2, 0xc6bcf05f,
0xc27dede8, 0xcf3ecb31, 0xcbffd686, 0xd5b88683, 0xd1799b34,
0xdc3abded, 0xd8fba05a, 0x690ce0ee, 0x6dcdfd59, 0x608edb80,
0x644fc637, 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb,
0x4f040d56, 0x4bc510e1, 0x46863638, 0x42472b8f, 0x5c007b8a,
0x58c1663d, 0x558240e4, 0x51435d53, 0x251d3b9e, 0x21dc2629,
0x2c9f00f0, 0x285e1d47, 0x36194d42, 0x32d850f5, 0x3f9b762c,
0x3b5a6b9b, 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff,
0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623, 0xf12f560e,
0xf5ee4bb9, 0xf8ad6d60, 0xfc6c70d7, 0xe22b20d2, 0xe6ea3d65,
0xeba91bbc, 0xef68060b, 0xd727bbb6, 0xd3e6a601, 0xdea580d8,
0xda649d6f, 0xc423cd6a, 0xc0e2d0dd, 0xcda1f604, 0xc960ebb3,
0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7, 0xae3afba2,
0xaafbe615, 0xa7b8c0cc, 0xa379dd7b, 0x9b3660c6, 0x9ff77d71,
0x92b45ba8, 0x9675461f, 0x8832161a, 0x8cf30bad, 0x81b02d74,
0x857130c3, 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640,
0x4e8ee645, 0x4a4ffbf2, 0x470cdd2b, 0x43cdc09c, 0x7b827d21,
0x7f436096, 0x7200464f, 0x76c15bf8, 0x68860bfd, 0x6c47164a,
0x61043093, 0x65c52d24, 0x119b4be9, 0x155a565e, 0x18197087,
0x1cd86d30, 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec,
0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088, 0x2497d08d,
0x2056cd3a, 0x2d15ebe3, 0x29d4f654, 0xc5a92679, 0xc1683bce,
0xcc2b1d17, 0xc8ea00a0, 0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb,
0xdbee767c, 0xe3a1cbc1, 0xe760d676, 0xea23f0af, 0xeee2ed18,
0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4, 0x89b8fd09,
0x8d79e0be, 0x803ac667, 0x84fbdbd0, 0x9abc8bd5, 0x9e7d9662,
0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf,
0xa2f33668, 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4
};
static const php_hash_uint32 crc32b_table[] = {
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba,
0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec,
0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940,
0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116,
0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a,
0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818,
0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c,
0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086,
0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4,
0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe,
0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252,
0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60,
0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04,
0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a,
0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,
0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e,
0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0,
0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6,
0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d,
};
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: sw=4 ts=4 fdm=marker
* vim<600: sw=4 ts=4
*/
-47
View File
@@ -1,47 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2005 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Michael Wallner <mike@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef PHP_HASH_GOST_H
#define PHP_HASH_GOST_H
#include "ext/standard/basic_functions.h"
/* GOST context */
typedef struct {
php_hash_uint32 state[16];
php_hash_uint32 count[2];
unsigned char length;
unsigned char buffer[32];
} PHP_GOST_CTX;
PHP_HASH_API void PHP_GOSTInit(PHP_GOST_CTX *);
PHP_HASH_API void PHP_GOSTUpdate(PHP_GOST_CTX *, const unsigned char *, size_t);
PHP_HASH_API void PHP_GOSTFinal(unsigned char[64], PHP_GOST_CTX *);
#endif
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: sw=4 ts=4 fdm=marker
* vim<600: sw=4 ts=4
*/
-138
View File
@@ -1,138 +0,0 @@
static const php_hash_uint32 tables[4][256] = {
{ /* table 1 */
0x00072000LU, 0x00075000LU, 0x00074800LU, 0x00071000LU, 0x00076800LU, 0x00074000LU, 0x00070000LU, 0x00077000LU,
0x00073000LU, 0x00075800LU, 0x00070800LU, 0x00076000LU, 0x00073800LU, 0x00077800LU, 0x00072800LU, 0x00071800LU,
0x0005A000LU, 0x0005D000LU, 0x0005C800LU, 0x00059000LU, 0x0005E800LU, 0x0005C000LU, 0x00058000LU, 0x0005F000LU,
0x0005B000LU, 0x0005D800LU, 0x00058800LU, 0x0005E000LU, 0x0005B800LU, 0x0005F800LU, 0x0005A800LU, 0x00059800LU,
0x00022000LU, 0x00025000LU, 0x00024800LU, 0x00021000LU, 0x00026800LU, 0x00024000LU, 0x00020000LU, 0x00027000LU,
0x00023000LU, 0x00025800LU, 0x00020800LU, 0x00026000LU, 0x00023800LU, 0x00027800LU, 0x00022800LU, 0x00021800LU,
0x00062000LU, 0x00065000LU, 0x00064800LU, 0x00061000LU, 0x00066800LU, 0x00064000LU, 0x00060000LU, 0x00067000LU,
0x00063000LU, 0x00065800LU, 0x00060800LU, 0x00066000LU, 0x00063800LU, 0x00067800LU, 0x00062800LU, 0x00061800LU,
0x00032000LU, 0x00035000LU, 0x00034800LU, 0x00031000LU, 0x00036800LU, 0x00034000LU, 0x00030000LU, 0x00037000LU,
0x00033000LU, 0x00035800LU, 0x00030800LU, 0x00036000LU, 0x00033800LU, 0x00037800LU, 0x00032800LU, 0x00031800LU,
0x0006A000LU, 0x0006D000LU, 0x0006C800LU, 0x00069000LU, 0x0006E800LU, 0x0006C000LU, 0x00068000LU, 0x0006F000LU,
0x0006B000LU, 0x0006D800LU, 0x00068800LU, 0x0006E000LU, 0x0006B800LU, 0x0006F800LU, 0x0006A800LU, 0x00069800LU,
0x0007A000LU, 0x0007D000LU, 0x0007C800LU, 0x00079000LU, 0x0007E800LU, 0x0007C000LU, 0x00078000LU, 0x0007F000LU,
0x0007B000LU, 0x0007D800LU, 0x00078800LU, 0x0007E000LU, 0x0007B800LU, 0x0007F800LU, 0x0007A800LU, 0x00079800LU,
0x00052000LU, 0x00055000LU, 0x00054800LU, 0x00051000LU, 0x00056800LU, 0x00054000LU, 0x00050000LU, 0x00057000LU,
0x00053000LU, 0x00055800LU, 0x00050800LU, 0x00056000LU, 0x00053800LU, 0x00057800LU, 0x00052800LU, 0x00051800LU,
0x00012000LU, 0x00015000LU, 0x00014800LU, 0x00011000LU, 0x00016800LU, 0x00014000LU, 0x00010000LU, 0x00017000LU,
0x00013000LU, 0x00015800LU, 0x00010800LU, 0x00016000LU, 0x00013800LU, 0x00017800LU, 0x00012800LU, 0x00011800LU,
0x0001A000LU, 0x0001D000LU, 0x0001C800LU, 0x00019000LU, 0x0001E800LU, 0x0001C000LU, 0x00018000LU, 0x0001F000LU,
0x0001B000LU, 0x0001D800LU, 0x00018800LU, 0x0001E000LU, 0x0001B800LU, 0x0001F800LU, 0x0001A800LU, 0x00019800LU,
0x00042000LU, 0x00045000LU, 0x00044800LU, 0x00041000LU, 0x00046800LU, 0x00044000LU, 0x00040000LU, 0x00047000LU,
0x00043000LU, 0x00045800LU, 0x00040800LU, 0x00046000LU, 0x00043800LU, 0x00047800LU, 0x00042800LU, 0x00041800LU,
0x0000A000LU, 0x0000D000LU, 0x0000C800LU, 0x00009000LU, 0x0000E800LU, 0x0000C000LU, 0x00008000LU, 0x0000F000LU,
0x0000B000LU, 0x0000D800LU, 0x00008800LU, 0x0000E000LU, 0x0000B800LU, 0x0000F800LU, 0x0000A800LU, 0x00009800LU,
0x00002000LU, 0x00005000LU, 0x00004800LU, 0x00001000LU, 0x00006800LU, 0x00004000LU, 0x00000000LU, 0x00007000LU,
0x00003000LU, 0x00005800LU, 0x00000800LU, 0x00006000LU, 0x00003800LU, 0x00007800LU, 0x00002800LU, 0x00001800LU,
0x0003A000LU, 0x0003D000LU, 0x0003C800LU, 0x00039000LU, 0x0003E800LU, 0x0003C000LU, 0x00038000LU, 0x0003F000LU,
0x0003B000LU, 0x0003D800LU, 0x00038800LU, 0x0003E000LU, 0x0003B800LU, 0x0003F800LU, 0x0003A800LU, 0x00039800LU,
0x0002A000LU, 0x0002D000LU, 0x0002C800LU, 0x00029000LU, 0x0002E800LU, 0x0002C000LU, 0x00028000LU, 0x0002F000LU,
0x0002B000LU, 0x0002D800LU, 0x00028800LU, 0x0002E000LU, 0x0002B800LU, 0x0002F800LU, 0x0002A800LU, 0x00029800LU,
0x0004A000LU, 0x0004D000LU, 0x0004C800LU, 0x00049000LU, 0x0004E800LU, 0x0004C000LU, 0x00048000LU, 0x0004F000LU,
0x0004B000LU, 0x0004D800LU, 0x00048800LU, 0x0004E000LU, 0x0004B800LU, 0x0004F800LU, 0x0004A800LU, 0x00049800LU,
},
{ /* table 2 */
0x03A80000LU, 0x03C00000LU, 0x03880000LU, 0x03E80000LU, 0x03D00000LU, 0x03980000LU, 0x03A00000LU, 0x03900000LU,
0x03F00000LU, 0x03F80000LU, 0x03E00000LU, 0x03B80000LU, 0x03B00000LU, 0x03800000LU, 0x03C80000LU, 0x03D80000LU,
0x06A80000LU, 0x06C00000LU, 0x06880000LU, 0x06E80000LU, 0x06D00000LU, 0x06980000LU, 0x06A00000LU, 0x06900000LU,
0x06F00000LU, 0x06F80000LU, 0x06E00000LU, 0x06B80000LU, 0x06B00000LU, 0x06800000LU, 0x06C80000LU, 0x06D80000LU,
0x05280000LU, 0x05400000LU, 0x05080000LU, 0x05680000LU, 0x05500000LU, 0x05180000LU, 0x05200000LU, 0x05100000LU,
0x05700000LU, 0x05780000LU, 0x05600000LU, 0x05380000LU, 0x05300000LU, 0x05000000LU, 0x05480000LU, 0x05580000LU,
0x00A80000LU, 0x00C00000LU, 0x00880000LU, 0x00E80000LU, 0x00D00000LU, 0x00980000LU, 0x00A00000LU, 0x00900000LU,
0x00F00000LU, 0x00F80000LU, 0x00E00000LU, 0x00B80000LU, 0x00B00000LU, 0x00800000LU, 0x00C80000LU, 0x00D80000LU,
0x00280000LU, 0x00400000LU, 0x00080000LU, 0x00680000LU, 0x00500000LU, 0x00180000LU, 0x00200000LU, 0x00100000LU,
0x00700000LU, 0x00780000LU, 0x00600000LU, 0x00380000LU, 0x00300000LU, 0x00000000LU, 0x00480000LU, 0x00580000LU,
0x04280000LU, 0x04400000LU, 0x04080000LU, 0x04680000LU, 0x04500000LU, 0x04180000LU, 0x04200000LU, 0x04100000LU,
0x04700000LU, 0x04780000LU, 0x04600000LU, 0x04380000LU, 0x04300000LU, 0x04000000LU, 0x04480000LU, 0x04580000LU,
0x04A80000LU, 0x04C00000LU, 0x04880000LU, 0x04E80000LU, 0x04D00000LU, 0x04980000LU, 0x04A00000LU, 0x04900000LU,
0x04F00000LU, 0x04F80000LU, 0x04E00000LU, 0x04B80000LU, 0x04B00000LU, 0x04800000LU, 0x04C80000LU, 0x04D80000LU,
0x07A80000LU, 0x07C00000LU, 0x07880000LU, 0x07E80000LU, 0x07D00000LU, 0x07980000LU, 0x07A00000LU, 0x07900000LU,
0x07F00000LU, 0x07F80000LU, 0x07E00000LU, 0x07B80000LU, 0x07B00000LU, 0x07800000LU, 0x07C80000LU, 0x07D80000LU,
0x07280000LU, 0x07400000LU, 0x07080000LU, 0x07680000LU, 0x07500000LU, 0x07180000LU, 0x07200000LU, 0x07100000LU,
0x07700000LU, 0x07780000LU, 0x07600000LU, 0x07380000LU, 0x07300000LU, 0x07000000LU, 0x07480000LU, 0x07580000LU,
0x02280000LU, 0x02400000LU, 0x02080000LU, 0x02680000LU, 0x02500000LU, 0x02180000LU, 0x02200000LU, 0x02100000LU,
0x02700000LU, 0x02780000LU, 0x02600000LU, 0x02380000LU, 0x02300000LU, 0x02000000LU, 0x02480000LU, 0x02580000LU,
0x03280000LU, 0x03400000LU, 0x03080000LU, 0x03680000LU, 0x03500000LU, 0x03180000LU, 0x03200000LU, 0x03100000LU,
0x03700000LU, 0x03780000LU, 0x03600000LU, 0x03380000LU, 0x03300000LU, 0x03000000LU, 0x03480000LU, 0x03580000LU,
0x06280000LU, 0x06400000LU, 0x06080000LU, 0x06680000LU, 0x06500000LU, 0x06180000LU, 0x06200000LU, 0x06100000LU,
0x06700000LU, 0x06780000LU, 0x06600000LU, 0x06380000LU, 0x06300000LU, 0x06000000LU, 0x06480000LU, 0x06580000LU,
0x05A80000LU, 0x05C00000LU, 0x05880000LU, 0x05E80000LU, 0x05D00000LU, 0x05980000LU, 0x05A00000LU, 0x05900000LU,
0x05F00000LU, 0x05F80000LU, 0x05E00000LU, 0x05B80000LU, 0x05B00000LU, 0x05800000LU, 0x05C80000LU, 0x05D80000LU,
0x01280000LU, 0x01400000LU, 0x01080000LU, 0x01680000LU, 0x01500000LU, 0x01180000LU, 0x01200000LU, 0x01100000LU,
0x01700000LU, 0x01780000LU, 0x01600000LU, 0x01380000LU, 0x01300000LU, 0x01000000LU, 0x01480000LU, 0x01580000LU,
0x02A80000LU, 0x02C00000LU, 0x02880000LU, 0x02E80000LU, 0x02D00000LU, 0x02980000LU, 0x02A00000LU, 0x02900000LU,
0x02F00000LU, 0x02F80000LU, 0x02E00000LU, 0x02B80000LU, 0x02B00000LU, 0x02800000LU, 0x02C80000LU, 0x02D80000LU,
0x01A80000LU, 0x01C00000LU, 0x01880000LU, 0x01E80000LU, 0x01D00000LU, 0x01980000LU, 0x01A00000LU, 0x01900000LU,
0x01F00000LU, 0x01F80000LU, 0x01E00000LU, 0x01B80000LU, 0x01B00000LU, 0x01800000LU, 0x01C80000LU, 0x01D80000LU,
},
{ /* table 3 */
0x30000002LU, 0x60000002LU, 0x38000002LU, 0x08000002LU, 0x28000002LU, 0x78000002LU, 0x68000002LU, 0x40000002LU,
0x20000002LU, 0x50000002LU, 0x48000002LU, 0x70000002LU, 0x00000002LU, 0x18000002LU, 0x58000002LU, 0x10000002LU,
0xB0000005LU, 0xE0000005LU, 0xB8000005LU, 0x88000005LU, 0xA8000005LU, 0xF8000005LU, 0xE8000005LU, 0xC0000005LU,
0xA0000005LU, 0xD0000005LU, 0xC8000005LU, 0xF0000005LU, 0x80000005LU, 0x98000005LU, 0xD8000005LU, 0x90000005LU,
0x30000005LU, 0x60000005LU, 0x38000005LU, 0x08000005LU, 0x28000005LU, 0x78000005LU, 0x68000005LU, 0x40000005LU,
0x20000005LU, 0x50000005LU, 0x48000005LU, 0x70000005LU, 0x00000005LU, 0x18000005LU, 0x58000005LU, 0x10000005LU,
0x30000000LU, 0x60000000LU, 0x38000000LU, 0x08000000LU, 0x28000000LU, 0x78000000LU, 0x68000000LU, 0x40000000LU,
0x20000000LU, 0x50000000LU, 0x48000000LU, 0x70000000LU, 0x00000000LU, 0x18000000LU, 0x58000000LU, 0x10000000LU,
0xB0000003LU, 0xE0000003LU, 0xB8000003LU, 0x88000003LU, 0xA8000003LU, 0xF8000003LU, 0xE8000003LU, 0xC0000003LU,
0xA0000003LU, 0xD0000003LU, 0xC8000003LU, 0xF0000003LU, 0x80000003LU, 0x98000003LU, 0xD8000003LU, 0x90000003LU,
0x30000001LU, 0x60000001LU, 0x38000001LU, 0x08000001LU, 0x28000001LU, 0x78000001LU, 0x68000001LU, 0x40000001LU,
0x20000001LU, 0x50000001LU, 0x48000001LU, 0x70000001LU, 0x00000001LU, 0x18000001LU, 0x58000001LU, 0x10000001LU,
0xB0000000LU, 0xE0000000LU, 0xB8000000LU, 0x88000000LU, 0xA8000000LU, 0xF8000000LU, 0xE8000000LU, 0xC0000000LU,
0xA0000000LU, 0xD0000000LU, 0xC8000000LU, 0xF0000000LU, 0x80000000LU, 0x98000000LU, 0xD8000000LU, 0x90000000LU,
0xB0000006LU, 0xE0000006LU, 0xB8000006LU, 0x88000006LU, 0xA8000006LU, 0xF8000006LU, 0xE8000006LU, 0xC0000006LU,
0xA0000006LU, 0xD0000006LU, 0xC8000006LU, 0xF0000006LU, 0x80000006LU, 0x98000006LU, 0xD8000006LU, 0x90000006LU,
0xB0000001LU, 0xE0000001LU, 0xB8000001LU, 0x88000001LU, 0xA8000001LU, 0xF8000001LU, 0xE8000001LU, 0xC0000001LU,
0xA0000001LU, 0xD0000001LU, 0xC8000001LU, 0xF0000001LU, 0x80000001LU, 0x98000001LU, 0xD8000001LU, 0x90000001LU,
0x30000003LU, 0x60000003LU, 0x38000003LU, 0x08000003LU, 0x28000003LU, 0x78000003LU, 0x68000003LU, 0x40000003LU,
0x20000003LU, 0x50000003LU, 0x48000003LU, 0x70000003LU, 0x00000003LU, 0x18000003LU, 0x58000003LU, 0x10000003LU,
0x30000004LU, 0x60000004LU, 0x38000004LU, 0x08000004LU, 0x28000004LU, 0x78000004LU, 0x68000004LU, 0x40000004LU,
0x20000004LU, 0x50000004LU, 0x48000004LU, 0x70000004LU, 0x00000004LU, 0x18000004LU, 0x58000004LU, 0x10000004LU,
0xB0000002LU, 0xE0000002LU, 0xB8000002LU, 0x88000002LU, 0xA8000002LU, 0xF8000002LU, 0xE8000002LU, 0xC0000002LU,
0xA0000002LU, 0xD0000002LU, 0xC8000002LU, 0xF0000002LU, 0x80000002LU, 0x98000002LU, 0xD8000002LU, 0x90000002LU,
0xB0000004LU, 0xE0000004LU, 0xB8000004LU, 0x88000004LU, 0xA8000004LU, 0xF8000004LU, 0xE8000004LU, 0xC0000004LU,
0xA0000004LU, 0xD0000004LU, 0xC8000004LU, 0xF0000004LU, 0x80000004LU, 0x98000004LU, 0xD8000004LU, 0x90000004LU,
0x30000006LU, 0x60000006LU, 0x38000006LU, 0x08000006LU, 0x28000006LU, 0x78000006LU, 0x68000006LU, 0x40000006LU,
0x20000006LU, 0x50000006LU, 0x48000006LU, 0x70000006LU, 0x00000006LU, 0x18000006LU, 0x58000006LU, 0x10000006LU,
0xB0000007LU, 0xE0000007LU, 0xB8000007LU, 0x88000007LU, 0xA8000007LU, 0xF8000007LU, 0xE8000007LU, 0xC0000007LU,
0xA0000007LU, 0xD0000007LU, 0xC8000007LU, 0xF0000007LU, 0x80000007LU, 0x98000007LU, 0xD8000007LU, 0x90000007LU,
0x30000007LU, 0x60000007LU, 0x38000007LU, 0x08000007LU, 0x28000007LU, 0x78000007LU, 0x68000007LU, 0x40000007LU,
0x20000007LU, 0x50000007LU, 0x48000007LU, 0x70000007LU, 0x00000007LU, 0x18000007LU, 0x58000007LU, 0x10000007LU,
},
{ /* table 4 */
0x000000E8LU, 0x000000D8LU, 0x000000A0LU, 0x00000088LU, 0x00000098LU, 0x000000F8LU, 0x000000A8LU, 0x000000C8LU,
0x00000080LU, 0x000000D0LU, 0x000000F0LU, 0x000000B8LU, 0x000000B0LU, 0x000000C0LU, 0x00000090LU, 0x000000E0LU,
0x000007E8LU, 0x000007D8LU, 0x000007A0LU, 0x00000788LU, 0x00000798LU, 0x000007F8LU, 0x000007A8LU, 0x000007C8LU,
0x00000780LU, 0x000007D0LU, 0x000007F0LU, 0x000007B8LU, 0x000007B0LU, 0x000007C0LU, 0x00000790LU, 0x000007E0LU,
0x000006E8LU, 0x000006D8LU, 0x000006A0LU, 0x00000688LU, 0x00000698LU, 0x000006F8LU, 0x000006A8LU, 0x000006C8LU,
0x00000680LU, 0x000006D0LU, 0x000006F0LU, 0x000006B8LU, 0x000006B0LU, 0x000006C0LU, 0x00000690LU, 0x000006E0LU,
0x00000068LU, 0x00000058LU, 0x00000020LU, 0x00000008LU, 0x00000018LU, 0x00000078LU, 0x00000028LU, 0x00000048LU,
0x00000000LU, 0x00000050LU, 0x00000070LU, 0x00000038LU, 0x00000030LU, 0x00000040LU, 0x00000010LU, 0x00000060LU,
0x000002E8LU, 0x000002D8LU, 0x000002A0LU, 0x00000288LU, 0x00000298LU, 0x000002F8LU, 0x000002A8LU, 0x000002C8LU,
0x00000280LU, 0x000002D0LU, 0x000002F0LU, 0x000002B8LU, 0x000002B0LU, 0x000002C0LU, 0x00000290LU, 0x000002E0LU,
0x000003E8LU, 0x000003D8LU, 0x000003A0LU, 0x00000388LU, 0x00000398LU, 0x000003F8LU, 0x000003A8LU, 0x000003C8LU,
0x00000380LU, 0x000003D0LU, 0x000003F0LU, 0x000003B8LU, 0x000003B0LU, 0x000003C0LU, 0x00000390LU, 0x000003E0LU,
0x00000568LU, 0x00000558LU, 0x00000520LU, 0x00000508LU, 0x00000518LU, 0x00000578LU, 0x00000528LU, 0x00000548LU,
0x00000500LU, 0x00000550LU, 0x00000570LU, 0x00000538LU, 0x00000530LU, 0x00000540LU, 0x00000510LU, 0x00000560LU,
0x00000268LU, 0x00000258LU, 0x00000220LU, 0x00000208LU, 0x00000218LU, 0x00000278LU, 0x00000228LU, 0x00000248LU,
0x00000200LU, 0x00000250LU, 0x00000270LU, 0x00000238LU, 0x00000230LU, 0x00000240LU, 0x00000210LU, 0x00000260LU,
0x000004E8LU, 0x000004D8LU, 0x000004A0LU, 0x00000488LU, 0x00000498LU, 0x000004F8LU, 0x000004A8LU, 0x000004C8LU,
0x00000480LU, 0x000004D0LU, 0x000004F0LU, 0x000004B8LU, 0x000004B0LU, 0x000004C0LU, 0x00000490LU, 0x000004E0LU,
0x00000168LU, 0x00000158LU, 0x00000120LU, 0x00000108LU, 0x00000118LU, 0x00000178LU, 0x00000128LU, 0x00000148LU,
0x00000100LU, 0x00000150LU, 0x00000170LU, 0x00000138LU, 0x00000130LU, 0x00000140LU, 0x00000110LU, 0x00000160LU,
0x000001E8LU, 0x000001D8LU, 0x000001A0LU, 0x00000188LU, 0x00000198LU, 0x000001F8LU, 0x000001A8LU, 0x000001C8LU,
0x00000180LU, 0x000001D0LU, 0x000001F0LU, 0x000001B8LU, 0x000001B0LU, 0x000001C0LU, 0x00000190LU, 0x000001E0LU,
0x00000768LU, 0x00000758LU, 0x00000720LU, 0x00000708LU, 0x00000718LU, 0x00000778LU, 0x00000728LU, 0x00000748LU,
0x00000700LU, 0x00000750LU, 0x00000770LU, 0x00000738LU, 0x00000730LU, 0x00000740LU, 0x00000710LU, 0x00000760LU,
0x00000368LU, 0x00000358LU, 0x00000320LU, 0x00000308LU, 0x00000318LU, 0x00000378LU, 0x00000328LU, 0x00000348LU,
0x00000300LU, 0x00000350LU, 0x00000370LU, 0x00000338LU, 0x00000330LU, 0x00000340LU, 0x00000310LU, 0x00000360LU,
0x000005E8LU, 0x000005D8LU, 0x000005A0LU, 0x00000588LU, 0x00000598LU, 0x000005F8LU, 0x000005A8LU, 0x000005C8LU,
0x00000580LU, 0x000005D0LU, 0x000005F0LU, 0x000005B8LU, 0x000005B0LU, 0x000005C0LU, 0x00000590LU, 0x000005E0LU,
0x00000468LU, 0x00000458LU, 0x00000420LU, 0x00000408LU, 0x00000418LU, 0x00000478LU, 0x00000428LU, 0x00000448LU,
0x00000400LU, 0x00000450LU, 0x00000470LU, 0x00000438LU, 0x00000430LU, 0x00000440LU, 0x00000410LU, 0x00000460LU,
0x00000668LU, 0x00000658LU, 0x00000620LU, 0x00000608LU, 0x00000618LU, 0x00000678LU, 0x00000628LU, 0x00000648LU,
0x00000600LU, 0x00000650LU, 0x00000670LU, 0x00000638LU, 0x00000630LU, 0x00000640LU, 0x00000610LU, 0x00000660LU,
},
};
-59
View File
@@ -1,59 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2005 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Sara Golemon <pollita@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef PHP_HASH_HAVAL_H
#define PHP_HASH_HAVAL_H
#include "ext/standard/basic_functions.h"
/* HAVAL context. */
typedef struct {
php_hash_uint32 state[8];
php_hash_uint32 count[2];
unsigned char buffer[128];
char passes;
short output;
void (*Transform)(php_hash_uint32 state[8], const unsigned char block[128]);
} PHP_HAVAL_CTX;
#define PHP_HASH_HAVAL_INIT_DECL(p,b) PHP_HASH_API void PHP_##p##HAVAL##b##Init(PHP_HAVAL_CTX *); \
PHP_HASH_API void PHP_HAVAL##b##Final(unsigned char*, PHP_HAVAL_CTX *);
PHP_HASH_API void PHP_HAVALUpdate(PHP_HAVAL_CTX *, const unsigned char *, unsigned int);
PHP_HASH_HAVAL_INIT_DECL(3,128)
PHP_HASH_HAVAL_INIT_DECL(3,160)
PHP_HASH_HAVAL_INIT_DECL(3,192)
PHP_HASH_HAVAL_INIT_DECL(3,224)
PHP_HASH_HAVAL_INIT_DECL(3,256)
PHP_HASH_HAVAL_INIT_DECL(4,128)
PHP_HASH_HAVAL_INIT_DECL(4,160)
PHP_HASH_HAVAL_INIT_DECL(4,192)
PHP_HASH_HAVAL_INIT_DECL(4,224)
PHP_HASH_HAVAL_INIT_DECL(4,256)
PHP_HASH_HAVAL_INIT_DECL(5,128)
PHP_HASH_HAVAL_INIT_DECL(5,160)
PHP_HASH_HAVAL_INIT_DECL(5,192)
PHP_HASH_HAVAL_INIT_DECL(5,224)
PHP_HASH_HAVAL_INIT_DECL(5,256)
#endif
-88
View File
@@ -1,88 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2005 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Original Author: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
| Modified for pHASH by: Sara Golemon <pollita@php.net>
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef PHP_HASH_MD_H
#define PHP_HASH_MD_H
/* When SHA is removed from Core,
the ext/standard/sha1.c file can be removed
and the ext/standard/sha1.h file can be reduced to:
#define PHP_HASH_SHA1_NOT_IN_CORE
#include "ext/hash/php_hash_sha.h"
Don't forget to remove md5() and md5_file() entries from basic_functions.c
*/
#include "ext/standard/md5.h"
#ifdef PHP_HASH_MD5_NOT_IN_CORE
/* MD5.H - header file for MD5C.C
*/
/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
rights reserved.
License to copy and use this software is granted provided that it
is identified as the "RSA Data Security, Inc. MD5 Message-Digest
Algorithm" in all material mentioning or referencing this software
or this function.
License is also granted to make and use derivative works provided
that such works are identified as "derived from the RSA Data
Security, Inc. MD5 Message-Digest Algorithm" in all material
mentioning or referencing the derived work.
RSA Data Security, Inc. makes no representations concerning either
the merchantability of this software or the suitability of this
software for any particular purpose. It is provided "as is"
without express or implied warranty of any kind.
These notices must be retained in any copies of any part of this
documentation and/or software.
*/
/* MD5 context. */
typedef struct {
php_hash_uint32 state[4]; /* state (ABCD) */
php_hash_uint32 count[2]; /* number of bits, modulo 2^64 (lsb first) */
unsigned char buffer[64]; /* input buffer */
} PHP_MD5_CTX;
PHP_HASH_API void make_digest(char *md5str, unsigned char *digest);
PHP_HASH_API void PHP_MD5Init(PHP_MD5_CTX *);
PHP_HASH_API void PHP_MD5Update(PHP_MD5_CTX *, const unsigned char *, unsigned int);
PHP_HASH_API void PHP_MD5Final(unsigned char[16], PHP_MD5_CTX *);
PHP_NAMED_FUNCTION(php_if_md5);
PHP_NAMED_FUNCTION(php_if_md5_file);
#endif /* PHP_HASH_MD5_NOT_IN_CORE */
/* MD4 context */
typedef struct {
php_hash_uint32 state[4];
php_hash_uint32 count[2];
unsigned char buffer[64];
} PHP_MD4_CTX;
#define PHP_MD4Init PHP_MD5Init
PHP_HASH_API void PHP_MD4Update(PHP_MD4_CTX *context, const unsigned char *, unsigned int);
PHP_HASH_API void PHP_MD4Final(unsigned char[16], PHP_MD4_CTX *);
#endif
-46
View File
@@ -1,46 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2005 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Sara Golemon <pollita@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef PHP_HASH_RIPEMD_H
#define PHP_HASH_RIPEMD_H
#include "ext/standard/basic_functions.h"
/* RIPEMD context. */
typedef struct {
php_hash_uint32 state[4]; /* state (ABCD) */
php_hash_uint32 count[2]; /* number of bits, modulo 2^64 (lsb first) */
unsigned char buffer[64]; /* input buffer */
} PHP_RIPEMD128_CTX;
typedef struct {
php_hash_uint32 state[5]; /* state (ABCD) */
php_hash_uint32 count[2]; /* number of bits, modulo 2^64 (lsb first) */
unsigned char buffer[64]; /* input buffer */
} PHP_RIPEMD160_CTX;
PHP_HASH_API void PHP_RIPEMD128Init(PHP_RIPEMD128_CTX *);
PHP_HASH_API void PHP_RIPEMD128Update(PHP_RIPEMD128_CTX *, const unsigned char *, unsigned int);
PHP_HASH_API void PHP_RIPEMD128Final(unsigned char[16], PHP_RIPEMD128_CTX *);
PHP_HASH_API void PHP_RIPEMD160Init(PHP_RIPEMD160_CTX *);
PHP_HASH_API void PHP_RIPEMD160Update(PHP_RIPEMD160_CTX *, const unsigned char *, unsigned int);
PHP_HASH_API void PHP_RIPEMD160Final(unsigned char[20], PHP_RIPEMD160_CTX *);
#endif /* PHP_HASH_RIPEMD_H */
-51
View File
@@ -1,51 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2005 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Michael Wallner <mike@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef PHP_HASH_SALSA_H
#define PHP_HASH_SALSA_H
#include "ext/standard/basic_functions.h"
/* SALSA context */
typedef struct {
php_hash_uint32 state[16];
unsigned char init:1;
unsigned char length:7;
unsigned char buffer[64];
void (*Transform)(php_hash_uint32 state[16], php_hash_uint32 data[16]);
} PHP_SALSA_CTX;
#define PHP_SALSAInit PHP_SALSA20Init
PHP_HASH_API void PHP_SALSA10Init(PHP_SALSA_CTX *);
PHP_HASH_API void PHP_SALSA20Init(PHP_SALSA_CTX *);
PHP_HASH_API void PHP_SALSAUpdate(PHP_SALSA_CTX *, const unsigned char *, size_t);
PHP_HASH_API void PHP_SALSAFinal(unsigned char[64], PHP_SALSA_CTX *);
#endif
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: sw=4 ts=4 fdm=marker
* vim<600: sw=4 ts=4
*/
-86
View File
@@ -1,86 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2005 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| SHA1 Author: Stefan Esser <sesser@php.net> |
| SHA256 Author: Sara Golemon <pollita@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef PHP_HASH_SHA_H
#define PHP_HASH_SHA_H
/* When SHA is removed from Core,
the ext/standard/sha1.c file can be removed
and the ext/standard/sha1.h file can be reduced to:
#define PHP_HASH_SHA1_NOT_IN_CORE
#include "ext/hash/php_hash_sha.h"
Don't forget to remove sha1() and sha1_file() from basic_functions.c
*/
#include "ext/standard/sha1.h"
#include "ext/standard/basic_functions.h"
#ifdef PHP_HASH_SHA1_NOT_IN_CORE
/* SHA1 context. */
typedef struct {
php_hash_uint32 state[5]; /* state (ABCD) */
php_hash_uint32 count[2]; /* number of bits, modulo 2^64 */
unsigned char buffer[64]; /* input buffer */
} PHP_SHA1_CTX;
PHP_HASH_API void PHP_SHA1Init(PHP_SHA1_CTX *);
PHP_HASH_API void PHP_SHA1Update(PHP_SHA1_CTX *, const unsigned char *, unsigned int);
PHP_HASH_API void PHP_SHA1Final(unsigned char[20], PHP_SHA1_CTX *);
PHP_FUNCTION(sha1);
PHP_FUNCTION(sha1_file);
#endif /* PHP_HASH_SHA1_NOT_IN_CORE */
/* SHA256 context. */
typedef struct {
php_hash_uint32 state[8]; /* state */
php_hash_uint32 count[2]; /* number of bits, modulo 2^64 */
unsigned char buffer[64]; /* input buffer */
} PHP_SHA256_CTX;
PHP_HASH_API void PHP_SHA256Init(PHP_SHA256_CTX *);
PHP_HASH_API void PHP_SHA256Update(PHP_SHA256_CTX *, const unsigned char *, unsigned int);
PHP_HASH_API void PHP_SHA256Final(unsigned char[32], PHP_SHA256_CTX *);
/* SHA384 context */
typedef struct {
php_hash_uint64 state[8]; /* state */
php_hash_uint64 count[2]; /* number of bits, modulo 2^128 */
unsigned char buffer[128]; /* input buffer */
} PHP_SHA384_CTX;
PHP_HASH_API void PHP_SHA384Init(PHP_SHA384_CTX *);
PHP_HASH_API void PHP_SHA384Update(PHP_SHA384_CTX *, const unsigned char *, unsigned int);
PHP_HASH_API void PHP_SHA384Final(unsigned char[48], PHP_SHA384_CTX *);
/* SHA512 context */
typedef struct {
php_hash_uint64 state[8]; /* state */
php_hash_uint64 count[2]; /* number of bits, modulo 2^128 */
unsigned char buffer[128]; /* input buffer */
} PHP_SHA512_CTX;
PHP_HASH_API void PHP_SHA512Init(PHP_SHA512_CTX *);
PHP_HASH_API void PHP_SHA512Update(PHP_SHA512_CTX *, const unsigned char *, unsigned int);
PHP_HASH_API void PHP_SHA512Final(unsigned char[64], PHP_SHA512_CTX *);
#endif /* PHP_HASH_SHA_H */
-51
View File
@@ -1,51 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2005 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Michael Wallner <mike@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef PHP_HASH_SNEFRU_H
#define PHP_HASH_SNEFRU_H
/* SNEFRU-2.5a with 8 passes and 256 bit hash output
* AKA "Xerox Secure Hash Function"
*/
#include "ext/standard/basic_functions.h"
/* SNEFRU context */
typedef struct {
php_hash_uint32 state[16];
php_hash_uint32 count[2];
unsigned char length;
unsigned char buffer[32];
} PHP_SNEFRU_CTX;
PHP_HASH_API void PHP_SNEFRUInit(PHP_SNEFRU_CTX *);
PHP_HASH_API void PHP_SNEFRUUpdate(PHP_SNEFRU_CTX *, const unsigned char *, size_t);
PHP_HASH_API void PHP_SNEFRUFinal(unsigned char[32], PHP_SNEFRU_CTX *);
#endif
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: sw=4 ts=4 fdm=marker
* vim<600: sw=4 ts=4
*/
-942
View File
@@ -1,942 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2005 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Michael Wallner <mike@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
static const php_hash_uint32 tables[16][256]= {
{ /* Start of S Box 0 */
/* 0*/ 0x64f9001bL,0xfeddcdf6L,0x7c8ff1e2L,0x11d71514L,0x8b8c18d3L,
/* 5*/ 0xdddf881eL,0x6eab5056L,0x88ced8e1L,0x49148959L,0x69c56fd5L,
/* 10*/ 0xb7994f03L,0x0fbcee3eL,0x3c264940L,0x21557e58L,0xe14b3fc2L,
/* 15*/ 0x2e5cf591L,0xdceff8ceL,0x092a1648L,0xbe812936L,0xff7b0c6aL,
/* 20*/ 0xd5251037L,0xafa448f1L,0x7dafc95aL,0x1ea69c3fL,0xa417abe7L,
/* 25*/ 0x5890e423L,0xb0cb70c0L,0xc85025f7L,0x244d97e3L,0x1ff3595fL,
/* 30*/ 0xc4ec6396L,0x59181e17L,0xe635b477L,0x354e7dbfL,0x796f7753L,
/* 35*/ 0x66eb52ccL,0x77c3f995L,0x32e3a927L,0x80ccaed6L,0x4e2be89dL,
/* 40*/ 0x375bbd28L,0xad1a3d05L,0x2b1b42b3L,0x16c44c71L,0x4d54bfa8L,
/* 45*/ 0xe57ddc7aL,0xec6d8144L,0x5a71046bL,0xd8229650L,0x87fc8f24L,
/* 50*/ 0xcbc60e09L,0xb6390366L,0xd9f76092L,0xd393a70bL,0x1d31a08aL,
/* 55*/ 0x9cd971c9L,0x5c1ef445L,0x86fab694L,0xfdb44165L,0x8eaafcbeL,
/* 60*/ 0x4bcac6ebL,0xfb7a94e5L,0x5789d04eL,0xfa13cf35L,0x236b8da9L,
/* 65*/ 0x4133f000L,0x6224261cL,0xf412f23bL,0xe75e56a4L,0x30022116L,
/* 70*/ 0xbaf17f1fL,0xd09872f9L,0xc1a3699cL,0xf1e802aaL,0x0dd145dcL,
/* 75*/ 0x4fdce093L,0x8d8412f0L,0x6cd0f376L,0x3de6b73dL,0x84ba737fL,
/* 80*/ 0xb43a30f2L,0x44569f69L,0x00e4eacaL,0xb58de3b0L,0x959113c8L,
/* 85*/ 0xd62efee9L,0x90861f83L,0xced69874L,0x2f793ceeL,0xe8571c30L,
/* 90*/ 0x483665d1L,0xab07b031L,0x914c844fL,0x15bf3be8L,0x2c3f2a9aL,
/* 95*/ 0x9eb95fd4L,0x92e7472dL,0x2297cc5bL,0xee5f2782L,0x5377b562L,
/* 100*/ 0xdb8ebbcfL,0xf961deddL,0xc59b5c60L,0x1bd3910dL,0x26d206adL,
/* 105*/ 0xb28514d8L,0x5ecf6b52L,0x7fea78bbL,0x504879acL,0xed34a884L,
/* 110*/ 0x36e51d3cL,0x1753741dL,0x8c47caedL,0x9d0a40efL,0x3145e221L,
/* 115*/ 0xda27eb70L,0xdf730ba3L,0x183c8789L,0x739ac0a6L,0x9a58dfc6L,
/* 120*/ 0x54b134c1L,0xac3e242eL,0xcc493902L,0x7b2dda99L,0x8f15bc01L,
/* 125*/ 0x29fd38c7L,0x27d5318fL,0x604aaff5L,0xf29c6818L,0xc38aa2ecL,
/* 130*/ 0x1019d4c3L,0xa8fb936eL,0x20ed7b39L,0x0b686119L,0x89a0906fL,
/* 135*/ 0x1cc7829eL,0x9952ef4bL,0x850e9e8cL,0xcd063a90L,0x67002f8eL,
/* 140*/ 0xcfac8cb7L,0xeaa24b11L,0x988b4e6cL,0x46f066dfL,0xca7eec08L,
/* 145*/ 0xc7bba664L,0x831d17bdL,0x63f575e6L,0x9764350eL,0x47870d42L,
/* 150*/ 0x026ca4a2L,0x8167d587L,0x61b6adabL,0xaa6564d2L,0x70da237bL,
/* 155*/ 0x25e1c74aL,0xa1c901a0L,0x0eb0a5daL,0x7670f741L,0x51c05aeaL,
/* 160*/ 0x933dfa32L,0x0759ff1aL,0x56010ab8L,0x5fdecb78L,0x3f32edf8L,
/* 165*/ 0xaebedbb9L,0x39f8326dL,0xd20858c5L,0x9b638be4L,0xa572c80aL,
/* 170*/ 0x28e0a19fL,0x432099fcL,0x3a37c3cdL,0xbf95c585L,0xb392c12aL,
/* 175*/ 0x6aa707d7L,0x52f66a61L,0x12d483b1L,0x96435b5eL,0x3e75802bL,
/* 180*/ 0x3ba52b33L,0xa99f51a5L,0xbda1e157L,0x78c2e70cL,0xfcae7ce0L,
/* 185*/ 0xd1602267L,0x2affac4dL,0x4a510947L,0x0ab2b83aL,0x7a04e579L,
/* 190*/ 0x340dfd80L,0xb916e922L,0xe29d5e9bL,0xf5624af4L,0x4ca9d9afL,
/* 195*/ 0x6bbd2cfeL,0xe3b7f620L,0xc2746e07L,0x5b42b9b6L,0xa06919bcL,
/* 200*/ 0xf0f2c40fL,0x72217ab5L,0x14c19df3L,0xf3802daeL,0xe094beb4L,
/* 205*/ 0xa2101affL,0x0529575dL,0x55cdb27cL,0xa33bddb2L,0x6528b37dL,
/* 210*/ 0x740c05dbL,0xe96a62c4L,0x40782846L,0x6d30d706L,0xbbf48e2cL,
/* 215*/ 0xbce2d3deL,0x049e37faL,0x01b5e634L,0x2d886d8dL,0x7e5a2e7eL,
/* 220*/ 0xd7412013L,0x06e90f97L,0xe45d3ebaL,0xb8ad3386L,0x13051b25L,
/* 225*/ 0x0c035354L,0x71c89b75L,0xc638fbd0L,0x197f11a1L,0xef0f08fbL,
/* 230*/ 0xf8448651L,0x38409563L,0x452f4443L,0x5d464d55L,0x03d8764cL,
/* 235*/ 0xb1b8d638L,0xa70bba2fL,0x94b3d210L,0xeb6692a7L,0xd409c2d9L,
/* 240*/ 0x68838526L,0xa6db8a15L,0x751f6c98L,0xde769a88L,0xc9ee4668L,
/* 245*/ 0x1a82a373L,0x0896aa49L,0x42233681L,0xf62c55cbL,0x9f1c5404L,
/* 250*/ 0xf74fb15cL,0xc06e4312L,0x6ffe5d72L,0x8aa8678bL,0x337cd129L,
/* 255*/ 0x8211cefdL
/* End of S Box 0 */ },
{ /* Start of S Box 1 */
/* 0*/ 0x074a1d09L,0x52a10e5aL,0x9275a3f8L,0x4b82506cL,0x37df7e1bL,
/* 5*/ 0x4c78b3c5L,0xcefab1daL,0xf472267eL,0xb63045f6L,0xd66a1fc0L,
/* 10*/ 0x400298e3L,0x27e60c94L,0x87d2f1b8L,0xdf9e56ccL,0x45cd1803L,
/* 15*/ 0x1d35e098L,0xcce7c736L,0x03483bf1L,0x1f7307d7L,0xc6e8f948L,
/* 20*/ 0xe613c111L,0x3955c6ffL,0x1170ed7cL,0x8e95da41L,0x99c31bf4L,
/* 25*/ 0xa4da8021L,0x7b5f94fbL,0xdd0da51fL,0x6562aa77L,0x556bcb23L,
/* 30*/ 0xdb1bacc6L,0x798040b9L,0xbfe5378fL,0x731d55e6L,0xdaa5bfeeL,
/* 35*/ 0x389bbc60L,0x1b33fba4L,0x9c567204L,0x36c26c68L,0x77ee9d69L,
/* 40*/ 0x8aeb3e88L,0x2d50b5ceL,0x9579e790L,0x42b13cfcL,0x33fbd32bL,
/* 45*/ 0xee0503a7L,0xb5862824L,0x15e41eadL,0xc8412ef7L,0x9d441275L,
/* 50*/ 0x2fcec582L,0x5ff483b7L,0x8f3931dfL,0x2e5d2a7bL,0x49467bf9L,
/* 55*/ 0x0653dea9L,0x2684ce35L,0x7e655e5cL,0xf12771d8L,0xbb15cc67L,
/* 60*/ 0xab097ca1L,0x983dcf52L,0x10ddf026L,0x21267f57L,0x2c58f6b4L,
/* 65*/ 0x31043265L,0x0bab8c01L,0xd5492099L,0xacaae619L,0x944ce54aL,
/* 70*/ 0xf2d13d39L,0xadd3fc32L,0xcda08a40L,0xe2b0d451L,0x9efe08aeL,
/* 75*/ 0xb9d50fd2L,0xea5cd7fdL,0xc9a749ddL,0x13ea2253L,0x832debaaL,
/* 80*/ 0x24be640fL,0xe03e926aL,0x29e01cdeL,0x8bf59f18L,0x0f9d00b6L,
/* 85*/ 0xe1238b46L,0x1e7d8e34L,0x93619adbL,0x76b32f9fL,0xbd972cecL,
/* 90*/ 0xe31fa976L,0xa68fbb10L,0xfb3ba49dL,0x8587c41dL,0xa5add1d0L,
/* 95*/ 0xf3cf84bfL,0xd4e11150L,0xd9ffa6bcL,0xc3f6018cL,0xaef10572L,
/* 100*/ 0x74a64b2fL,0xe7dc9559L,0x2aae35d5L,0x5b6f587fL,0xa9e353feL,
/* 105*/ 0xca4fb674L,0x04ba24a8L,0xe5c6875fL,0xdcbc6266L,0x6bc5c03fL,
/* 110*/ 0x661eef02L,0xed740babL,0x058e34e4L,0xb7e946cfL,0x88698125L,
/* 115*/ 0x72ec48edL,0xb11073a3L,0xa13485ebL,0xa2a2429cL,0xfa407547L,
/* 120*/ 0x50b76713L,0x5418c37dL,0x96192da5L,0x170bb04bL,0x518a021eL,
/* 125*/ 0xb0ac13d1L,0x0963fa2aL,0x4a6e10e1L,0x58472bdcL,0xf7f8d962L,
/* 130*/ 0x979139eaL,0x8d856538L,0xc0997042L,0x48324d7aL,0x447623cbL,
/* 135*/ 0x8cbbe364L,0x6e0c6b0eL,0xd36d63b0L,0x3f244c84L,0x3542c971L,
/* 140*/ 0x2b228dc1L,0xcb0325bbL,0xf8c0d6e9L,0xde11066bL,0xa8649327L,
/* 145*/ 0xfc31f83eL,0x7dd80406L,0xf916dd61L,0xd89f79d3L,0x615144c2L,
/* 150*/ 0xebb45d31L,0x28002958L,0x56890a37L,0xf05b3808L,0x123ae844L,
/* 155*/ 0x86839e16L,0x914b0d83L,0xc506b43cL,0xcf3cba5eL,0x7c60f5c9L,
/* 160*/ 0x22deb2a0L,0x5d9c2715L,0xc77ba0efL,0x4f45360bL,0xc1017d8bL,
/* 165*/ 0xe45adc29L,0xa759909bL,0x412cd293L,0xd7d796b1L,0x00c8ff30L,
/* 170*/ 0x23a34a80L,0x4ec15c91L,0x714e78b5L,0x47b9e42eL,0x78f3ea4dL,
/* 175*/ 0x7f078f5bL,0x346c593aL,0xa3a87a1aL,0x9bcbfe12L,0x3d439963L,
/* 180*/ 0xb2ef6d8eL,0xb8d46028L,0x6c2fd5caL,0x62675256L,0x01f2a2f3L,
/* 185*/ 0xbc96ae0aL,0x709a8920L,0xb4146e87L,0x6308b9e2L,0x64bda7baL,
/* 190*/ 0xafed6892L,0x6037f2a2L,0xf52969e0L,0x0adb43a6L,0x82811400L,
/* 195*/ 0x90d0bdf0L,0x19c9549eL,0x203f6a73L,0x1accaf4fL,0x89714e6dL,
/* 200*/ 0x164d4705L,0x67665f07L,0xec206170L,0x0c2182b2L,0xa02b9c81L,
/* 205*/ 0x53289722L,0xf6a97686L,0x140e4179L,0x9f778849L,0x9a88e15dL,
/* 210*/ 0x25cadb54L,0xd157f36fL,0x32a421c3L,0xb368e98aL,0x5a92cd0dL,
/* 215*/ 0x757aa8d4L,0xc20ac278L,0x08b551c7L,0x849491e8L,0x4dc75ad6L,
/* 220*/ 0x697c33beL,0xbaf0ca33L,0x46125b4eL,0x59d677b3L,0x30d9c8f2L,
/* 225*/ 0xd0af860cL,0x1c7fd0faL,0xfe0ff72cL,0x5c8d6f43L,0x57fdec3bL,
/* 230*/ 0x6ab6ad97L,0xd22adf89L,0x18171785L,0x02bfe22dL,0x6db80917L,
/* 235*/ 0x80b216afL,0xe85e4f9aL,0x7a1c306eL,0x6fc49bf5L,0x3af7a11cL,
/* 240*/ 0x81e215e7L,0x68363fcdL,0x3e9357c8L,0xef52fd55L,0x3b8bab4cL,
/* 245*/ 0x3c8cf495L,0xbefceebdL,0xfd25b714L,0xc498d83dL,0x0d2e1a8dL,
/* 250*/ 0xe9f966acL,0x0e387445L,0x435419e5L,0x5e7ebec4L,0xaa90b8d9L,
/* 255*/ 0xff1a3a96L
/* End of S Box 1 */ },
{ /* Start of S Box 2 */
/* 0*/ 0x4a8fe4e3L,0xf27d99cdL,0xd04a40caL,0xcb5ff194L,0x3668275aL,
/* 5*/ 0xff4816beL,0xa78b394cL,0x4c6be9dbL,0x4eec38d2L,0x4296ec80L,
/* 10*/ 0xcdce96f8L,0x888c2f38L,0xe75508f5L,0x7b916414L,0x060aa14aL,
/* 15*/ 0xa214f327L,0xbe608dafL,0x1ebbdec2L,0x61f98ce9L,0xe92156feL,
/* 20*/ 0x4f22d7a3L,0x3f76a8d9L,0x559a4b33L,0x38ad2959L,0xf3f17e9eL,
/* 25*/ 0x85e1ba91L,0xe5eba6fbL,0x73dcd48cL,0xf5c3ff78L,0x481b6058L,
/* 30*/ 0x8a3297f7L,0x8f1f3bf4L,0x93785ab2L,0x477a4a5bL,0x6334eb5dL,
/* 35*/ 0x6d251b2eL,0x74a9102dL,0x07e38ffaL,0x915c9c62L,0xccc275eaL,
/* 40*/ 0x6be273ecL,0x3ebddd70L,0xd895796cL,0xdc54a91bL,0xc9afdf81L,
/* 45*/ 0x23633f73L,0x275119b4L,0xb19f6b67L,0x50756e22L,0x2bb152e2L,
/* 50*/ 0x76ea46a2L,0xa353e232L,0x2f596ad6L,0x0b1edb0bL,0x02d3d9a4L,
/* 55*/ 0x78b47843L,0x64893e90L,0x40f0caadL,0xf68d3ad7L,0x46fd1707L,
/* 60*/ 0x1c9c67efL,0xb5e086deL,0x96ee6ca6L,0x9aa34774L,0x1ba4f48aL,
/* 65*/ 0x8d01abfdL,0x183ee1f6L,0x5ff8aa7aL,0x17e4faaeL,0x303983b0L,
/* 70*/ 0x6c08668bL,0xd4ac4382L,0xe6c5849fL,0x92fefb53L,0xc1cac4ceL,
/* 75*/ 0x43501388L,0x441118cfL,0xec4fb308L,0x53a08e86L,0x9e0fe0c5L,
/* 80*/ 0xf91c1525L,0xac45be05L,0xd7987cb5L,0x49ba1487L,0x57938940L,
/* 85*/ 0xd5877648L,0xa958727fL,0x58dfe3c3L,0xf436cf77L,0x399e4d11L,
/* 90*/ 0xf0a5bfa9L,0xef61a33bL,0xa64cac60L,0x04a8d0baL,0x030dd572L,
/* 95*/ 0xb83d320fL,0xcab23045L,0xe366f2f0L,0x815d008dL,0xc897a43aL,
/* 100*/ 0x1d352df3L,0xb9cc571dL,0x8bf38744L,0x72209092L,0xeba124ebL,
/* 105*/ 0xfb99ce5eL,0x3bb94293L,0x28da549cL,0xaab8a228L,0xa4197785L,
/* 110*/ 0x33c70296L,0x25f6259bL,0x5c85da21L,0xdf15bdeeL,0x15b7c7e8L,
/* 115*/ 0xe2abef75L,0xfcc19bc1L,0x417ff868L,0x14884434L,0x62825179L,
/* 120*/ 0xc6d5c11cL,0x0e4705dcL,0x22700de0L,0xd3d2af18L,0x9be822a0L,
/* 125*/ 0x35b669f1L,0xc42bb55cL,0x0a801252L,0x115bf0fcL,0x3cd7d856L,
/* 130*/ 0xb43f5f9dL,0xc2306516L,0xa1231c47L,0xf149207eL,0x5209a795L,
/* 135*/ 0x34b3ccd8L,0x67aefe54L,0x2c83924eL,0x6662cbacL,0x5eedd161L,
/* 140*/ 0x84e681aaL,0x5d57d26bL,0xfa465cc4L,0x7e3ac3a8L,0xbf7c0cc6L,
/* 145*/ 0xe18a9aa1L,0xc32f0a6fL,0xb22cc00dL,0x3d280369L,0x994e554fL,
/* 150*/ 0x68f480d3L,0xadcff5e6L,0x3a8eb265L,0x83269831L,0xbd568a09L,
/* 155*/ 0x4bc8ae6aL,0x69f56d2bL,0x0f17eac8L,0x772eb6c7L,0x9f41343cL,
/* 160*/ 0xab1d0742L,0x826a6f50L,0xfea2097cL,0x1912c283L,0xce185899L,
/* 165*/ 0xe4444839L,0x2d8635d5L,0x65d0b1ffL,0x865a7f17L,0x326d9fb1L,
/* 170*/ 0x59e52820L,0x0090ade1L,0x753c7149L,0x9ddd8b98L,0xa5a691daL,
/* 175*/ 0x0d0382bbL,0x8904c930L,0x086cb000L,0x6e69d3bdL,0x24d4e7a7L,
/* 180*/ 0x05244fd0L,0x101a5e0cL,0x6a947dcbL,0xe840f77bL,0x7d0c5003L,
/* 185*/ 0x7c370f1fL,0x805245edL,0xe05e3d3fL,0x7906880eL,0xbabfcd35L,
/* 190*/ 0x1a7ec697L,0x8c052324L,0x0c6ec8dfL,0xd129a589L,0xc7a75b02L,
/* 195*/ 0x12d81de7L,0xd9be2a66L,0x1f4263abL,0xde73fdb6L,0x2a00680aL,
/* 200*/ 0x56649e36L,0x3133ed55L,0x90fa0bf2L,0x2910a02aL,0x949d9d46L,
/* 205*/ 0xa0d1dcddL,0xcfc9b7d4L,0xd2677be5L,0x95cb36b3L,0x13cd9410L,
/* 210*/ 0xdbf73313L,0xb7c6e8c0L,0xf781414bL,0x510b016dL,0xb0de1157L,
/* 215*/ 0xd6b0f62cL,0xbb074eccL,0x7f1395b7L,0xee792cf9L,0xea6fd63eL,
/* 220*/ 0x5bd6938eL,0xaf02fc64L,0xdab57ab8L,0x8edb3784L,0x8716318fL,
/* 225*/ 0x164d1a01L,0x26f26141L,0xb372e6b9L,0xf8fc2b06L,0x7ac00e04L,
/* 230*/ 0x3727b89aL,0x97e9bca5L,0x9c2a742fL,0xbc3b1f7dL,0x7165b471L,
/* 235*/ 0x609b4c29L,0x20925351L,0x5ae72112L,0x454be5d1L,0xc0ffb95fL,
/* 240*/ 0xdd0ef919L,0x6f2d70c9L,0x0974c5bfL,0x98aa6263L,0x01d91e4dL,
/* 245*/ 0x2184bb6eL,0x70c43c1eL,0x4d435915L,0xae7b8523L,0xb6fb06bcL,
/* 250*/ 0x5431ee76L,0xfdbc5d26L,0xed77493dL,0xc5712ee4L,0xa8380437L,
/* 255*/ 0x2eef261aL
/* End of S Box 2 */ },
{ /* Start of S Box 3 */
/* 0*/ 0x5a79392bL,0xb8af32c2L,0x41f7720aL,0x833a61ecL,0x13dfedacL,
/* 5*/ 0xc4990bc4L,0xdc0f54bcL,0xfedd5e88L,0x80da1881L,0x4dea1afdL,
/* 10*/ 0xfd402cc6L,0xae67cc7aL,0xc5238525L,0x8ea01254L,0xb56b9bd5L,
/* 15*/ 0x862fbd6dL,0xac8575d3L,0x6fba3714L,0xda7ebf46L,0x59cd5238L,
/* 20*/ 0x8ac9dbfeL,0x353729fcL,0xe497d7f2L,0xc3ab84e0L,0xf05a114bL,
/* 25*/ 0x7b887a75L,0xedc603ddL,0x5e6fe680L,0x2c84b399L,0x884eb1daL,
/* 30*/ 0x1cb8c8bfL,0xaa51098aL,0xc862231cL,0x8bac2221L,0x21b387e5L,
/* 35*/ 0x208a430dL,0x2a3f0f8bL,0xa5ff9cd2L,0x6012a2eaL,0x147a9ee7L,
/* 40*/ 0xf62a501dL,0xb4b2e51aL,0x3ef3484cL,0xc0253c59L,0x2b82b536L,
/* 45*/ 0x0aa9696bL,0xbe0c109bL,0xc70b7929L,0xce3e8a19L,0x2f66950eL,
/* 50*/ 0x459f1c2cL,0xe68fb93dL,0xa3c3ff3eL,0x62b45c62L,0x300991cbL,
/* 55*/ 0x01914c57L,0x7f7bc06aL,0x182831f5L,0xe7b74bcaL,0xfa50f6d0L,
/* 60*/ 0x523caa61L,0xe3a7cf05L,0xe9e41311L,0x280a21d1L,0x6a4297e1L,
/* 65*/ 0xf24dc67eL,0xfc3189e6L,0xb72bf34fL,0x4b1e67afL,0x543402ceL,
/* 70*/ 0x79a59867L,0x0648e02aL,0x00a3ac17L,0xc6208d35L,0x6e7f5f76L,
/* 75*/ 0xa45bb4beL,0xf168fa63L,0x3f4125f3L,0xf311406fL,0x02706565L,
/* 80*/ 0xbfe58022L,0x0cfcfdd9L,0x0735a7f7L,0x8f049092L,0xd98edc27L,
/* 85*/ 0xf5c5d55cL,0xe0f201dbL,0x0dcafc9aL,0x7727fb79L,0xaf43abf4L,
/* 90*/ 0x26e938c1L,0x401b26a6L,0x900720faL,0x2752d97bL,0xcff1d1b3L,
/* 95*/ 0xa9d9e424L,0x42db99abL,0x6cf8be5fL,0xe82cebe3L,0x3afb733bL,
/* 100*/ 0x6b734eb6L,0x1036414aL,0x975f667cL,0x049d6377L,0xba587c60L,
/* 105*/ 0xb1d10483L,0xde1aefccL,0x1129d055L,0x72051e91L,0x6946d623L,
/* 110*/ 0xf9e86ea7L,0x48768c00L,0xb0166c93L,0x9956bbf0L,0x1f1f6d84L,
/* 115*/ 0xfb15e18eL,0x033b495dL,0x56e3362eL,0x4f44c53cL,0x747cba51L,
/* 120*/ 0x89d37872L,0x5d9c331bL,0xd2ef9fa8L,0x254917f8L,0x1b106f47L,
/* 125*/ 0x37d75553L,0xb3f053b0L,0x7dccd8efL,0xd30eb802L,0x5889f42dL,
/* 130*/ 0x610206d7L,0x1a7d34a1L,0x92d87dd8L,0xe5f4a315L,0xd1cf0e71L,
/* 135*/ 0xb22dfe45L,0xb901e8ebL,0x0fc0ce5eL,0x2efa60c9L,0x2de74290L,
/* 140*/ 0x36d0c906L,0x381c70e4L,0x4c6da5b5L,0x3d81a682L,0x7e381f34L,
/* 145*/ 0x396c4f52L,0x95ad5901L,0x1db50c5aL,0x29982e9eL,0x1557689fL,
/* 150*/ 0x3471ee42L,0xd7e2f7c0L,0x8795a1e2L,0xbc324d8dL,0xe224c3c8L,
/* 155*/ 0x12837e39L,0xcdee3d74L,0x7ad2143fL,0x0e13d40cL,0x78bd4a68L,
/* 160*/ 0xa2eb194dL,0xdb9451f9L,0x859b71dcL,0x5c4f5b89L,0xca14a8a4L,
/* 165*/ 0xef92f003L,0x16741d98L,0x33aa4444L,0x9e967fbbL,0x092e3020L,
/* 170*/ 0xd86a35b8L,0x8cc17b10L,0xe1bf08aeL,0x55693fc5L,0x7680ad13L,
/* 175*/ 0x1e6546e8L,0x23b6e7b9L,0xee77a4b2L,0x08ed0533L,0x44fd2895L,
/* 180*/ 0xb6393b69L,0x05d6cacfL,0x9819b209L,0xecbbb72fL,0x9a75779cL,
/* 185*/ 0xeaec0749L,0x94a65aeeL,0xbdf52dc3L,0xd6a25d04L,0x82008e4eL,
/* 190*/ 0xa6de160fL,0x9b036afbL,0x228b3a66L,0x5fb10a70L,0xcc338b58L,
/* 195*/ 0x5378a9dfL,0xc908bca9L,0x4959e25bL,0x46909a97L,0x66ae8f6eL,
/* 200*/ 0xdd0683e9L,0x65f994b4L,0x6426cda5L,0xc24b8840L,0x32539da0L,
/* 205*/ 0x63175650L,0xd0c815ffL,0x50cbc41eL,0xf7c774a3L,0x31b0c231L,
/* 210*/ 0x8d0d8116L,0x24bef16cL,0xd555d256L,0xdf47ea8cL,0x6d21eccdL,
/* 215*/ 0xa887a012L,0x84542aedL,0xa7b9c1bdL,0x914c1bb1L,0xa0d5b67dL,
/* 220*/ 0x438ce937L,0x7030f873L,0x71f6b0c7L,0x574576baL,0xf8bc4541L,
/* 225*/ 0x9c61d348L,0x1960579dL,0x17c4daadL,0x96a4cb0bL,0xc193f2f6L,
/* 230*/ 0x756eafa2L,0x7c1d2f94L,0xf4fe2b43L,0xcb86e33aL,0xebd4c728L,
/* 235*/ 0x9d18ae64L,0x9fe13e30L,0x3ce0f5deL,0xaba1f985L,0xaddc2718L,
/* 240*/ 0x68ce6278L,0xd45e241fL,0xa15c82b7L,0x3b2293d4L,0x739edd32L,
/* 245*/ 0x674a6bf1L,0x5b5d587fL,0x4772deaaL,0x4a63968fL,0x0be68686L,
/* 250*/ 0x513d6426L,0x939a4787L,0xbba89296L,0x4ec20007L,0x818d0d08L,
/* 255*/ 0xff64dfd6L
/* End of S Box 3 */ },
{ /* Start of S Box 4 */
/* 0*/ 0xcb2297cbL,0xdb48a144L,0xa16cbe4bL,0xbbea1d6cL,0x5af6b6b7L,
/* 5*/ 0x8a8110b6L,0xf9236ef9L,0xc98f83e6L,0x0f9c65b8L,0x252d4a89L,
/* 10*/ 0xa497f068L,0xa5d7ed2dL,0x94c22845L,0x9da1c8c4L,0xe27c2e2eL,
/* 15*/ 0x6e8ba2b4L,0xc3dd17fbL,0x498cd482L,0x0dfe6a9fL,0xb0705829L,
/* 20*/ 0x9a1e6dc1L,0xf829717cL,0x07bb8e3aL,0xda3c0b02L,0x1af82fc7L,
/* 25*/ 0x73b70955L,0x7a04379cL,0x5ee20a28L,0x83712ae5L,0xf4c47c6dL,
/* 30*/ 0xdf72ba56L,0xd794858dL,0x8c0cf709L,0x18f0f390L,0xb6c69b35L,
/* 35*/ 0xbf2f01dbL,0x2fa74dcaL,0xd0cd9127L,0xbde66cecL,0x3deebd46L,
/* 40*/ 0x57c88fc3L,0xcee1406fL,0x0066385aL,0xf3c3444fL,0x3a79d5d5L,
/* 45*/ 0x75751eb9L,0x3e7f8185L,0x521c2605L,0xe1aaab6eL,0x38ebb80fL,
/* 50*/ 0xbee7e904L,0x61cb9647L,0xea54904eL,0x05ae00e4L,0x2d7ac65fL,
/* 55*/ 0x087751a1L,0xdcd82915L,0x0921ee16L,0xdd86d33bL,0xd6bd491aL,
/* 60*/ 0x40fbadf0L,0x4232cbd2L,0x33808d10L,0x39098c42L,0x193f3199L,
/* 65*/ 0x0bc1e47aL,0x4a82b149L,0x02b65a8aL,0x104cdc8eL,0x24a8f52cL,
/* 70*/ 0x685c6077L,0xc79f95c9L,0x1d11fe50L,0xc08dafcdL,0x7b1a9a03L,
/* 75*/ 0x1c1f11d8L,0x84250e7fL,0x979db248L,0xebdc0501L,0xb9553395L,
/* 80*/ 0xe3c05ea8L,0xb1e51c4cL,0x13b0e681L,0x3b407766L,0x36db3087L,
/* 85*/ 0xee17c9fcL,0x6c53ecf2L,0xadccc58fL,0xc427660bL,0xefd5867dL,
/* 90*/ 0x9b6d54a5L,0x6ff1aeffL,0x8e787952L,0x9e2bffe0L,0x8761d034L,
/* 95*/ 0xe00bdbadL,0xae99a8d3L,0xcc03f6e2L,0xfd0ed807L,0x0e508ae3L,
/* 100*/ 0xb74182abL,0x4349245dL,0xd120a465L,0xb246a641L,0xaf3b7ab0L,
/* 105*/ 0x2a6488bbL,0x4b3a0d1fL,0xe7c7e58cL,0x3faff2ebL,0x90445ffdL,
/* 110*/ 0xcf38c393L,0x995d07e7L,0xf24f1b36L,0x356f6891L,0x6d6ebcbeL,
/* 115*/ 0x8da9e262L,0x50fd520eL,0x5bca9e1eL,0x37472cf3L,0x69075057L,
/* 120*/ 0x7ec5fdedL,0x0cab892aL,0xfb2412baL,0x1728debfL,0xa000a988L,
/* 125*/ 0xd843ce79L,0x042e20ddL,0x4fe8f853L,0x56659c3cL,0x2739d119L,
/* 130*/ 0xa78a6120L,0x80960375L,0x70420611L,0x85e09f78L,0xabd17e96L,
/* 135*/ 0x1b513eafL,0x1e01eb63L,0x26ad2133L,0xa890c094L,0x7613cf60L,
/* 140*/ 0x817e781bL,0xa39113d7L,0xe957fa58L,0x4131b99eL,0x28b1efdaL,
/* 145*/ 0x66acfba7L,0xff68944aL,0x77a44fd1L,0x7f331522L,0x59ffb3faL,
/* 150*/ 0xa6df935bL,0xfa12d9dfL,0xc6bf6f3fL,0x89520cf6L,0x659edd6aL,
/* 155*/ 0x544da739L,0x8b052538L,0x7c30ea21L,0xc2345525L,0x15927fb2L,
/* 160*/ 0x144a436bL,0xba107b8bL,0x1219ac97L,0x06730432L,0x31831ab3L,
/* 165*/ 0xc55a5c24L,0xaa0fcd3eL,0xe5606be8L,0x5c88f19bL,0x4c0841eeL,
/* 170*/ 0x1fe37267L,0x11f9c4f4L,0x9f1b9daeL,0x864e76d0L,0xe637c731L,
/* 175*/ 0xd97d23a6L,0x32f53d5cL,0xb8161980L,0x93fa0f84L,0xcaef0870L,
/* 180*/ 0x8874487eL,0x98f2cc73L,0x645fb5c6L,0xcd853659L,0x2062470dL,
/* 185*/ 0x16ede8e9L,0x6b06dab5L,0x78b43900L,0xfc95b786L,0x5d8e7de1L,
/* 190*/ 0x465b5954L,0xfe7ba014L,0xf7d23f7bL,0x92bc8b18L,0x03593592L,
/* 195*/ 0x55cef4f7L,0x74b27317L,0x79de1fc2L,0xc8a0bfbdL,0x229398ccL,
/* 200*/ 0x62a602ceL,0xbcb94661L,0x5336d206L,0xd2a375feL,0x6a6ab483L,
/* 205*/ 0x4702a5a4L,0xa2e9d73dL,0x23a2e0f1L,0x9189140aL,0x581d18dcL,
/* 210*/ 0xb39a922bL,0x82356212L,0xd5f432a9L,0xd356c2a3L,0x5f765b4dL,
/* 215*/ 0x450afcc8L,0x4415e137L,0xe8ecdfbcL,0xed0de3eaL,0x60d42b13L,
/* 220*/ 0xf13df971L,0x71fc5da2L,0xc1455340L,0xf087742fL,0xf55e5751L,
/* 225*/ 0x67b3c1f8L,0xac6b8774L,0x7dcfaaacL,0x95983bc0L,0x489bb0b1L,
/* 230*/ 0x2c184223L,0x964b6726L,0x2bd3271cL,0x72266472L,0xded64530L,
/* 235*/ 0x0a2aa343L,0xd4f716a0L,0xb4dad6d9L,0x2184345eL,0x512c990cL,
/* 240*/ 0x29d92d08L,0x2ebe709aL,0x01144c69L,0x34584b9dL,0xe4634ed6L,
/* 245*/ 0xecc963cfL,0x3c6984aaL,0x4ed056efL,0x9ca56976L,0x8f3e80d4L,
/* 250*/ 0xb5bae7c5L,0x30b5caf5L,0x63f33a64L,0xa9e4bbdeL,0xf6b82298L,
/* 255*/ 0x4d673c1dL
/* End of S Box 4 */ },
{ /* Start of S Box 5 */
/* 0*/ 0x4b4f1121L,0xba183081L,0xc784f41fL,0xd17d0bacL,0x083d2267L,
/* 5*/ 0x37b1361eL,0x3581ad05L,0xfda2f6bcL,0x1e892cddL,0xb56d3c3aL,
/* 10*/ 0x32140e46L,0x138d8aabL,0xe14773d4L,0x5b0e71dfL,0x5d1fe055L,
/* 15*/ 0x3fb991d3L,0xf1f46c71L,0xa325988cL,0x10f66e80L,0xb1006348L,
/* 20*/ 0x726a9f60L,0x3b67f8baL,0x4e114ef4L,0x05c52115L,0x4c5ca11cL,
/* 25*/ 0x99e1efd8L,0x471b83b3L,0xcbf7e524L,0x43ad82f5L,0x690ca93bL,
/* 30*/ 0xfaa61bb2L,0x12a832b5L,0xb734f943L,0xbd22aea7L,0x88fec626L,
/* 35*/ 0x5e80c3e7L,0xbe3eaf5eL,0x44617652L,0xa5724475L,0xbb3b9695L,
/* 40*/ 0x7f3fee8fL,0x964e7debL,0x518c052dL,0x2a0bbc2bL,0xc2175f5cL,
/* 45*/ 0x9a7b3889L,0xa70d8d0cL,0xeaccdd29L,0xcccd6658L,0x34bb25e6L,
/* 50*/ 0xb8391090L,0xf651356fL,0x52987c9eL,0x0c16c1cdL,0x8e372d3cL,
/* 55*/ 0x2fc6ebbdL,0x6e5da3e3L,0xb0e27239L,0x5f685738L,0x45411786L,
/* 60*/ 0x067f65f8L,0x61778b40L,0x81ab2e65L,0x14c8f0f9L,0xa6b7b4ceL,
/* 65*/ 0x4036eaecL,0xbf62b00aL,0xecfd5e02L,0x045449a6L,0xb20afd28L,
/* 70*/ 0x2166d273L,0x0d13a863L,0x89508756L,0xd51a7530L,0x2d653f7aL,
/* 75*/ 0x3cdbdbc3L,0x80c9df4fL,0x3d5812d9L,0x53fbb1f3L,0xc0f185c0L,
/* 80*/ 0x7a3c3d7eL,0x68646410L,0x857607a0L,0x1d12622eL,0x97f33466L,
/* 85*/ 0xdb4c9917L,0x6469607cL,0x566e043dL,0x79ef1edbL,0x2c05898dL,
/* 90*/ 0xc9578e25L,0xcd380101L,0x46e04377L,0x7d1cc7a9L,0x6552b837L,
/* 95*/ 0x20192608L,0xb97500c5L,0xed296b44L,0x368648b4L,0x62995cd5L,
/* 100*/ 0x82731400L,0xf9aebd8bL,0x3844c0c7L,0x7c2de794L,0x33a1a770L,
/* 105*/ 0x8ae528c2L,0x5a2be812L,0x1f8f4a07L,0x2b5ed7caL,0x937eb564L,
/* 110*/ 0x6fda7e11L,0xe49b5d6cL,0xb4b3244eL,0x18aa53a4L,0x3a061334L,
/* 115*/ 0x4d6067a3L,0x83ba5868L,0x9bdf4dfeL,0x7449f261L,0x709f8450L,
/* 120*/ 0xcad133cbL,0xde941c3fL,0xf52ae484L,0x781d77edL,0x7e4395f0L,
/* 125*/ 0xae103b59L,0x922331bbL,0x42ce50c8L,0xe6f08153L,0xe7d941d0L,
/* 130*/ 0x5028ed6bL,0xb3d2c49bL,0xad4d9c3eL,0xd201fb6eL,0xa45bd5beL,
/* 135*/ 0xffcb7f4bL,0x579d7806L,0xf821bb5bL,0x59d592adL,0xd0be0c31L,
/* 140*/ 0xd4e3b676L,0x0107165aL,0x0fe939d2L,0x49bcaafdL,0x55ffcfe5L,
/* 145*/ 0x2ec1f783L,0xf39a09a5L,0x3eb42772L,0x19b55a5dL,0x024a0679L,
/* 150*/ 0x8c83b3f7L,0x8642ba1dL,0xacacd9eaL,0x87d352c4L,0x60931f45L,
/* 155*/ 0xa05f97d7L,0x1cecd42cL,0xe2fcc87bL,0xb60f94e2L,0x67a34b0bL,
/* 160*/ 0xfcdd40c9L,0x0b150a27L,0xd3ee9e04L,0x582e29e9L,0x4ac22b41L,
/* 165*/ 0x6ac4e1b8L,0xbccaa51aL,0x237af30eL,0xebc3b709L,0xc4a59d19L,
/* 170*/ 0x284bc98aL,0xe9d41a93L,0x6bfa2018L,0x73b2d651L,0x11f9a2faL,
/* 175*/ 0xce09bff1L,0x41a470aaL,0x25888f22L,0x77e754e8L,0xf7330d8eL,
/* 180*/ 0x158eab16L,0xc5d68842L,0xc685a6f6L,0xe5b82fdeL,0x09ea3a96L,
/* 185*/ 0x6dde1536L,0x4fa919daL,0x26c0be9fL,0x9eed6f69L,0xf05555f2L,
/* 190*/ 0xe06fc285L,0x9cd76d23L,0xaf452a92L,0xefc74cb7L,0x9d6b4732L,
/* 195*/ 0x8be408eeL,0x22401d0dL,0xee6c459dL,0x7587cb82L,0xe8746862L,
/* 200*/ 0x5cbdde87L,0x98794278L,0x31afb94dL,0xc11e0f2fL,0x30e8fc2aL,
/* 205*/ 0xcf3261efL,0x1a3023e1L,0xaa2f86cfL,0xf202e24aL,0x8d08dcffL,
/* 210*/ 0x764837c6L,0xa26374ccL,0x9f7c3e88L,0x949cc57dL,0xdd26a07fL,
/* 215*/ 0xc39efab0L,0xc8f879a1L,0xdce67bb9L,0xf4b0a435L,0x912c9ae0L,
/* 220*/ 0xd85603e4L,0x953a9bbfL,0xfb8290d6L,0x0aebcd5fL,0x16206a9aL,
/* 225*/ 0x6c787a14L,0xd9a0f16aL,0x29bf4f74L,0x8f8bce91L,0x0e5a9354L,
/* 230*/ 0xab038cb1L,0x1b8ad11bL,0xe327ff49L,0x0053da20L,0x90cf51dcL,
/* 235*/ 0xda92fe6dL,0x0390ca47L,0xa8958097L,0xa9dc5bafL,0x3931e3c1L,
/* 240*/ 0x840446b6L,0x63d069fbL,0xd7460299L,0x7124ecd1L,0x0791e613L,
/* 245*/ 0x485918fcL,0xd635d04cL,0xdf96ac33L,0x66f2d303L,0x247056aeL,
/* 250*/ 0xa1a7b2a8L,0x27d8cc9cL,0x17b6e998L,0x7bf5590fL,0xfe97f557L,
/* 255*/ 0x5471d8a2L
/* End of S Box 5 */ },
{ /* Start of S Box 6 */
/* 0*/ 0x83a327a1L,0x9f379f51L,0x40a7d007L,0x11307423L,0x224587c1L,
/* 5*/ 0xac27d63bL,0x3b7e64eaL,0x2e1cbfa6L,0x09996000L,0x03bc0e2cL,
/* 10*/ 0xd4c4478aL,0x4542e0abL,0xfeda26d4L,0xc1d10fcbL,0x8252f596L,
/* 15*/ 0x4494eb5cL,0xa362f314L,0xf5ba81fdL,0x75c3a376L,0x4ca214caL,
/* 20*/ 0xe164deddL,0x5088fa97L,0x4b0930e0L,0x2fcfb7e8L,0x33a6f4b2L,
/* 25*/ 0xc7e94211L,0x2d66c774L,0x43be8baeL,0xc663d445L,0x908eb130L,
/* 30*/ 0xf4e3be15L,0x63b9d566L,0x529396b5L,0x1e1be743L,0x4d5ff63fL,
/* 35*/ 0x985e4a83L,0x71ab9df7L,0xc516c6f5L,0x85c19ab4L,0x1f4daee4L,
/* 40*/ 0xf2973431L,0xb713dc5eL,0x3f2e159aL,0xc824da16L,0x06bf376aL,
/* 45*/ 0xb2fe23ecL,0xe39b1c22L,0xf1eecb5fL,0x08e82d52L,0x565686c2L,
/* 50*/ 0xab0aea93L,0xfd47219fL,0xebdbabd7L,0x2404a185L,0x8c7312b9L,
/* 55*/ 0xa8f2d828L,0x0c8902daL,0x65b42b63L,0xc0bbef62L,0x4e3e4cefL,
/* 60*/ 0x788f8018L,0xee1ebab7L,0x93928f9dL,0x683d2903L,0xd3b60689L,
/* 65*/ 0xafcb0ddcL,0x88a4c47aL,0xf6dd9c3dL,0x7ea5fca0L,0x8a6d7244L,
/* 70*/ 0xbe11f120L,0x04ff91b8L,0x8d2dc8c0L,0x27f97fdbL,0x7f9e1f47L,
/* 75*/ 0x1734f0c7L,0x26f3ed8eL,0x0df8f2bfL,0xb0833d9eL,0xe420a4e5L,
/* 80*/ 0xa423cae6L,0x95616772L,0x9ae6c049L,0x075941f2L,0xd8e12812L,
/* 85*/ 0x000f6f4fL,0x3c0d6b05L,0x6cef921cL,0xb82bc264L,0x396cb008L,
/* 90*/ 0x5d608a6fL,0x6d7782c8L,0x186550aaL,0x6b6fec09L,0x28e70b13L,
/* 95*/ 0x57ce5688L,0xecd3af84L,0x23335a95L,0x91f40cd2L,0x7b6a3b26L,
/* 100*/ 0xbd32b3b6L,0x3754a6fbL,0x8ed088f0L,0xf867e87cL,0x20851746L,
/* 105*/ 0x6410f9c6L,0x35380442L,0xc2ca10a7L,0x1adea27fL,0x76bddd79L,
/* 110*/ 0x92742cf4L,0x0e98f7eeL,0x164e931dL,0xb9c835b3L,0x69060a99L,
/* 115*/ 0xb44c531eL,0xfa7b66feL,0xc98a5b53L,0x7d95aae9L,0x302f467bL,
/* 120*/ 0x74b811deL,0xf3866abdL,0xb5b3d32dL,0xfc3157a4L,0xd251fe19L,
/* 125*/ 0x0b5d8eacL,0xda71ffd5L,0x47ea05a3L,0x05c6a9e1L,0xca0ee958L,
/* 130*/ 0x9939034dL,0x25dc5edfL,0x79083cb1L,0x86768450L,0xcf757d6dL,
/* 135*/ 0x5972b6bcL,0xa78d59c9L,0xc4ad8d41L,0x2a362ad3L,0xd1179991L,
/* 140*/ 0x601407ffL,0xdcf50917L,0x587069d0L,0xe0821ed6L,0xdbb59427L,
/* 145*/ 0x73911a4bL,0x7c904fc3L,0x844afb92L,0x6f8c955dL,0xe8c0c5bbL,
/* 150*/ 0xb67ab987L,0xa529d96cL,0xf91f7181L,0x618b1b06L,0xe718bb0cL,
/* 155*/ 0x8bd7615bL,0xd5a93a59L,0x54aef81bL,0x772136e3L,0xce44fd9cL,
/* 160*/ 0x10cda57eL,0x87d66e0bL,0x3d798967L,0x1b2c1804L,0x3edfbd68L,
/* 165*/ 0x15f6e62bL,0xef68b854L,0x3896db35L,0x12b7b5e2L,0xcb489029L,
/* 170*/ 0x9e4f98a5L,0x62eb77a8L,0x217c24a2L,0x964152f6L,0x49b2080aL,
/* 175*/ 0x53d23ee7L,0x48fb6d69L,0x1903d190L,0x9449e494L,0xbf6e7886L,
/* 180*/ 0xfb356cfaL,0x3a261365L,0x424bc1ebL,0xa1192570L,0x019ca782L,
/* 185*/ 0x9d3f7e0eL,0x9c127575L,0xedf02039L,0xad57bcceL,0x5c153277L,
/* 190*/ 0x81a84540L,0xbcaa7356L,0xccd59b60L,0xa62a629bL,0xa25ccd10L,
/* 195*/ 0x2b5b65cfL,0x1c535832L,0x55fd4e3aL,0x31d9790dL,0xf06bc37dL,
/* 200*/ 0x4afc1d71L,0xaeed5533L,0xba461634L,0xbb694b78L,0x5f3a5c73L,
/* 205*/ 0x6a3c764aL,0x8fb0cca9L,0xf725684cL,0x4fe5382fL,0x1d0163afL,
/* 210*/ 0x5aa07a8fL,0xe205a8edL,0xc30bad38L,0xff22cf1fL,0x72432e2eL,
/* 215*/ 0x32c2518bL,0x3487ce4eL,0x7ae0ac02L,0x709fa098L,0x0a3b395aL,
/* 220*/ 0x5b4043f8L,0xa9e48c36L,0x149a8521L,0xd07dee6bL,0x46acd2f3L,
/* 225*/ 0x8958dffcL,0xb3a1223cL,0xb11d31c4L,0xcd7f4d3eL,0x0f28e3adL,
/* 230*/ 0xe5b100beL,0xaac54824L,0xe9c9d7baL,0x9bd47001L,0x80f149b0L,
/* 235*/ 0x66022f0fL,0x020c4048L,0x6efa192aL,0x67073f8dL,0x13ec7bf9L,
/* 240*/ 0x3655011aL,0xe6afe157L,0xd9845f6eL,0xdecc4425L,0x511ae2ccL,
/* 245*/ 0xdf81b4d8L,0xd7809e55L,0xd6d883d9L,0x2cc7978cL,0x5e787cc5L,
/* 250*/ 0xdd0033d1L,0xa050c937L,0x97f75dcdL,0x299de580L,0x41e2b261L,
/* 255*/ 0xea5a54f1L
/* End of S Box 6 */ },
{ /* Start of S Box 7 */
/* 0*/ 0x7e672590L,0xbea513bbL,0x2c906fe6L,0x86029c2bL,0x55dc4f74L,
/* 5*/ 0x0553398eL,0x63e09647L,0xcafd0babL,0x264c37dfL,0x8272210fL,
/* 10*/ 0x67afa669L,0x12d98a5fL,0x8cab23c4L,0x75c68bd1L,0xc3370470L,
/* 15*/ 0x33f37f4eL,0x283992ffL,0xe73a3a67L,0x1032f283L,0xf5ad9fc2L,
/* 20*/ 0x963f0c5dL,0x664fbc45L,0x202ba41cL,0xc7c02d80L,0x54731e84L,
/* 25*/ 0x8a1085f5L,0x601d80fbL,0x2f968e55L,0x35e96812L,0xe45a8f78L,
/* 30*/ 0xbd7de662L,0x3b6e6eadL,0x8097c5efL,0x070b6781L,0xb1e508f3L,
/* 35*/ 0x24e4fae3L,0xb81a7805L,0xec0fc918L,0x43c8774bL,0x9b2512a9L,
/* 40*/ 0x2b05ad04L,0x32c2536fL,0xedf236e0L,0x8bc4b0cfL,0xbaceb837L,
/* 45*/ 0x4535b289L,0x0d0e94c3L,0xa5a371d0L,0xad695a58L,0x39e3437dL,
/* 50*/ 0x9186bffcL,0x21038c3bL,0x0aa9dff9L,0x5d1f06ceL,0x62def8a4L,
/* 55*/ 0xf740a2b4L,0xa2575868L,0x682683c1L,0xdbb30facL,0x61fe1928L,
/* 60*/ 0x468a6511L,0xc61cd5f4L,0xe54d9800L,0x6b98d7f7L,0x8418b6a5L,
/* 65*/ 0x5f09a5d2L,0x90b4e80bL,0x49b2c852L,0x69f11c77L,0x17412b7eL,
/* 70*/ 0x7f6fc0edL,0x56838dccL,0x6e9546a2L,0xd0758619L,0x087b9b9aL,
/* 75*/ 0xd231a01dL,0xaf46d415L,0x097060fdL,0xd920f657L,0x882d3f9fL,
/* 80*/ 0x3ae7c3c9L,0xe8a00d9bL,0x4fe67ebeL,0x2ef80eb2L,0xc1916b0cL,
/* 85*/ 0xf4dffea0L,0xb97eb3ebL,0xfdff84ddL,0xff8b14f1L,0xe96b0572L,
/* 90*/ 0xf64b508cL,0xae220a6eL,0x4423ae5aL,0xc2bece5eL,0xde27567cL,
/* 95*/ 0xfc935c63L,0x47075573L,0xe65b27f0L,0xe121fd22L,0xf2668753L,
/* 100*/ 0x2debf5d7L,0x8347e08dL,0xac5eda03L,0x2a7cebe9L,0x3fe8d92eL,
/* 105*/ 0x23542fe4L,0x1fa7bd50L,0xcf9b4102L,0x9d0dba39L,0x9cb8902aL,
/* 110*/ 0xa7249d8bL,0x0f6d667aL,0x5ebfa9ecL,0x6a594df2L,0x79600938L,
/* 115*/ 0x023b7591L,0xea2c79c8L,0xc99d07eaL,0x64cb5ee1L,0x1a9cab3dL,
/* 120*/ 0x76db9527L,0xc08e012fL,0x3dfb481aL,0x872f22e7L,0x2948d15cL,
/* 125*/ 0xa4782c79L,0x6f50d232L,0x78f0728aL,0x5a87aab1L,0xc4e2c19cL,
/* 130*/ 0xee767387L,0x1b2a1864L,0x7b8d10d3L,0xd1713161L,0x0eeac456L,
/* 135*/ 0xd8799e06L,0xb645b548L,0x4043cb65L,0xa874fb29L,0x4b12d030L,
/* 140*/ 0x7d687413L,0x18ef9a1fL,0xd7631d4cL,0x5829c7daL,0xcdfa30faL,
/* 145*/ 0xc5084bb0L,0x92cd20e2L,0xd4c16940L,0x03283ec0L,0xa917813fL,
/* 150*/ 0x9a587d01L,0x70041f8fL,0xdc6ab1dcL,0xddaee3d5L,0x31829742L,
/* 155*/ 0x198c022dL,0x1c9eafcbL,0x5bbc6c49L,0xd3d3293aL,0x16d50007L,
/* 160*/ 0x04bb8820L,0x3c5c2a41L,0x37ee7af8L,0x8eb04025L,0x9313ecbaL,
/* 165*/ 0xbffc4799L,0x8955a744L,0xef85d633L,0x504499a7L,0xa6ca6a86L,
/* 170*/ 0xbb3d3297L,0xb34a8236L,0x6dccbe4fL,0x06143394L,0xce19fc7bL,
/* 175*/ 0xccc3c6c6L,0xe36254aeL,0x77b7eda1L,0xa133dd9eL,0xebf9356aL,
/* 180*/ 0x513ccf88L,0xe2a1b417L,0x972ee5bdL,0x853824cdL,0x5752f4eeL,
/* 185*/ 0x6c1142e8L,0x3ea4f309L,0xb2b5934aL,0xdfd628aaL,0x59acea3eL,
/* 190*/ 0xa01eb92cL,0x389964bcL,0xda305dd4L,0x019a59b7L,0x11d2ca93L,
/* 195*/ 0xfaa6d3b9L,0x4e772ecaL,0x72651776L,0xfb4e5b0eL,0xa38f91a8L,
/* 200*/ 0x1d0663b5L,0x30f4f192L,0xb50051b6L,0xb716ccb3L,0x4abd1b59L,
/* 205*/ 0x146c5f26L,0xf134e2deL,0x00f67c6cL,0xb0e1b795L,0x98aa4ec7L,
/* 210*/ 0x0cc73b34L,0x654276a3L,0x8d1ba871L,0x740a5216L,0xe0d01a23L,
/* 215*/ 0x9ed161d6L,0x9f36a324L,0x993ebb7fL,0xfeb9491bL,0x365ddcdbL,
/* 220*/ 0x810cffc5L,0x71ec0382L,0x2249e7bfL,0x48817046L,0xf3a24a5bL,
/* 225*/ 0x4288e4d9L,0x0bf5c243L,0x257fe151L,0x95b64c0dL,0x4164f066L,
/* 230*/ 0xaaf7db08L,0x73b1119dL,0x8f9f7bb8L,0xd6844596L,0xf07a34a6L,
/* 235*/ 0x53943d0aL,0xf9dd166dL,0x7a8957afL,0xf8ba3ce5L,0x27c9621eL,
/* 240*/ 0x5cdae910L,0xc8518998L,0x941538feL,0x136115d8L,0xaba8443cL,
/* 245*/ 0x4d01f931L,0x34edf760L,0xb45f266bL,0xd5d4de14L,0x52d8ac35L,
/* 250*/ 0x15cfd885L,0xcbc5cd21L,0x4cd76d4dL,0x7c80ef54L,0xbc92ee75L,
/* 255*/ 0x1e56a1f6L
/* End of S Box 7 */ },
{ /* Start of S Box 8 */
/* 0*/ 0xbaa20b6cL,0x9ffbad26L,0xe1f7d738L,0x794aec8dL,0xc9e9cf3cL,
/* 5*/ 0x8a9a7846L,0xc57c4685L,0xb9a92fedL,0x29cb141fL,0x52f9ddb7L,
/* 10*/ 0xf68ba6bcL,0x19ccc020L,0x4f584aaaL,0x3bf6a596L,0x003b7cf7L,
/* 15*/ 0x54f0ce9aL,0xa7ec4303L,0x46cf0077L,0x78d33aa1L,0x215247d9L,
/* 20*/ 0x74bcdf91L,0x08381d30L,0xdac43e40L,0x64872531L,0x0beffe5fL,
/* 25*/ 0xb317f457L,0xaebb12daL,0xd5d0d67bL,0x7d75c6b4L,0x42a6d241L,
/* 30*/ 0x1502d0a9L,0x3fd97fffL,0xc6c3ed28L,0x81868d0aL,0x92628bc5L,
/* 35*/ 0x86679544L,0xfd1867afL,0x5ca3ea61L,0x568d5578L,0x4a2d71f4L,
/* 40*/ 0x43c9d549L,0x8d95de2bL,0x6e5c74a0L,0x9120ffc7L,0x0d05d14aL,
/* 45*/ 0xa93049d3L,0xbfa80e17L,0xf4096810L,0x043f5ef5L,0xa673b4f1L,
/* 50*/ 0x6d780298L,0xa4847783L,0x5ee726fbL,0x9934c281L,0x220a588cL,
/* 55*/ 0x384e240fL,0x933d5c69L,0x39e5ef47L,0x26e8b8f3L,0x4c1c6212L,
/* 60*/ 0x8040f75dL,0x074b7093L,0x6625a8d7L,0x36298945L,0x76285088L,
/* 65*/ 0x651d37c3L,0x24f5274dL,0xdbca3dabL,0x186b7ee1L,0xd80f8182L,
/* 70*/ 0x14210c89L,0x943a3075L,0x4e6e11c4L,0x4d7e6badL,0xf05064c8L,
/* 75*/ 0x025dcd97L,0x4bc10302L,0x7cede572L,0x8f90a970L,0xab88eebaL,
/* 80*/ 0xb5998029L,0x5124d839L,0xb0eeb6a3L,0x89ddabdcL,0xe8074d76L,
/* 85*/ 0xa1465223L,0x32518cf2L,0x9d39d4ebL,0xc0d84524L,0xe35e6ea8L,
/* 90*/ 0x7abf3804L,0x113e2348L,0x9ae6069dL,0xb4dfdabbL,0xa8c5313fL,
/* 95*/ 0x23ea3f79L,0x530e36a2L,0xa5fd228bL,0x95d1d350L,0x2b14cc09L,
/* 100*/ 0x40042956L,0x879d05ccL,0x2064b9caL,0xacaca40eL,0xb29c846eL,
/* 105*/ 0x9676c9e3L,0x752b7b8aL,0x7be2bcc2L,0x6bd58f5eL,0xd48f4c32L,
/* 110*/ 0x606835e4L,0x9cd7c364L,0x2c269b7aL,0x3a0d079cL,0x73b683feL,
/* 115*/ 0x45374f1eL,0x10afa242L,0x577f8666L,0xddaa10f6L,0xf34f561cL,
/* 120*/ 0x3d355d6bL,0xe47048aeL,0xaa13c492L,0x050344fdL,0x2aab5151L,
/* 125*/ 0xf5b26ae5L,0xed919a59L,0x5ac67900L,0xf1cde380L,0x0c79a11bL,
/* 130*/ 0x351533fcL,0xcd4d8e36L,0x1f856005L,0x690b9fddL,0xe736dccfL,
/* 135*/ 0x1d47bf6aL,0x7f66c72aL,0x85f21b7fL,0x983cbdb6L,0x01ebbebfL,
/* 140*/ 0x035f3b99L,0xeb111f34L,0x28cefdc6L,0x5bfc9ecdL,0xf22eacb0L,
/* 145*/ 0x9e41cbb2L,0xe0f8327cL,0x82e3e26fL,0xfc43fc86L,0xd0ba66dfL,
/* 150*/ 0x489ef2a7L,0xd9e0c81dL,0x68690d52L,0xcc451367L,0xc2232e16L,
/* 155*/ 0xe95a7335L,0x0fdae19bL,0xff5b962cL,0x97596527L,0xc46db333L,
/* 160*/ 0x3ed4c562L,0xc14c9d9eL,0x5d6faa21L,0x638e940dL,0xf9316d58L,
/* 165*/ 0x47b3b0eaL,0x30ffcad2L,0xce1bba7dL,0x1e6108e6L,0x2e1ea33dL,
/* 170*/ 0x507bf05bL,0xfafef94bL,0xd17de8e2L,0x5598b214L,0x1663f813L,
/* 175*/ 0x17d25a2dL,0xeefa5ff9L,0x582f4e37L,0x12128773L,0xfef17ab8L,
/* 180*/ 0x06005322L,0xbb32bbc9L,0x8c898508L,0x592c15f0L,0xd38a4054L,
/* 185*/ 0x4957b7d6L,0xd2b891dbL,0x37bd2d3eL,0x34ad20cbL,0x622288e9L,
/* 190*/ 0x2dc7345aL,0xafb416c0L,0x1cf459b1L,0xdc7739faL,0x0a711a25L,
/* 195*/ 0x13e18a0cL,0x5f72af4cL,0x6ac8db11L,0xbe53c18eL,0x1aa569b9L,
/* 200*/ 0xef551ea4L,0xa02a429fL,0xbd16e790L,0x7eb9171aL,0x77d693d8L,
/* 205*/ 0x8e06993aL,0x9bde7560L,0xe5801987L,0xc37a09beL,0xb8db76acL,
/* 210*/ 0xe2087294L,0x6c81616dL,0xb7f30fe7L,0xbc9b82bdL,0xfba4e4d4L,
/* 215*/ 0xc7b1012fL,0xa20c043bL,0xde9febd0L,0x2f9297ceL,0xe610aef8L,
/* 220*/ 0x70b06f19L,0xc86ae00bL,0x0e01988fL,0x41192ae0L,0x448c1cb5L,
/* 225*/ 0xadbe92eeL,0x7293a007L,0x1b54b5b3L,0xd61f63d1L,0xeae40a74L,
/* 230*/ 0x61a72b55L,0xec83a7d5L,0x88942806L,0x90a07da5L,0xd7424b95L,
/* 235*/ 0x67745b4eL,0xa31a1853L,0xca6021efL,0xdfb56c4fL,0xcbc2d915L,
/* 240*/ 0x3c48e918L,0x8bae3c63L,0x6f659c71L,0xf8b754c1L,0x2782f3deL,
/* 245*/ 0xf796f168L,0x71492c84L,0x33c0f5a6L,0x3144f6ecL,0x25dc412eL,
/* 250*/ 0xb16c5743L,0x83a1fa7eL,0x0997b101L,0xb627e6e8L,0xcf33905cL,
/* 255*/ 0x8456fb65L
/* End of S Box 8 */ },
{ /* Start of S Box 9 */
/* 0*/ 0xb29bea74L,0xc35da605L,0x305c1ca3L,0xd2e9f5bcL,0x6fd5bff4L,
/* 5*/ 0xff347703L,0xfc45b163L,0xf498e068L,0xb71229fcL,0x81acc3fbL,
/* 10*/ 0x78538a8bL,0x984ecf81L,0xa5da47a4L,0x8f259eefL,0x6475dc65L,
/* 15*/ 0x081865b9L,0x49e14a3cL,0x19e66079L,0xd382e91bL,0x5b109794L,
/* 20*/ 0x3f9f81e1L,0x4470a388L,0x41601abeL,0xaaf9f407L,0x8e175ef6L,
/* 25*/ 0xed842297L,0x893a4271L,0x1790839aL,0xd566a99eL,0x6b417deeL,
/* 30*/ 0x75c90d23L,0x715edb31L,0x723553f7L,0x9afb50c9L,0xfbc5f600L,
/* 35*/ 0xcd3b6a4eL,0x97ed0fbaL,0x29689aecL,0x63135c8eL,0xf0e26c7eL,
/* 40*/ 0x0692ae7fL,0xdbb208ffL,0x2ede3e9bL,0x6a65bebdL,0xd40867e9L,
/* 45*/ 0xc954afc5L,0x73b08201L,0x7ffdf809L,0x1195c24fL,0x1ca5adcaL,
/* 50*/ 0x74bd6d1fL,0xb393c455L,0xcadfd3faL,0x99f13011L,0x0ebca813L,
/* 55*/ 0x60e791b8L,0x6597ac7aL,0x18a7e46bL,0x09cb49d3L,0x0b27df6dL,
/* 60*/ 0xcfe52f87L,0xcef66837L,0xe6328035L,0xfa87c592L,0x37baff93L,
/* 65*/ 0xd71fcc99L,0xdcab205cL,0x4d7a5638L,0x48012510L,0x62797558L,
/* 70*/ 0xb6cf1fe5L,0xbc311834L,0x9c2373acL,0x14ec6175L,0xa439cbdfL,
/* 75*/ 0x54afb0eaL,0xd686960bL,0xfdd0d47bL,0x7b063902L,0x8b78bac3L,
/* 80*/ 0x26c6a4d5L,0x5c0055b6L,0x2376102eL,0x0411783eL,0x2aa3f1cdL,
/* 85*/ 0x51fc6ea8L,0x701ce243L,0x9b2a0abbL,0x0ad93733L,0x6e80d03dL,
/* 90*/ 0xaf6295d1L,0xf629896fL,0xa30b0648L,0x463d8dd4L,0x963f84cbL,
/* 95*/ 0x01ff94f8L,0x8d7fefdcL,0x553611c0L,0xa97c1719L,0xb96af759L,
/* 100*/ 0xe0e3c95eL,0x0528335bL,0x21fe5925L,0x821a5245L,0x807238b1L,
/* 105*/ 0x67f23db5L,0xea6b4eabL,0x0da6f985L,0xab1bc85aL,0xef8c90e4L,
/* 110*/ 0x4526230eL,0x38eb8b1cL,0x1b91cd91L,0x9fce5f0cL,0xf72cc72bL,
/* 115*/ 0xc64f2617L,0xdaf7857dL,0x7d373cf1L,0x28eaedd7L,0x203887d0L,
/* 120*/ 0xc49a155fL,0xa251b3b0L,0xf2d47ae3L,0x3d9ef267L,0x4a94ab2fL,
/* 125*/ 0x7755a222L,0x0205e329L,0xc28fa7a7L,0xaec1fe51L,0x270f164cL,
/* 130*/ 0x8c6d01bfL,0x53b5bc98L,0xc09d3febL,0x834986ccL,0x4309a12cL,
/* 135*/ 0x578b2a96L,0x3bb74b86L,0x69561b4aL,0x037e32f3L,0xde335b08L,
/* 140*/ 0xc5156be0L,0xe7ef09adL,0x93b834c7L,0xa7719352L,0x59302821L,
/* 145*/ 0xe3529d26L,0xf961da76L,0xcb142c44L,0xa0f3b98dL,0x76502457L,
/* 150*/ 0x945a414bL,0x078eeb12L,0xdff8de69L,0xeb6c8c2dL,0xbda90c4dL,
/* 155*/ 0xe9c44d16L,0x168dfd66L,0xad64763bL,0xa65fd764L,0x95a29c06L,
/* 160*/ 0x32d7713fL,0x40f0b277L,0x224af08fL,0x004cb5e8L,0x92574814L,
/* 165*/ 0x8877d827L,0x3e5b2d04L,0x68c2d5f2L,0x86966273L,0x1d433adaL,
/* 170*/ 0x8774988aL,0x3c0e0bfeL,0xddad581dL,0x2fd654edL,0x0f4769fdL,
/* 175*/ 0xc181ee9dL,0x5fd88f61L,0x341dbb3aL,0x528543f9L,0xd92235cfL,
/* 180*/ 0x1ea82eb4L,0xb5cd790fL,0x91d24f1eL,0xa869e6c2L,0x61f474d2L,
/* 185*/ 0xcc205addL,0x0c7bfba9L,0xbf2b0489L,0xb02d72d8L,0x2b46ece6L,
/* 190*/ 0xe4dcd90aL,0xb8a11440L,0xee8a63b7L,0x854dd1a1L,0xd1e00583L,
/* 195*/ 0x42b40e24L,0x9e8964deL,0xb4b35d78L,0xbec76f6eL,0x24b9c620L,
/* 200*/ 0xd8d399a6L,0x5adb2190L,0x2db12730L,0x3a5866afL,0x58c8fadbL,
/* 205*/ 0x5d8844e7L,0x8a4bf380L,0x15a01d70L,0x79f5c028L,0x66be3b8cL,
/* 210*/ 0xf3e42b53L,0x56990039L,0x2c0c3182L,0x5e16407cL,0xecc04515L,
/* 215*/ 0x6c440284L,0x4cb6701aL,0x13bfc142L,0x9d039f6aL,0x4f6e92c8L,
/* 220*/ 0xa1407c62L,0x8483a095L,0xc70ae1c4L,0xe20213a2L,0xbacafc41L,
/* 225*/ 0x4ecc12b3L,0x4bee3646L,0x1fe807aeL,0x25217f9cL,0x35dde5f5L,
/* 230*/ 0x7a7dd6ceL,0xf89cce50L,0xac07b718L,0x7e73d2c6L,0xe563e76cL,
/* 235*/ 0x123ca536L,0x3948ca56L,0x9019dd49L,0x10aa88d9L,0xc82451e2L,
/* 240*/ 0x473eb6d6L,0x506fe854L,0xe8bb03a5L,0x332f4c32L,0xfe1e1e72L,
/* 245*/ 0xb1ae572aL,0x7c0d7bc1L,0xe1c37eb2L,0xf542aa60L,0xf1a48ea0L,
/* 250*/ 0xd067b89fL,0xbbfa195dL,0x1a049b0dL,0x315946aaL,0x36d1b447L,
/* 255*/ 0x6d2ebdf0L
/* End of S Box 9 */ },
{ /* Start of S Box 10 */
/* 0*/ 0x0d188a6dL,0x12cea0dbL,0x7e63740eL,0x6a444821L,0x253d234fL,
/* 5*/ 0x6ffc6597L,0x94a6bdefL,0x33ee1b2fL,0x0a6c00c0L,0x3aa336b1L,
/* 10*/ 0x5af55d17L,0x265fb3dcL,0x0e89cf4dL,0x0786b008L,0xc80055b8L,
/* 15*/ 0x6b17c3ceL,0x72b05a74L,0xd21a8d78L,0xa6b70840L,0xfe8eae77L,
/* 20*/ 0xed69565cL,0x55e1bcf4L,0x585c2f60L,0xe06f1a62L,0xad67c0cdL,
/* 25*/ 0x7712af88L,0x9cc26acaL,0x1888053dL,0x37eb853eL,0x9215abd7L,
/* 30*/ 0xde30adfcL,0x1f1038e6L,0x70c51c8aL,0x8d586c26L,0xf72bdd90L,
/* 35*/ 0x4dc3ce15L,0x68eaeefaL,0xd0e9c8b9L,0x200f9c44L,0xddd141baL,
/* 40*/ 0x024bf1d3L,0x0f64c9d4L,0xc421e9e9L,0x9d11c14cL,0x9a0dd9e4L,
/* 45*/ 0x5f92ec19L,0x1b980df0L,0x1dcc4542L,0xb8fe8c56L,0x0c9c9167L,
/* 50*/ 0x4e81eb49L,0xca368f27L,0xe3603b37L,0xea08acccL,0xac516992L,
/* 55*/ 0xc34f513bL,0x804d100dL,0x6edca4c4L,0xfc912939L,0x29d219b0L,
/* 60*/ 0x278aaa3cL,0x4868da7dL,0x54e890b7L,0xb46d735aL,0x514589aaL,
/* 65*/ 0xd6c630afL,0x4980dfe8L,0xbe3ccc55L,0x59d41202L,0x650c078bL,
/* 70*/ 0xaf3a9e7bL,0x3ed9827aL,0x9e79fc6eL,0xaadbfbaeL,0xc5f7d803L,
/* 75*/ 0x3daf7f50L,0x67b4f465L,0x73406e11L,0x39313f8cL,0x8a6e6686L,
/* 80*/ 0xd8075f1fL,0xd3cbfed1L,0x69c7e49cL,0x930581e0L,0xe4b1a5a8L,
/* 85*/ 0xbbc45472L,0x09ddbf58L,0xc91d687eL,0xbdbffda5L,0x88c08735L,
/* 90*/ 0xe9e36bf9L,0xdb5ea9b6L,0x95559404L,0x08f432fbL,0xe24ea281L,
/* 95*/ 0x64663579L,0x000b8010L,0x7914e7d5L,0x32fd0473L,0xd1a7f0a4L,
/* 100*/ 0x445ab98eL,0xec72993fL,0xa29a4d32L,0xb77306d8L,0xc7c97cf6L,
/* 105*/ 0x7b6ab645L,0xf5ef7adfL,0xfb2e15f7L,0xe747f757L,0x5e944354L,
/* 110*/ 0x234a2669L,0x47e46359L,0x9b9d11a9L,0x40762cedL,0x56f1de98L,
/* 115*/ 0x11334668L,0x890a9a70L,0x1a296113L,0xb3bd4af5L,0x163b7548L,
/* 120*/ 0xd51b4f84L,0xb99b2abcL,0x3cc1dc30L,0xa9f0b56cL,0x812272b2L,
/* 125*/ 0x0b233a5fL,0xb650dbf2L,0xf1a0771bL,0x36562b76L,0xdc037b0fL,
/* 130*/ 0x104c97ffL,0xc2ec98d2L,0x90596f22L,0x28b6620bL,0xdf42b212L,
/* 135*/ 0xfdbc4243L,0xf3fb175eL,0x4a2d8b00L,0xe8f3869bL,0x30d69bc3L,
/* 140*/ 0x853714c8L,0xa7751d2eL,0x31e56deaL,0xd4840b0cL,0x9685d783L,
/* 145*/ 0x068c9333L,0x8fba032cL,0x76d7bb47L,0x6d0ee22bL,0xb546794bL,
/* 150*/ 0xd971b894L,0x8b09d253L,0xa0ad5761L,0xee77ba06L,0x46359f31L,
/* 155*/ 0x577cc7ecL,0x52825efdL,0xa4beed95L,0x9825c52aL,0xeb48029aL,
/* 160*/ 0xbaae59f8L,0xcf490ee1L,0xbc990164L,0x8ca49dfeL,0x4f38a6e7L,
/* 165*/ 0x2ba98389L,0x8228f538L,0x199f64acL,0x01a1cac5L,0xa8b51641L,
/* 170*/ 0x5ce72d01L,0x8e5df26bL,0x60f28e1eL,0xcd5be125L,0xe5b376bfL,
/* 175*/ 0x1c8d3116L,0x7132cbb3L,0xcb7ae320L,0xc0fa5366L,0xd7653e34L,
/* 180*/ 0x971c88c2L,0xc62c7dd0L,0x34d0a3daL,0x868f6709L,0x7ae6fa8fL,
/* 185*/ 0x22bbd523L,0x66cd3d5bL,0x1ef9288dL,0xf9cf58c1L,0x5b784e80L,
/* 190*/ 0x7439a191L,0xae134c36L,0x9116c463L,0x2e9e1396L,0xf8611f3aL,
/* 195*/ 0x2d2f3307L,0x247f37ddL,0xc1e2ff9dL,0x43c821e5L,0x05ed5cabL,
/* 200*/ 0xef74e80aL,0x4cca6028L,0xf0ac3cbdL,0x5d874b29L,0x6c62f6a6L,
/* 205*/ 0x4b2a2ef3L,0xb1aa2087L,0x62a5d0a3L,0x0327221cL,0xb096b4c6L,
/* 210*/ 0x417ec693L,0xaba840d6L,0x789725ebL,0xf4b9e02dL,0xe6e00975L,
/* 215*/ 0xcc04961aL,0x63f624bbL,0x7fa21ecbL,0x2c01ea7fL,0xb2415005L,
/* 220*/ 0x2a8bbeb5L,0x83b2b14eL,0xa383d1a7L,0x5352f96aL,0x043ecdadL,
/* 225*/ 0xce1918a1L,0xfa6be6c9L,0x50def36fL,0xf6b80ce2L,0x4543ef7cL,
/* 230*/ 0x9953d651L,0xf257955dL,0x87244914L,0xda1e0a24L,0xffda4785L,
/* 235*/ 0x14d327a2L,0x3b93c29fL,0x840684b4L,0x61ab71a0L,0x9f7b784aL,
/* 240*/ 0x2fd570cfL,0x15955bdeL,0x38f8d471L,0x3534a718L,0x133fb71dL,
/* 245*/ 0x3fd80f52L,0x4290a8beL,0x75ff44c7L,0xa554e546L,0xe1023499L,
/* 250*/ 0xbf2652e3L,0x7d20399eL,0xa1df7e82L,0x177092eeL,0x217dd3f1L,
/* 255*/ 0x7c1ff8d9L
/* End of S Box 10 */ },
{ /* Start of S Box 11 */
/* 0*/ 0x12113f2eL,0xbfbd0785L,0xf11793fbL,0xa5bff566L,0x83c7b0e5L,
/* 5*/ 0x72fb316bL,0x75526a9aL,0x41e0e612L,0x7156ba09L,0x53ce7deeL,
/* 10*/ 0x0aa26881L,0xa43e0d7dL,0x3da73ca3L,0x182761edL,0xbd5077ffL,
/* 15*/ 0x56db4aa0L,0xe792711cL,0xf0a4eb1dL,0x7f878237L,0xec65c4e8L,
/* 20*/ 0x08dc8d43L,0x0f8ce142L,0x8258abdaL,0xf4154e16L,0x49dec2fdL,
/* 25*/ 0xcd8d5705L,0x6c2c3a0fL,0x5c12bb88L,0xeff3cdb6L,0x2c89ed8cL,
/* 30*/ 0x7beba967L,0x2a142157L,0xc6d0836fL,0xb4f97e96L,0x6931e969L,
/* 35*/ 0x514e6c7cL,0xa7792600L,0x0bbbf780L,0x59671bbdL,0x0707b676L,
/* 40*/ 0x37482d93L,0x80af1479L,0x3805a60dL,0xe1f4cac1L,0x580b3074L,
/* 45*/ 0x30b8d6ceL,0x05a304beL,0xd176626dL,0xebca97f3L,0xbb201f11L,
/* 50*/ 0x6a1afe23L,0xffaa86e4L,0x62b4da49L,0x1b6629f5L,0xf5d9e092L,
/* 55*/ 0xf37f3dd1L,0x619bd45bL,0xa6ec8e4fL,0x29c80939L,0x0c7c0c34L,
/* 60*/ 0x9cfe6e48L,0xe65fd3acL,0x73613b65L,0xb3c669f9L,0xbe2e8a9eL,
/* 65*/ 0x286f9678L,0x5797fd13L,0x99805d75L,0xcfb641c5L,0xa91074baL,
/* 70*/ 0x6343af47L,0x6403cb46L,0x8894c8dbL,0x2663034cL,0x3c40dc5eL,
/* 75*/ 0x00995231L,0x96789aa2L,0x2efde4b9L,0x7dc195e1L,0x547dadd5L,
/* 80*/ 0x06a8ea04L,0xf2347a63L,0x5e0dc6f7L,0x8462dfc2L,0x1e6b2c3cL,
/* 85*/ 0x9bd275b3L,0x91d419e2L,0xbcefd17eL,0xb9003924L,0xd07e7320L,
/* 90*/ 0xdef0495cL,0xc36ad00eL,0x1785b1abL,0x92e20bcfL,0xb139f0e9L,
/* 95*/ 0x675bb9a1L,0xaecfa4afL,0x132376cbL,0xe84589d3L,0x79a05456L,
/* 100*/ 0xa2f860bcL,0x1ae4f8b5L,0x20df4db4L,0xa1e1428bL,0x3bf60a1aL,
/* 105*/ 0x27ff7bf1L,0xcb44c0e7L,0xf7f587c4L,0x1f3b9b21L,0x94368f01L,
/* 110*/ 0x856e23a4L,0x6f93de3fL,0x773f5bbfL,0x8b22056eL,0xdf41f654L,
/* 115*/ 0xb8246ff4L,0x8d57bff2L,0xd57167eaL,0xc5699f22L,0x40734ba7L,
/* 120*/ 0x5d5c2772L,0x033020a8L,0xe30a7c4dL,0xadc40fd6L,0x76353441L,
/* 125*/ 0x5aa5229bL,0x81516590L,0xda49f14eL,0x4fa672a5L,0x4d9fac5fL,
/* 130*/ 0x154be230L,0x8a7a5cc0L,0xce3d2f84L,0xcca15514L,0x5221360cL,
/* 135*/ 0xaf0fb81eL,0x5bdd5873L,0xf6825f8fL,0x1113d228L,0x70ad996cL,
/* 140*/ 0x93320051L,0x60471c53L,0xe9ba567bL,0x3a462ae3L,0x5f55e72dL,
/* 145*/ 0x1d3c5ad7L,0xdcfc45ecL,0x34d812efL,0xfa96ee1bL,0x369d1ef8L,
/* 150*/ 0xc9b1a189L,0x7c1d3555L,0x50845edcL,0x4bb31877L,0x8764a060L,
/* 155*/ 0x8c9a9415L,0x230e1a3aL,0xb05e9133L,0x242b9e03L,0xa3b99db7L,
/* 160*/ 0xc2d7fb0aL,0x3333849dL,0xd27278d4L,0xb5d3efa6L,0x78ac28adL,
/* 165*/ 0xc7b2c135L,0x0926ecf0L,0xc1374c91L,0x74f16d98L,0x2274084aL,
/* 170*/ 0x3f6d9cfaL,0x7ac0a383L,0xb73aff1fL,0x3909a23dL,0x9f1653aeL,
/* 175*/ 0x4e2f3e71L,0xca5ab22aL,0xe01e3858L,0x90c5a7ebL,0x3e4a17dfL,
/* 180*/ 0xaa987fb0L,0x488bbd62L,0xb625062bL,0x2d776bb8L,0x43b5fc08L,
/* 185*/ 0x1490d532L,0xd6d12495L,0x44e89845L,0x2fe60118L,0x9d9ef950L,
/* 190*/ 0xac38133eL,0xd3864329L,0x017b255aL,0xfdc2dd26L,0x256851e6L,
/* 195*/ 0x318e7086L,0x2bfa4861L,0x89eac706L,0xee5940c6L,0x68c3bc2fL,
/* 200*/ 0xe260334bL,0x98da90bbL,0xf818f270L,0x4706d897L,0x212d3799L,
/* 205*/ 0x4cf7e5d0L,0xd9c9649fL,0xa85db5cdL,0x35e90e82L,0x6b881152L,
/* 210*/ 0xab1c02c7L,0x46752b02L,0x664f598eL,0x45ab2e64L,0xc4cdb4b2L,
/* 215*/ 0xba42107fL,0xea2a808aL,0x971bf3deL,0x4a54a836L,0x4253aeccL,
/* 220*/ 0x1029be68L,0x6dcc9225L,0xe4bca56aL,0xc0ae50b1L,0x7e011d94L,
/* 225*/ 0xe59c162cL,0xd8e5c340L,0xd470fa0bL,0xb2be79ddL,0xd783889cL,
/* 230*/ 0x1cede8f6L,0x8f4c817aL,0xddb785c9L,0x860232d8L,0x198aaad9L,
/* 235*/ 0xa0814738L,0x3219cffcL,0x169546d2L,0xfc0cb759L,0x55911510L,
/* 240*/ 0x04d5cec3L,0xed08cc3bL,0x0d6cf427L,0xc8e38ccaL,0x0eeee3feL,
/* 245*/ 0x9ee7d7c8L,0xf9f24fa9L,0xdb04b35dL,0x9ab0c9e0L,0x651f4417L,
/* 250*/ 0x028f8b07L,0x6e28d9aaL,0xfba96319L,0x8ed66687L,0xfecbc58dL,
/* 255*/ 0x954ddb44L
/* End of S Box 11 */ },
{ /* Start of S Box 12 */
/* 0*/ 0x7b0bdffeL,0x865d16b1L,0x49a058c0L,0x97abaa3fL,0xcaacc75dL,
/* 5*/ 0xaba6c17dL,0xf8746f92L,0x6f48aeedL,0x8841d4b5L,0xf36a146aL,
/* 10*/ 0x73c390abL,0xe6fb558fL,0x87b1019eL,0x26970252L,0x246377b2L,
/* 15*/ 0xcbf676aeL,0xf923db06L,0xf7389116L,0x14c81a90L,0x83114eb4L,
/* 20*/ 0x8b137559L,0x95a86a7aL,0xd5b8da8cL,0xc4df780eL,0x5a9cb3e2L,
/* 25*/ 0xe44d4062L,0xe8dc8ef6L,0x9d180845L,0x817ad18bL,0xc286c85bL,
/* 30*/ 0x251f20deL,0xee6d5933L,0xf6edef81L,0xd4d16c1eL,0xc94a0c32L,
/* 35*/ 0x8437fd22L,0x3271ee43L,0x42572aeeL,0x5f91962aL,0x1c522d98L,
/* 40*/ 0x59b23f0cL,0xd86b8804L,0x08c63531L,0x2c0d7a40L,0xb97c4729L,
/* 45*/ 0x04964df9L,0x13c74a17L,0x5878362fL,0x4c808cd6L,0x092cb1e0L,
/* 50*/ 0x6df02885L,0xa0c2105eL,0x8aba9e68L,0x64e03057L,0xe5d61325L,
/* 55*/ 0x0e43a628L,0x16dbd62bL,0x2733d90bL,0x3ae57283L,0xc0c1052cL,
/* 60*/ 0x4b6fb620L,0x37513953L,0xfc898bb3L,0x471b179fL,0xdf6e66b8L,
/* 65*/ 0xd32142f5L,0x9b30fafcL,0x4ed92549L,0x105c6d99L,0x4acd69ffL,
/* 70*/ 0x2b1a27d3L,0x6bfcc067L,0x6301a278L,0xad36e6f2L,0xef3ff64eL,
/* 75*/ 0x56b3cadbL,0x0184bb61L,0x17beb9fdL,0xfaec6109L,0xa2e1ffa1L,
/* 80*/ 0x2fd224f8L,0x238f5be6L,0x8f8570cfL,0xaeb5f25aL,0x4f1d3e64L,
/* 85*/ 0x4377eb24L,0x1fa45346L,0xb2056386L,0x52095e76L,0xbb7b5adcL,
/* 90*/ 0x3514e472L,0xdde81e6eL,0x7acea9c4L,0xac15cc48L,0x71c97d93L,
/* 95*/ 0x767f941cL,0x911052a2L,0xffea09bfL,0xfe3ddcf0L,0x15ebf3aaL,
/* 100*/ 0x9235b8bcL,0x75408615L,0x9a723437L,0xe1a1bd38L,0x33541b7eL,
/* 105*/ 0x1bdd6856L,0xb307e13eL,0x90814bb0L,0x51d7217bL,0x0bb92219L,
/* 110*/ 0x689f4500L,0xc568b01fL,0x5df3d2d7L,0x3c0ecd0dL,0x2a0244c8L,
/* 115*/ 0x852574e8L,0xe72f23a9L,0x8e26ed02L,0x2d92cbddL,0xdabc0458L,
/* 120*/ 0xcdf5feb6L,0x9e4e8dccL,0xf4f1e344L,0x0d8c436dL,0x4427603bL,
/* 125*/ 0xbdd37fdaL,0x80505f26L,0x8c7d2b8eL,0xb73273c5L,0x397362eaL,
/* 130*/ 0x618a3811L,0x608bfb88L,0x06f7d714L,0x212e4677L,0x28efceadL,
/* 135*/ 0x076c0371L,0x36a3a4d9L,0x5487b455L,0x3429a365L,0x65d467acL,
/* 140*/ 0x78ee7eebL,0x99bf12b7L,0x4d129896L,0x772a5601L,0xcce284c7L,
/* 145*/ 0x2ed85c21L,0xd099e8a4L,0xa179158aL,0x6ac0ab1aL,0x299a4807L,
/* 150*/ 0xbe67a58dL,0xdc19544aL,0xb8949b54L,0x8d315779L,0xb6f849c1L,
/* 155*/ 0x53c5ac34L,0x66de92a5L,0xf195dd13L,0x318d3a73L,0x301ec542L,
/* 160*/ 0x0cc40da6L,0xf253ade4L,0x467ee566L,0xea5585ecL,0x3baf19bbL,
/* 165*/ 0x7de9f480L,0x79006e7cL,0xa9b7a197L,0xa44bd8f1L,0xfb2ba739L,
/* 170*/ 0xec342fd4L,0xed4fd32dL,0x3d1789baL,0x400f5d7fL,0xc798f594L,
/* 175*/ 0x4506a847L,0x034c0a95L,0xe2162c9dL,0x55a9cfd0L,0x692d832eL,
/* 180*/ 0xcf9db2caL,0x5e2287e9L,0xd2610ef3L,0x1ae7ecc2L,0x48399ca0L,
/* 185*/ 0xa7e4269bL,0x6ee3a0afL,0x7065bfe1L,0xa6ffe708L,0x2256804cL,
/* 190*/ 0x7476e21bL,0x41b0796cL,0x7c243b05L,0x000a950fL,0x1858416bL,
/* 195*/ 0xf5a53c89L,0xe9fef823L,0x3f443275L,0xe0cbf091L,0x0af27b84L,
/* 200*/ 0x3ebb0f27L,0x1de6f7f4L,0xc31c29f7L,0xb166de3dL,0x12932ec3L,
/* 205*/ 0x9c0c0674L,0x5cda81b9L,0xd1bd9d12L,0xaffd7c82L,0x8962bca7L,
/* 210*/ 0xa342c4a8L,0x62457151L,0x82089f03L,0xeb49c670L,0x5b5f6530L,
/* 215*/ 0x7e28bad2L,0x20880ba3L,0xf0faafcdL,0xce82b56fL,0x0275335cL,
/* 220*/ 0xc18e8afbL,0xde601d69L,0xba9b820aL,0xc8a2be4fL,0xd7cac335L,
/* 225*/ 0xd9a73741L,0x115e974dL,0x7f5ac21dL,0x383bf9c6L,0xbcaeb75fL,
/* 230*/ 0xfd0350ceL,0xb5d06b87L,0x9820e03cL,0x72d5f163L,0xe3644fc9L,
/* 235*/ 0xa5464c4bL,0x57048fcbL,0x9690c9dfL,0xdbf9eafaL,0xbff4649aL,
/* 240*/ 0x053c00e3L,0xb4b61136L,0x67593dd1L,0x503ee960L,0x9fb4993aL,
/* 245*/ 0x19831810L,0xc670d518L,0xb05b51d8L,0x0f3a1ce5L,0x6caa1f9cL,
/* 250*/ 0xaacc31beL,0x949ed050L,0x1ead07e7L,0xa8479abdL,0xd6cffcd5L,
/* 255*/ 0x936993efL
/* End of S Box 12 */ },
{ /* Start of S Box 13 */
/* 0*/ 0x472e91cbL,0x5444b5b6L,0x62be5861L,0x1be102c7L,0x63e4b31eL,
/* 5*/ 0xe81f71b7L,0x9e2317c9L,0x39a408aeL,0x518024f4L,0x1731c66fL,
/* 10*/ 0x68cbc918L,0x71fb0c9eL,0xd03b7fddL,0x7d6222ebL,0x9057eda3L,
/* 15*/ 0x1a34a407L,0x8cc2253dL,0xb6f6979dL,0x835675dcL,0xf319be9fL,
/* 20*/ 0xbe1cd743L,0x4d32fee4L,0x77e7d887L,0x37e9ebfdL,0x15f851e8L,
/* 25*/ 0x23dc3706L,0x19d78385L,0xbd506933L,0xa13ad4a6L,0x913f1a0eL,
/* 30*/ 0xdde560b9L,0x9a5f0996L,0xa65a0435L,0x48d34c4dL,0xe90839a7L,
/* 35*/ 0x8abba54eL,0x6fd13ce1L,0xc7eebd3cL,0x0e297602L,0x58b9bbb4L,
/* 40*/ 0xef7901e6L,0x64a28a62L,0xa509875aL,0xf8834442L,0x2702c709L,
/* 45*/ 0x07353f31L,0x3b39f665L,0xf5b18b49L,0x4010ae37L,0x784de00bL,
/* 50*/ 0x7a1121e9L,0xde918ed3L,0xc8529dcdL,0x816a5d05L,0x02ed8298L,
/* 55*/ 0x04e3dd84L,0xfd2bc3e2L,0xaf167089L,0x96af367eL,0xa4da6232L,
/* 60*/ 0x18ff7325L,0x05f9a9f1L,0x4fefb9f9L,0xcd94eaa5L,0xbfaa5069L,
/* 65*/ 0xa0b8c077L,0x60d86f57L,0xfe71c813L,0x29ebd2c8L,0x4ca86538L,
/* 70*/ 0x6bf1a030L,0xa237b88aL,0xaa8af41dL,0xe1f7b6ecL,0xe214d953L,
/* 75*/ 0x33057879L,0x49caa736L,0xfa45cff3L,0xc063b411L,0xba7e27d0L,
/* 80*/ 0x31533819L,0x2a004ac1L,0x210efc3fL,0x2646885eL,0x66727dcfL,
/* 85*/ 0x9d7fbf54L,0xa8dd0ea8L,0x3447caceL,0x3f0c14dbL,0xb8382aacL,
/* 90*/ 0x4ace3539L,0x0a518d51L,0x95178981L,0x35aee2caL,0x73f0f7e3L,
/* 95*/ 0x94281140L,0x59d0e523L,0xd292cb88L,0x565d1b27L,0x7ec8fbafL,
/* 100*/ 0x069af08dL,0xc127fd24L,0x0bc77b10L,0x5f03e7efL,0x453e99baL,
/* 105*/ 0xeed9ff7fL,0x87b55215L,0x7915ab4cL,0xd389a358L,0x5e75ce6dL,
/* 110*/ 0x28d655c0L,0xdad26c73L,0x2e2510ffL,0x9fa7eeccL,0x1d0629c3L,
/* 115*/ 0xdc9c9c46L,0x2d67ecd7L,0xe75e94bdL,0x3d649e2aL,0x6c413a2bL,
/* 120*/ 0x706f0d7cL,0xdfb0127bL,0x4e366b55L,0x2c825650L,0x24205720L,
/* 125*/ 0xb5c998f7L,0x3e95462cL,0x756e5c72L,0x3259488fL,0x11e8771aL,
/* 130*/ 0xa7c0a617L,0x577663e5L,0x089b6401L,0x8eab1941L,0xae55ef8cL,
/* 135*/ 0x3aac5460L,0xd4e6262fL,0x5d979a47L,0xb19823b0L,0x7f8d6a0cL,
/* 140*/ 0xffa08683L,0x0170cd0fL,0x858cd5d8L,0x53961c90L,0xc4c61556L,
/* 145*/ 0x41f2f226L,0xcfcd062dL,0xf24c03b8L,0xea81df5bL,0x7be2fa52L,
/* 150*/ 0xb361f98bL,0xc2901316L,0x55ba4bbcL,0x93b234a9L,0x0fbc6603L,
/* 155*/ 0x80a96822L,0x6d60491fL,0x22bd00f8L,0xbcad5aadL,0x52f3f13bL,
/* 160*/ 0x42fd2b28L,0xb41dd01cL,0xc52c93bfL,0xfc663094L,0x8f58d100L,
/* 165*/ 0x43fecc08L,0xc6331e5dL,0xe6480f66L,0xca847204L,0x4bdf1da0L,
/* 170*/ 0x30cc2efbL,0x13e02deaL,0xfb49ac45L,0xf9d4434fL,0xf47c5b9cL,
/* 175*/ 0x148879c2L,0x039fc234L,0xa3db9bfcL,0xd1a1dc5cL,0x763d7cd4L,
/* 180*/ 0xed6d2f93L,0xab13af6eL,0x1e8e054aL,0xd68f4f9aL,0xc30484b3L,
/* 185*/ 0xd7d50afaL,0x6930855fL,0xcc07db95L,0xce746db1L,0x744e967dL,
/* 190*/ 0xf16cf575L,0x8643e8b5L,0xf0eae38eL,0xe52de1d1L,0x6587dae0L,
/* 195*/ 0x0c4b8121L,0x1c7ac567L,0xac0db20aL,0x36c3a812L,0x5b1a4514L,
/* 200*/ 0xa9a3f868L,0xb9263baaL,0xcb3ce9d2L,0xe44fb1a4L,0x9221bc82L,
/* 205*/ 0xb29390feL,0x6ab41863L,0x974a3e2eL,0x89f531c5L,0x255ca13eL,
/* 210*/ 0x8b65d348L,0xec248f78L,0xd8fc16f0L,0x50ecdeeeL,0x09010792L,
/* 215*/ 0x3c7d1fb2L,0xeba5426bL,0x847b417aL,0x468b40d9L,0x8dc4e680L,
/* 220*/ 0x7cc1f391L,0x2f1eb086L,0x6e5baa6aL,0xe0b395daL,0xe31b2cf6L,
/* 225*/ 0xd9690b0dL,0x729ec464L,0x38403ddeL,0x610b80a2L,0x5cf433abL,
/* 230*/ 0xb0785fc4L,0xd512e4c6L,0xbbb7d699L,0x5a86591bL,0x10cf5376L,
/* 235*/ 0x12bf9f4bL,0x980fbaa1L,0x992a4e70L,0x20fa7ae7L,0xf7996ebbL,
/* 240*/ 0xc918a2beL,0x82de74f2L,0xad54209bL,0xf66b4d74L,0x1fc5b771L,
/* 245*/ 0x169d9229L,0x887761dfL,0x00b667d5L,0xdb425e59L,0xb72f2844L,
/* 250*/ 0x9b0ac1f5L,0x9c737e3aL,0x2b85476cL,0x6722add6L,0x44a63297L,
/* 255*/ 0x0d688cedL
/* End of S Box 13 */ },
{ /* Start of S Box 14 */
/* 0*/ 0xabc59484L,0x4107778aL,0x8ad94c6fL,0xfe83df90L,0x0f64053fL,
/* 5*/ 0xd1292e9dL,0xc5744356L,0x8dd1abb4L,0x4c4e7667L,0xfb4a7fc1L,
/* 10*/ 0x74f402cbL,0x70f06afdL,0xa82286f2L,0x918dd076L,0x7a97c5ceL,
/* 15*/ 0x48f7bde3L,0x6a04d11dL,0xac243ef7L,0x33ac10caL,0x2f7a341eL,
/* 20*/ 0x5f75157aL,0xf4773381L,0x591c870eL,0x78df8cc8L,0x22f3adb0L,
/* 25*/ 0x251a5993L,0x09fbef66L,0x796942a8L,0x97541d2eL,0x2373daa9L,
/* 30*/ 0x1bd2f142L,0xb57e8eb2L,0xe1a5bfdbL,0x7d0efa92L,0xb3442c94L,
/* 35*/ 0xd2cb6447L,0x386ac97eL,0x66d61805L,0xbdada15eL,0x11bc1aa7L,
/* 40*/ 0x14e9f6eaL,0xe533a0c0L,0xf935ee0aL,0x8fee8a04L,0x810d6d85L,
/* 45*/ 0x7c68b6d6L,0x4edc9aa2L,0x956e897dL,0xed87581aL,0x264be9d7L,
/* 50*/ 0xff4ddb29L,0x823857c2L,0xe005a9a0L,0xf1cc2450L,0x6f9951e1L,
/* 55*/ 0xaade2310L,0xe70c75f5L,0x83e1a31fL,0x4f7dde8eL,0xf723b563L,
/* 60*/ 0x368e0928L,0x86362b71L,0x21e8982dL,0xdfb3f92bL,0x44676352L,
/* 65*/ 0x99efba31L,0x2eab4e1cL,0xfc6ca5e7L,0x0ebe5d4eL,0xa0717d0cL,
/* 70*/ 0xb64f8199L,0x946b31a1L,0x5656cbc6L,0xcffec3efL,0x622766c9L,
/* 75*/ 0xfa211e35L,0x52f98b89L,0x6d01674bL,0x4978a802L,0xf651f701L,
/* 80*/ 0x15b0d43dL,0xd6ff4683L,0x3463855fL,0x672ba29cL,0xbc128312L,
/* 85*/ 0x4626a70dL,0xc8927a5aL,0xb8481cf9L,0x1c962262L,0xa21196baL,
/* 90*/ 0xbaba5ee9L,0x5bb162d0L,0x69943bd1L,0x0c47e35cL,0x8cc9619aL,
/* 95*/ 0xe284d948L,0x271bf264L,0xc27fb398L,0x4bc70897L,0x60cf202cL,
/* 100*/ 0x7f42d6aaL,0xa5a13506L,0x5d3e8860L,0xcea63d3cL,0x63bf0a8fL,
/* 105*/ 0xf02e9efaL,0xb17b0674L,0xb072b1d3L,0x06e5723bL,0x3737e436L,
/* 110*/ 0x24aa49c7L,0x0ded0d18L,0xdb256b14L,0x58b27877L,0xecb49f54L,
/* 115*/ 0x6c40256aL,0x6ea92ffbL,0x3906aa4cL,0xc9866fd5L,0x4549323eL,
/* 120*/ 0xa7b85fabL,0x1918cc27L,0x7308d7b5L,0x1e16c7adL,0x71850b37L,
/* 125*/ 0x3095fd78L,0xa63b70e6L,0xd880e2aeL,0x3e282769L,0xa39ba6bcL,
/* 130*/ 0x98700fa3L,0xf34c53e8L,0x288af426L,0xb99d930fL,0xf5b99df1L,
/* 135*/ 0xe9d0c8cfL,0x5ac8405dL,0x50e7217bL,0x511fbbbeL,0x2ca2e639L,
/* 140*/ 0xc020301bL,0x356dbc00L,0x8e43ddb9L,0x4d327b4aL,0xf20ff3edL,
/* 145*/ 0x1dbb29bdL,0x43d44779L,0xa1b68f70L,0x6114455bL,0xe63d280bL,
/* 150*/ 0x6bf6ff65L,0x10fc39e5L,0x3dae126eL,0xc1d7cf11L,0xcb60b795L,
/* 155*/ 0x1789d5b3L,0x9bca36b7L,0x08306075L,0x84615608L,0x8b3a0186L,
/* 160*/ 0xe88fbecdL,0x7ba47c4dL,0x2de44dacL,0x653fe58dL,0xcca0b968L,
/* 165*/ 0xd7fa0e72L,0x93901780L,0x1f2c26ccL,0xae595b6bL,0xa9ecea9bL,
/* 170*/ 0xe3dbf8c4L,0x319cc130L,0x12981196L,0x01a3a4deL,0x32c454b6L,
/* 175*/ 0x755bd817L,0x3cd871e4L,0xa48bb8daL,0x02fdec09L,0xfd2dc2e2L,
/* 180*/ 0x9e578088L,0x9a9f916dL,0x4065fe6cL,0x1853999eL,0xc7793f23L,
/* 185*/ 0xdc1016bbL,0x969355ffL,0x7ef292f6L,0xcdce4adcL,0x05e24416L,
/* 190*/ 0x85c16c46L,0xd441d37fL,0x57bd6855L,0x8746f54fL,0x9ca773dfL,
/* 195*/ 0x770bae22L,0x54828413L,0xb75e4b19L,0x04c35c03L,0xbf7cca07L,
/* 200*/ 0x2955c4ddL,0x721db041L,0xb2394f33L,0x03f51387L,0x89b73c9fL,
/* 205*/ 0x0b1737f3L,0x07e69024L,0x9231d245L,0x76193861L,0x88159c15L,
/* 210*/ 0xdeb552d9L,0xd9767e40L,0x20c6c0c3L,0x4281977cL,0xf8afe1e0L,
/* 215*/ 0xd32a0751L,0x3fc27432L,0xddf1dcc5L,0x68581f34L,0x3bcd5025L,
/* 220*/ 0x0091b2eeL,0x4aeb6944L,0x1602e743L,0xea09eb58L,0xef0a2a8bL,
/* 225*/ 0x641e03a5L,0xeb50e021L,0x5c8ccef8L,0x802ff0b8L,0xd5e3edfeL,
/* 230*/ 0xc4dd1b49L,0x5334cd2aL,0x13f82d2fL,0x47450c20L,0x55dafbd2L,
/* 235*/ 0xbec0c6f4L,0xb45d7959L,0x3ad36e8cL,0x0aa8ac57L,0x1a3c8d73L,
/* 240*/ 0xe45aafb1L,0x9f664838L,0xc6880053L,0xd0039bbfL,0xee5f19ebL,
/* 245*/ 0xca0041d8L,0xbbea3aafL,0xda628291L,0x9d5c95d4L,0xadd504a6L,
/* 250*/ 0xc39ab482L,0x5e9e14a4L,0x2be065f0L,0x2a13fc3aL,0x9052e8ecL,
/* 255*/ 0xaf6f5afcL
/* End of S Box 14 */ },
{ /* Start of S Box 15 */
/* 0*/ 0x519aa8b5L,0xbb303da9L,0xe00e2b10L,0xdfa6c1dbL,0x2e6b952eL,
/* 5*/ 0xee10dc23L,0x37936d09L,0x1fc42e92L,0x39b25a9fL,0x13ff89f4L,
/* 10*/ 0xc8f53feaL,0x18500bc7L,0x95a0379dL,0x98f751c2L,0x2289c42fL,
/* 15*/ 0xa21e4098L,0x6f391f41L,0xf27e7e58L,0x0d0df887L,0x4b79d540L,
/* 20*/ 0x8e8409aaL,0x71fe46f8L,0x688a9b29L,0x3f08b548L,0x84abe03aL,
/* 25*/ 0x5e91b6c1L,0xfde4c2aeL,0x251d0e72L,0x92d4fee5L,0xf9371967L,
/* 30*/ 0x9175108fL,0xe6e81835L,0x8c8cb8eeL,0xb55a67b3L,0xcef138ccL,
/* 35*/ 0x8b256268L,0x00d815f5L,0xe8810812L,0x77826189L,0xea73267dL,
/* 40*/ 0x19b90f8dL,0x45c33bb4L,0x82477056L,0xe1770075L,0x09467aa6L,
/* 45*/ 0xa7c6f54aL,0x79768742L,0x61b86bcaL,0xd6644a44L,0xe33f0171L,
/* 50*/ 0xc229fbcdL,0x41b08febL,0xd1903e30L,0x65ec9080L,0x563d6fbdL,
/* 55*/ 0xf56da488L,0xebf64cd8L,0x4934426bL,0x7c8592fcL,0x6aca8cf2L,
/* 60*/ 0x1cea111bL,0x3a57ee7aL,0xace11c0dL,0x9942d85eL,0xc4613407L,
/* 65*/ 0xfa8e643bL,0x327fc701L,0x4ca9be82L,0x3352526dL,0x2c047f63L,
/* 70*/ 0xf3a8f7ddL,0x1a4a98a8L,0x762ed4d1L,0x27c75008L,0xbdf497c0L,
/* 75*/ 0x7a7b84dfL,0x315c28abL,0x801f93e3L,0xf19b0ca1L,0x8f14e46aL,
/* 80*/ 0xe48ba333L,0x9605e625L,0xf03ecb60L,0x60385f2dL,0x902845baL,
/* 85*/ 0x7f96d66fL,0x24bff05cL,0x2820730bL,0x947133cbL,0xd444828aL,
/* 90*/ 0xb343f6f1L,0x0bef4705L,0x8da574f9L,0x01e25d6cL,0x1732793eL,
/* 95*/ 0x4f0f7b27L,0x364b7117L,0xb2d1da77L,0xa6c5f1e9L,0x574ca5b1L,
/* 100*/ 0x386a3076L,0xad6894d6L,0x1156d7faL,0xa48d1d9aL,0x4794c0afL,
/* 105*/ 0x150c0aa0L,0x26d348acL,0x29fdeabeL,0xa5dede53L,0x81671e8eL,
/* 110*/ 0x594ee3bfL,0xa96c56e6L,0x3426a726L,0xc5976579L,0xbc22e5e4L,
/* 115*/ 0xc1006319L,0xdaafdd2aL,0xa1a1aa83L,0x3badd0e7L,0xc3b14981L,
/* 120*/ 0xd770b155L,0xccd7c693L,0x42e944c5L,0x03e0064fL,0xca95b4efL,
/* 125*/ 0x3dee81c3L,0xfbbcd98cL,0x1e07e15bL,0x667ce949L,0xe7d6773fL,
/* 130*/ 0x21b6124bL,0x6b2a6ef7L,0xd3278a9cL,0x9a988304L,0x75d2ae9bL,
/* 135*/ 0xfe49e2ffL,0x9bc24f46L,0x74cc2cf6L,0xa3139f36L,0x6c9ef35aL,
/* 140*/ 0x9fc1dffeL,0x9e5facdcL,0xaadc8bbbL,0x5abdbc5fL,0x44b3b390L,
/* 145*/ 0xf754efa7L,0x5fe3bdb7L,0x4e59c886L,0x06a4c984L,0xa0338878L,
/* 150*/ 0xcd513cd7L,0x63ebd27eL,0x8aba80adL,0x50da144eL,0x5d9f4e97L,
/* 155*/ 0x025b751cL,0x2d580200L,0xb6c05837L,0x580aa15dL,0x54022a6eL,
/* 160*/ 0xb41a5415L,0x4863fab6L,0xb0b79957L,0x46d0d159L,0xdc2b8650L,
/* 165*/ 0x20a7bb0cL,0x4a032974L,0xec8636a2L,0x8548f24cL,0xf6a2bf16L,
/* 170*/ 0x1088f4b0L,0x0c2f3a94L,0x525dc396L,0x14065785L,0x2b4dca52L,
/* 175*/ 0x08aeed39L,0xabedfc99L,0xb1dbcf18L,0x87f85bbcL,0xae3aff61L,
/* 180*/ 0x433ccd70L,0x5b23cc64L,0x7b453213L,0x5355c545L,0x9318ec0aL,
/* 185*/ 0x78692d31L,0x0a21693dL,0xd5666814L,0x05fb59d9L,0xc71985b2L,
/* 190*/ 0x2abb8e0eL,0xcf6e6c91L,0xd9cfe7c6L,0xefe7132cL,0x9711ab28L,
/* 195*/ 0x3ce52732L,0x12d516d2L,0x7209a0d0L,0xd278d306L,0x70fa4b7bL,
/* 200*/ 0x1d407dd3L,0xdb0beba4L,0xbfd97621L,0xa8be21e1L,0x1b6f1b66L,
/* 205*/ 0x30650ddaL,0xba7ddbb9L,0x7df953fbL,0x9d1c3902L,0xedf0e8d5L,
/* 210*/ 0xb8741ae0L,0x0f240565L,0x62cd438bL,0xc616a924L,0xaf7a96a3L,
/* 215*/ 0x35365538L,0xe583af4dL,0x73415eb8L,0x23176a47L,0xfc9ccee8L,
/* 220*/ 0x7efc9de2L,0x695e03cfL,0xf8ce66d4L,0x88b4781dL,0x67dd9c03L,
/* 225*/ 0x3e8f9e73L,0xc0c95c51L,0xbe314d22L,0x55aa0795L,0xcb1bb011L,
/* 230*/ 0xe980fdc8L,0x9c62b7ceL,0xde2d239eL,0x042cadf3L,0xffdf04deL,
/* 235*/ 0x5ce6a60fL,0xd8c831edL,0xb7b5b9ecL,0xb9cbf962L,0xe253b254L,
/* 240*/ 0x0735ba1fL,0x16ac917fL,0xdd607c2bL,0x64a335c4L,0x40159a7cL,
/* 245*/ 0x869222f0L,0x6ef21769L,0x839d20a5L,0xd03b24c9L,0xf412601eL,
/* 250*/ 0x6d72a243L,0x0e018dfdL,0x89f3721aL,0xc94f4134L,0x2f992f20L,
/* 255*/ 0x4d87253cL
/* End of S Box 15 */ }
};
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: sw=4 ts=4 fdm=marker
* vim<600: sw=4 ts=4
*/
-49
View File
@@ -1,49 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2005 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Michael Wallner <mike@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef PHP_HASH_TIGER_H
#define PHP_HASH_TIGER_H
/* TIGER context */
typedef struct {
php_hash_uint64 state[3];
php_hash_uint64 passed;
unsigned char passes:1;
unsigned char length:7;
unsigned char buffer[64];
} PHP_TIGER_CTX;
PHP_HASH_API void PHP_3TIGERInit(PHP_TIGER_CTX *context);
PHP_HASH_API void PHP_4TIGERInit(PHP_TIGER_CTX *context);
PHP_HASH_API void PHP_TIGERUpdate(PHP_TIGER_CTX *context, const unsigned char *input, size_t len);
PHP_HASH_API void PHP_TIGER128Final(unsigned char digest[16], PHP_TIGER_CTX *context);
PHP_HASH_API void PHP_TIGER160Final(unsigned char digest[20], PHP_TIGER_CTX *context);
PHP_HASH_API void PHP_TIGER192Final(unsigned char digest[24], PHP_TIGER_CTX *context);
#endif
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: sw=4 ts=4 fdm=marker
* vim<600: sw=4 ts=4
*/
-549
View File
@@ -1,549 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2005 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Michael Wallner <mike@php.net> |
| Sara Golemon <pollita@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#define t1 (table)
#define t2 (table+256)
#define t3 (table+256*2)
#define t4 (table+256*3)
static const php_hash_uint64 table[4*256] = {
L64(0x02AAB17CF7E90C5E) /* 0 */, L64(0xAC424B03E243A8EC) /* 1 */,
L64(0x72CD5BE30DD5FCD3) /* 2 */, L64(0x6D019B93F6F97F3A) /* 3 */,
L64(0xCD9978FFD21F9193) /* 4 */, L64(0x7573A1C9708029E2) /* 5 */,
L64(0xB164326B922A83C3) /* 6 */, L64(0x46883EEE04915870) /* 7 */,
L64(0xEAACE3057103ECE6) /* 8 */, L64(0xC54169B808A3535C) /* 9 */,
L64(0x4CE754918DDEC47C) /* 10 */, L64(0x0AA2F4DFDC0DF40C) /* 11 */,
L64(0x10B76F18A74DBEFA) /* 12 */, L64(0xC6CCB6235AD1AB6A) /* 13 */,
L64(0x13726121572FE2FF) /* 14 */, L64(0x1A488C6F199D921E) /* 15 */,
L64(0x4BC9F9F4DA0007CA) /* 16 */, L64(0x26F5E6F6E85241C7) /* 17 */,
L64(0x859079DBEA5947B6) /* 18 */, L64(0x4F1885C5C99E8C92) /* 19 */,
L64(0xD78E761EA96F864B) /* 20 */, L64(0x8E36428C52B5C17D) /* 21 */,
L64(0x69CF6827373063C1) /* 22 */, L64(0xB607C93D9BB4C56E) /* 23 */,
L64(0x7D820E760E76B5EA) /* 24 */, L64(0x645C9CC6F07FDC42) /* 25 */,
L64(0xBF38A078243342E0) /* 26 */, L64(0x5F6B343C9D2E7D04) /* 27 */,
L64(0xF2C28AEB600B0EC6) /* 28 */, L64(0x6C0ED85F7254BCAC) /* 29 */,
L64(0x71592281A4DB4FE5) /* 30 */, L64(0x1967FA69CE0FED9F) /* 31 */,
L64(0xFD5293F8B96545DB) /* 32 */, L64(0xC879E9D7F2A7600B) /* 33 */,
L64(0x860248920193194E) /* 34 */, L64(0xA4F9533B2D9CC0B3) /* 35 */,
L64(0x9053836C15957613) /* 36 */, L64(0xDB6DCF8AFC357BF1) /* 37 */,
L64(0x18BEEA7A7A370F57) /* 38 */, L64(0x037117CA50B99066) /* 39 */,
L64(0x6AB30A9774424A35) /* 40 */, L64(0xF4E92F02E325249B) /* 41 */,
L64(0x7739DB07061CCAE1) /* 42 */, L64(0xD8F3B49CECA42A05) /* 43 */,
L64(0xBD56BE3F51382F73) /* 44 */, L64(0x45FAED5843B0BB28) /* 45 */,
L64(0x1C813D5C11BF1F83) /* 46 */, L64(0x8AF0E4B6D75FA169) /* 47 */,
L64(0x33EE18A487AD9999) /* 48 */, L64(0x3C26E8EAB1C94410) /* 49 */,
L64(0xB510102BC0A822F9) /* 50 */, L64(0x141EEF310CE6123B) /* 51 */,
L64(0xFC65B90059DDB154) /* 52 */, L64(0xE0158640C5E0E607) /* 53 */,
L64(0x884E079826C3A3CF) /* 54 */, L64(0x930D0D9523C535FD) /* 55 */,
L64(0x35638D754E9A2B00) /* 56 */, L64(0x4085FCCF40469DD5) /* 57 */,
L64(0xC4B17AD28BE23A4C) /* 58 */, L64(0xCAB2F0FC6A3E6A2E) /* 59 */,
L64(0x2860971A6B943FCD) /* 60 */, L64(0x3DDE6EE212E30446) /* 61 */,
L64(0x6222F32AE01765AE) /* 62 */, L64(0x5D550BB5478308FE) /* 63 */,
L64(0xA9EFA98DA0EDA22A) /* 64 */, L64(0xC351A71686C40DA7) /* 65 */,
L64(0x1105586D9C867C84) /* 66 */, L64(0xDCFFEE85FDA22853) /* 67 */,
L64(0xCCFBD0262C5EEF76) /* 68 */, L64(0xBAF294CB8990D201) /* 69 */,
L64(0xE69464F52AFAD975) /* 70 */, L64(0x94B013AFDF133E14) /* 71 */,
L64(0x06A7D1A32823C958) /* 72 */, L64(0x6F95FE5130F61119) /* 73 */,
L64(0xD92AB34E462C06C0) /* 74 */, L64(0xED7BDE33887C71D2) /* 75 */,
L64(0x79746D6E6518393E) /* 76 */, L64(0x5BA419385D713329) /* 77 */,
L64(0x7C1BA6B948A97564) /* 78 */, L64(0x31987C197BFDAC67) /* 79 */,
L64(0xDE6C23C44B053D02) /* 80 */, L64(0x581C49FED002D64D) /* 81 */,
L64(0xDD474D6338261571) /* 82 */, L64(0xAA4546C3E473D062) /* 83 */,
L64(0x928FCE349455F860) /* 84 */, L64(0x48161BBACAAB94D9) /* 85 */,
L64(0x63912430770E6F68) /* 86 */, L64(0x6EC8A5E602C6641C) /* 87 */,
L64(0x87282515337DDD2B) /* 88 */, L64(0x2CDA6B42034B701B) /* 89 */,
L64(0xB03D37C181CB096D) /* 90 */, L64(0xE108438266C71C6F) /* 91 */,
L64(0x2B3180C7EB51B255) /* 92 */, L64(0xDF92B82F96C08BBC) /* 93 */,
L64(0x5C68C8C0A632F3BA) /* 94 */, L64(0x5504CC861C3D0556) /* 95 */,
L64(0xABBFA4E55FB26B8F) /* 96 */, L64(0x41848B0AB3BACEB4) /* 97 */,
L64(0xB334A273AA445D32) /* 98 */, L64(0xBCA696F0A85AD881) /* 99 */,
L64(0x24F6EC65B528D56C) /* 100 */, L64(0x0CE1512E90F4524A) /* 101 */,
L64(0x4E9DD79D5506D35A) /* 102 */, L64(0x258905FAC6CE9779) /* 103 */,
L64(0x2019295B3E109B33) /* 104 */, L64(0xF8A9478B73A054CC) /* 105 */,
L64(0x2924F2F934417EB0) /* 106 */, L64(0x3993357D536D1BC4) /* 107 */,
L64(0x38A81AC21DB6FF8B) /* 108 */, L64(0x47C4FBF17D6016BF) /* 109 */,
L64(0x1E0FAADD7667E3F5) /* 110 */, L64(0x7ABCFF62938BEB96) /* 111 */,
L64(0xA78DAD948FC179C9) /* 112 */, L64(0x8F1F98B72911E50D) /* 113 */,
L64(0x61E48EAE27121A91) /* 114 */, L64(0x4D62F7AD31859808) /* 115 */,
L64(0xECEBA345EF5CEAEB) /* 116 */, L64(0xF5CEB25EBC9684CE) /* 117 */,
L64(0xF633E20CB7F76221) /* 118 */, L64(0xA32CDF06AB8293E4) /* 119 */,
L64(0x985A202CA5EE2CA4) /* 120 */, L64(0xCF0B8447CC8A8FB1) /* 121 */,
L64(0x9F765244979859A3) /* 122 */, L64(0xA8D516B1A1240017) /* 123 */,
L64(0x0BD7BA3EBB5DC726) /* 124 */, L64(0xE54BCA55B86ADB39) /* 125 */,
L64(0x1D7A3AFD6C478063) /* 126 */, L64(0x519EC608E7669EDD) /* 127 */,
L64(0x0E5715A2D149AA23) /* 128 */, L64(0x177D4571848FF194) /* 129 */,
L64(0xEEB55F3241014C22) /* 130 */, L64(0x0F5E5CA13A6E2EC2) /* 131 */,
L64(0x8029927B75F5C361) /* 132 */, L64(0xAD139FABC3D6E436) /* 133 */,
L64(0x0D5DF1A94CCF402F) /* 134 */, L64(0x3E8BD948BEA5DFC8) /* 135 */,
L64(0xA5A0D357BD3FF77E) /* 136 */, L64(0xA2D12E251F74F645) /* 137 */,
L64(0x66FD9E525E81A082) /* 138 */, L64(0x2E0C90CE7F687A49) /* 139 */,
L64(0xC2E8BCBEBA973BC5) /* 140 */, L64(0x000001BCE509745F) /* 141 */,
L64(0x423777BBE6DAB3D6) /* 142 */, L64(0xD1661C7EAEF06EB5) /* 143 */,
L64(0xA1781F354DAACFD8) /* 144 */, L64(0x2D11284A2B16AFFC) /* 145 */,
L64(0xF1FC4F67FA891D1F) /* 146 */, L64(0x73ECC25DCB920ADA) /* 147 */,
L64(0xAE610C22C2A12651) /* 148 */, L64(0x96E0A810D356B78A) /* 149 */,
L64(0x5A9A381F2FE7870F) /* 150 */, L64(0xD5AD62EDE94E5530) /* 151 */,
L64(0xD225E5E8368D1427) /* 152 */, L64(0x65977B70C7AF4631) /* 153 */,
L64(0x99F889B2DE39D74F) /* 154 */, L64(0x233F30BF54E1D143) /* 155 */,
L64(0x9A9675D3D9A63C97) /* 156 */, L64(0x5470554FF334F9A8) /* 157 */,
L64(0x166ACB744A4F5688) /* 158 */, L64(0x70C74CAAB2E4AEAD) /* 159 */,
L64(0xF0D091646F294D12) /* 160 */, L64(0x57B82A89684031D1) /* 161 */,
L64(0xEFD95A5A61BE0B6B) /* 162 */, L64(0x2FBD12E969F2F29A) /* 163 */,
L64(0x9BD37013FEFF9FE8) /* 164 */, L64(0x3F9B0404D6085A06) /* 165 */,
L64(0x4940C1F3166CFE15) /* 166 */, L64(0x09542C4DCDF3DEFB) /* 167 */,
L64(0xB4C5218385CD5CE3) /* 168 */, L64(0xC935B7DC4462A641) /* 169 */,
L64(0x3417F8A68ED3B63F) /* 170 */, L64(0xB80959295B215B40) /* 171 */,
L64(0xF99CDAEF3B8C8572) /* 172 */, L64(0x018C0614F8FCB95D) /* 173 */,
L64(0x1B14ACCD1A3ACDF3) /* 174 */, L64(0x84D471F200BB732D) /* 175 */,
L64(0xC1A3110E95E8DA16) /* 176 */, L64(0x430A7220BF1A82B8) /* 177 */,
L64(0xB77E090D39DF210E) /* 178 */, L64(0x5EF4BD9F3CD05E9D) /* 179 */,
L64(0x9D4FF6DA7E57A444) /* 180 */, L64(0xDA1D60E183D4A5F8) /* 181 */,
L64(0xB287C38417998E47) /* 182 */, L64(0xFE3EDC121BB31886) /* 183 */,
L64(0xC7FE3CCC980CCBEF) /* 184 */, L64(0xE46FB590189BFD03) /* 185 */,
L64(0x3732FD469A4C57DC) /* 186 */, L64(0x7EF700A07CF1AD65) /* 187 */,
L64(0x59C64468A31D8859) /* 188 */, L64(0x762FB0B4D45B61F6) /* 189 */,
L64(0x155BAED099047718) /* 190 */, L64(0x68755E4C3D50BAA6) /* 191 */,
L64(0xE9214E7F22D8B4DF) /* 192 */, L64(0x2ADDBF532EAC95F4) /* 193 */,
L64(0x32AE3909B4BD0109) /* 194 */, L64(0x834DF537B08E3450) /* 195 */,
L64(0xFA209DA84220728D) /* 196 */, L64(0x9E691D9B9EFE23F7) /* 197 */,
L64(0x0446D288C4AE8D7F) /* 198 */, L64(0x7B4CC524E169785B) /* 199 */,
L64(0x21D87F0135CA1385) /* 200 */, L64(0xCEBB400F137B8AA5) /* 201 */,
L64(0x272E2B66580796BE) /* 202 */, L64(0x3612264125C2B0DE) /* 203 */,
L64(0x057702BDAD1EFBB2) /* 204 */, L64(0xD4BABB8EACF84BE9) /* 205 */,
L64(0x91583139641BC67B) /* 206 */, L64(0x8BDC2DE08036E024) /* 207 */,
L64(0x603C8156F49F68ED) /* 208 */, L64(0xF7D236F7DBEF5111) /* 209 */,
L64(0x9727C4598AD21E80) /* 210 */, L64(0xA08A0896670A5FD7) /* 211 */,
L64(0xCB4A8F4309EBA9CB) /* 212 */, L64(0x81AF564B0F7036A1) /* 213 */,
L64(0xC0B99AA778199ABD) /* 214 */, L64(0x959F1EC83FC8E952) /* 215 */,
L64(0x8C505077794A81B9) /* 216 */, L64(0x3ACAAF8F056338F0) /* 217 */,
L64(0x07B43F50627A6778) /* 218 */, L64(0x4A44AB49F5ECCC77) /* 219 */,
L64(0x3BC3D6E4B679EE98) /* 220 */, L64(0x9CC0D4D1CF14108C) /* 221 */,
L64(0x4406C00B206BC8A0) /* 222 */, L64(0x82A18854C8D72D89) /* 223 */,
L64(0x67E366B35C3C432C) /* 224 */, L64(0xB923DD61102B37F2) /* 225 */,
L64(0x56AB2779D884271D) /* 226 */, L64(0xBE83E1B0FF1525AF) /* 227 */,
L64(0xFB7C65D4217E49A9) /* 228 */, L64(0x6BDBE0E76D48E7D4) /* 229 */,
L64(0x08DF828745D9179E) /* 230 */, L64(0x22EA6A9ADD53BD34) /* 231 */,
L64(0xE36E141C5622200A) /* 232 */, L64(0x7F805D1B8CB750EE) /* 233 */,
L64(0xAFE5C7A59F58E837) /* 234 */, L64(0xE27F996A4FB1C23C) /* 235 */,
L64(0xD3867DFB0775F0D0) /* 236 */, L64(0xD0E673DE6E88891A) /* 237 */,
L64(0x123AEB9EAFB86C25) /* 238 */, L64(0x30F1D5D5C145B895) /* 239 */,
L64(0xBB434A2DEE7269E7) /* 240 */, L64(0x78CB67ECF931FA38) /* 241 */,
L64(0xF33B0372323BBF9C) /* 242 */, L64(0x52D66336FB279C74) /* 243 */,
L64(0x505F33AC0AFB4EAA) /* 244 */, L64(0xE8A5CD99A2CCE187) /* 245 */,
L64(0x534974801E2D30BB) /* 246 */, L64(0x8D2D5711D5876D90) /* 247 */,
L64(0x1F1A412891BC038E) /* 248 */, L64(0xD6E2E71D82E56648) /* 249 */,
L64(0x74036C3A497732B7) /* 250 */, L64(0x89B67ED96361F5AB) /* 251 */,
L64(0xFFED95D8F1EA02A2) /* 252 */, L64(0xE72B3BD61464D43D) /* 253 */,
L64(0xA6300F170BDC4820) /* 254 */, L64(0xEBC18760ED78A77A) /* 255 */,
L64(0xE6A6BE5A05A12138) /* 256 */, L64(0xB5A122A5B4F87C98) /* 257 */,
L64(0x563C6089140B6990) /* 258 */, L64(0x4C46CB2E391F5DD5) /* 259 */,
L64(0xD932ADDBC9B79434) /* 260 */, L64(0x08EA70E42015AFF5) /* 261 */,
L64(0xD765A6673E478CF1) /* 262 */, L64(0xC4FB757EAB278D99) /* 263 */,
L64(0xDF11C6862D6E0692) /* 264 */, L64(0xDDEB84F10D7F3B16) /* 265 */,
L64(0x6F2EF604A665EA04) /* 266 */, L64(0x4A8E0F0FF0E0DFB3) /* 267 */,
L64(0xA5EDEEF83DBCBA51) /* 268 */, L64(0xFC4F0A2A0EA4371E) /* 269 */,
L64(0xE83E1DA85CB38429) /* 270 */, L64(0xDC8FF882BA1B1CE2) /* 271 */,
L64(0xCD45505E8353E80D) /* 272 */, L64(0x18D19A00D4DB0717) /* 273 */,
L64(0x34A0CFEDA5F38101) /* 274 */, L64(0x0BE77E518887CAF2) /* 275 */,
L64(0x1E341438B3C45136) /* 276 */, L64(0xE05797F49089CCF9) /* 277 */,
L64(0xFFD23F9DF2591D14) /* 278 */, L64(0x543DDA228595C5CD) /* 279 */,
L64(0x661F81FD99052A33) /* 280 */, L64(0x8736E641DB0F7B76) /* 281 */,
L64(0x15227725418E5307) /* 282 */, L64(0xE25F7F46162EB2FA) /* 283 */,
L64(0x48A8B2126C13D9FE) /* 284 */, L64(0xAFDC541792E76EEA) /* 285 */,
L64(0x03D912BFC6D1898F) /* 286 */, L64(0x31B1AAFA1B83F51B) /* 287 */,
L64(0xF1AC2796E42AB7D9) /* 288 */, L64(0x40A3A7D7FCD2EBAC) /* 289 */,
L64(0x1056136D0AFBBCC5) /* 290 */, L64(0x7889E1DD9A6D0C85) /* 291 */,
L64(0xD33525782A7974AA) /* 292 */, L64(0xA7E25D09078AC09B) /* 293 */,
L64(0xBD4138B3EAC6EDD0) /* 294 */, L64(0x920ABFBE71EB9E70) /* 295 */,
L64(0xA2A5D0F54FC2625C) /* 296 */, L64(0xC054E36B0B1290A3) /* 297 */,
L64(0xF6DD59FF62FE932B) /* 298 */, L64(0x3537354511A8AC7D) /* 299 */,
L64(0xCA845E9172FADCD4) /* 300 */, L64(0x84F82B60329D20DC) /* 301 */,
L64(0x79C62CE1CD672F18) /* 302 */, L64(0x8B09A2ADD124642C) /* 303 */,
L64(0xD0C1E96A19D9E726) /* 304 */, L64(0x5A786A9B4BA9500C) /* 305 */,
L64(0x0E020336634C43F3) /* 306 */, L64(0xC17B474AEB66D822) /* 307 */,
L64(0x6A731AE3EC9BAAC2) /* 308 */, L64(0x8226667AE0840258) /* 309 */,
L64(0x67D4567691CAECA5) /* 310 */, L64(0x1D94155C4875ADB5) /* 311 */,
L64(0x6D00FD985B813FDF) /* 312 */, L64(0x51286EFCB774CD06) /* 313 */,
L64(0x5E8834471FA744AF) /* 314 */, L64(0xF72CA0AEE761AE2E) /* 315 */,
L64(0xBE40E4CDAEE8E09A) /* 316 */, L64(0xE9970BBB5118F665) /* 317 */,
L64(0x726E4BEB33DF1964) /* 318 */, L64(0x703B000729199762) /* 319 */,
L64(0x4631D816F5EF30A7) /* 320 */, L64(0xB880B5B51504A6BE) /* 321 */,
L64(0x641793C37ED84B6C) /* 322 */, L64(0x7B21ED77F6E97D96) /* 323 */,
L64(0x776306312EF96B73) /* 324 */, L64(0xAE528948E86FF3F4) /* 325 */,
L64(0x53DBD7F286A3F8F8) /* 326 */, L64(0x16CADCE74CFC1063) /* 327 */,
L64(0x005C19BDFA52C6DD) /* 328 */, L64(0x68868F5D64D46AD3) /* 329 */,
L64(0x3A9D512CCF1E186A) /* 330 */, L64(0x367E62C2385660AE) /* 331 */,
L64(0xE359E7EA77DCB1D7) /* 332 */, L64(0x526C0773749ABE6E) /* 333 */,
L64(0x735AE5F9D09F734B) /* 334 */, L64(0x493FC7CC8A558BA8) /* 335 */,
L64(0xB0B9C1533041AB45) /* 336 */, L64(0x321958BA470A59BD) /* 337 */,
L64(0x852DB00B5F46C393) /* 338 */, L64(0x91209B2BD336B0E5) /* 339 */,
L64(0x6E604F7D659EF19F) /* 340 */, L64(0xB99A8AE2782CCB24) /* 341 */,
L64(0xCCF52AB6C814C4C7) /* 342 */, L64(0x4727D9AFBE11727B) /* 343 */,
L64(0x7E950D0C0121B34D) /* 344 */, L64(0x756F435670AD471F) /* 345 */,
L64(0xF5ADD442615A6849) /* 346 */, L64(0x4E87E09980B9957A) /* 347 */,
L64(0x2ACFA1DF50AEE355) /* 348 */, L64(0xD898263AFD2FD556) /* 349 */,
L64(0xC8F4924DD80C8FD6) /* 350 */, L64(0xCF99CA3D754A173A) /* 351 */,
L64(0xFE477BACAF91BF3C) /* 352 */, L64(0xED5371F6D690C12D) /* 353 */,
L64(0x831A5C285E687094) /* 354 */, L64(0xC5D3C90A3708A0A4) /* 355 */,
L64(0x0F7F903717D06580) /* 356 */, L64(0x19F9BB13B8FDF27F) /* 357 */,
L64(0xB1BD6F1B4D502843) /* 358 */, L64(0x1C761BA38FFF4012) /* 359 */,
L64(0x0D1530C4E2E21F3B) /* 360 */, L64(0x8943CE69A7372C8A) /* 361 */,
L64(0xE5184E11FEB5CE66) /* 362 */, L64(0x618BDB80BD736621) /* 363 */,
L64(0x7D29BAD68B574D0B) /* 364 */, L64(0x81BB613E25E6FE5B) /* 365 */,
L64(0x071C9C10BC07913F) /* 366 */, L64(0xC7BEEB7909AC2D97) /* 367 */,
L64(0xC3E58D353BC5D757) /* 368 */, L64(0xEB017892F38F61E8) /* 369 */,
L64(0xD4EFFB9C9B1CC21A) /* 370 */, L64(0x99727D26F494F7AB) /* 371 */,
L64(0xA3E063A2956B3E03) /* 372 */, L64(0x9D4A8B9A4AA09C30) /* 373 */,
L64(0x3F6AB7D500090FB4) /* 374 */, L64(0x9CC0F2A057268AC0) /* 375 */,
L64(0x3DEE9D2DEDBF42D1) /* 376 */, L64(0x330F49C87960A972) /* 377 */,
L64(0xC6B2720287421B41) /* 378 */, L64(0x0AC59EC07C00369C) /* 379 */,
L64(0xEF4EAC49CB353425) /* 380 */, L64(0xF450244EEF0129D8) /* 381 */,
L64(0x8ACC46E5CAF4DEB6) /* 382 */, L64(0x2FFEAB63989263F7) /* 383 */,
L64(0x8F7CB9FE5D7A4578) /* 384 */, L64(0x5BD8F7644E634635) /* 385 */,
L64(0x427A7315BF2DC900) /* 386 */, L64(0x17D0C4AA2125261C) /* 387 */,
L64(0x3992486C93518E50) /* 388 */, L64(0xB4CBFEE0A2D7D4C3) /* 389 */,
L64(0x7C75D6202C5DDD8D) /* 390 */, L64(0xDBC295D8E35B6C61) /* 391 */,
L64(0x60B369D302032B19) /* 392 */, L64(0xCE42685FDCE44132) /* 393 */,
L64(0x06F3DDB9DDF65610) /* 394 */, L64(0x8EA4D21DB5E148F0) /* 395 */,
L64(0x20B0FCE62FCD496F) /* 396 */, L64(0x2C1B912358B0EE31) /* 397 */,
L64(0xB28317B818F5A308) /* 398 */, L64(0xA89C1E189CA6D2CF) /* 399 */,
L64(0x0C6B18576AAADBC8) /* 400 */, L64(0xB65DEAA91299FAE3) /* 401 */,
L64(0xFB2B794B7F1027E7) /* 402 */, L64(0x04E4317F443B5BEB) /* 403 */,
L64(0x4B852D325939D0A6) /* 404 */, L64(0xD5AE6BEEFB207FFC) /* 405 */,
L64(0x309682B281C7D374) /* 406 */, L64(0xBAE309A194C3B475) /* 407 */,
L64(0x8CC3F97B13B49F05) /* 408 */, L64(0x98A9422FF8293967) /* 409 */,
L64(0x244B16B01076FF7C) /* 410 */, L64(0xF8BF571C663D67EE) /* 411 */,
L64(0x1F0D6758EEE30DA1) /* 412 */, L64(0xC9B611D97ADEB9B7) /* 413 */,
L64(0xB7AFD5887B6C57A2) /* 414 */, L64(0x6290AE846B984FE1) /* 415 */,
L64(0x94DF4CDEACC1A5FD) /* 416 */, L64(0x058A5BD1C5483AFF) /* 417 */,
L64(0x63166CC142BA3C37) /* 418 */, L64(0x8DB8526EB2F76F40) /* 419 */,
L64(0xE10880036F0D6D4E) /* 420 */, L64(0x9E0523C9971D311D) /* 421 */,
L64(0x45EC2824CC7CD691) /* 422 */, L64(0x575B8359E62382C9) /* 423 */,
L64(0xFA9E400DC4889995) /* 424 */, L64(0xD1823ECB45721568) /* 425 */,
L64(0xDAFD983B8206082F) /* 426 */, L64(0xAA7D29082386A8CB) /* 427 */,
L64(0x269FCD4403B87588) /* 428 */, L64(0x1B91F5F728BDD1E0) /* 429 */,
L64(0xE4669F39040201F6) /* 430 */, L64(0x7A1D7C218CF04ADE) /* 431 */,
L64(0x65623C29D79CE5CE) /* 432 */, L64(0x2368449096C00BB1) /* 433 */,
L64(0xAB9BF1879DA503BA) /* 434 */, L64(0xBC23ECB1A458058E) /* 435 */,
L64(0x9A58DF01BB401ECC) /* 436 */, L64(0xA070E868A85F143D) /* 437 */,
L64(0x4FF188307DF2239E) /* 438 */, L64(0x14D565B41A641183) /* 439 */,
L64(0xEE13337452701602) /* 440 */, L64(0x950E3DCF3F285E09) /* 441 */,
L64(0x59930254B9C80953) /* 442 */, L64(0x3BF299408930DA6D) /* 443 */,
L64(0xA955943F53691387) /* 444 */, L64(0xA15EDECAA9CB8784) /* 445 */,
L64(0x29142127352BE9A0) /* 446 */, L64(0x76F0371FFF4E7AFB) /* 447 */,
L64(0x0239F450274F2228) /* 448 */, L64(0xBB073AF01D5E868B) /* 449 */,
L64(0xBFC80571C10E96C1) /* 450 */, L64(0xD267088568222E23) /* 451 */,
L64(0x9671A3D48E80B5B0) /* 452 */, L64(0x55B5D38AE193BB81) /* 453 */,
L64(0x693AE2D0A18B04B8) /* 454 */, L64(0x5C48B4ECADD5335F) /* 455 */,
L64(0xFD743B194916A1CA) /* 456 */, L64(0x2577018134BE98C4) /* 457 */,
L64(0xE77987E83C54A4AD) /* 458 */, L64(0x28E11014DA33E1B9) /* 459 */,
L64(0x270CC59E226AA213) /* 460 */, L64(0x71495F756D1A5F60) /* 461 */,
L64(0x9BE853FB60AFEF77) /* 462 */, L64(0xADC786A7F7443DBF) /* 463 */,
L64(0x0904456173B29A82) /* 464 */, L64(0x58BC7A66C232BD5E) /* 465 */,
L64(0xF306558C673AC8B2) /* 466 */, L64(0x41F639C6B6C9772A) /* 467 */,
L64(0x216DEFE99FDA35DA) /* 468 */, L64(0x11640CC71C7BE615) /* 469 */,
L64(0x93C43694565C5527) /* 470 */, L64(0xEA038E6246777839) /* 471 */,
L64(0xF9ABF3CE5A3E2469) /* 472 */, L64(0x741E768D0FD312D2) /* 473 */,
L64(0x0144B883CED652C6) /* 474 */, L64(0xC20B5A5BA33F8552) /* 475 */,
L64(0x1AE69633C3435A9D) /* 476 */, L64(0x97A28CA4088CFDEC) /* 477 */,
L64(0x8824A43C1E96F420) /* 478 */, L64(0x37612FA66EEEA746) /* 479 */,
L64(0x6B4CB165F9CF0E5A) /* 480 */, L64(0x43AA1C06A0ABFB4A) /* 481 */,
L64(0x7F4DC26FF162796B) /* 482 */, L64(0x6CBACC8E54ED9B0F) /* 483 */,
L64(0xA6B7FFEFD2BB253E) /* 484 */, L64(0x2E25BC95B0A29D4F) /* 485 */,
L64(0x86D6A58BDEF1388C) /* 486 */, L64(0xDED74AC576B6F054) /* 487 */,
L64(0x8030BDBC2B45805D) /* 488 */, L64(0x3C81AF70E94D9289) /* 489 */,
L64(0x3EFF6DDA9E3100DB) /* 490 */, L64(0xB38DC39FDFCC8847) /* 491 */,
L64(0x123885528D17B87E) /* 492 */, L64(0xF2DA0ED240B1B642) /* 493 */,
L64(0x44CEFADCD54BF9A9) /* 494 */, L64(0x1312200E433C7EE6) /* 495 */,
L64(0x9FFCC84F3A78C748) /* 496 */, L64(0xF0CD1F72248576BB) /* 497 */,
L64(0xEC6974053638CFE4) /* 498 */, L64(0x2BA7B67C0CEC4E4C) /* 499 */,
L64(0xAC2F4DF3E5CE32ED) /* 500 */, L64(0xCB33D14326EA4C11) /* 501 */,
L64(0xA4E9044CC77E58BC) /* 502 */, L64(0x5F513293D934FCEF) /* 503 */,
L64(0x5DC9645506E55444) /* 504 */, L64(0x50DE418F317DE40A) /* 505 */,
L64(0x388CB31A69DDE259) /* 506 */, L64(0x2DB4A83455820A86) /* 507 */,
L64(0x9010A91E84711AE9) /* 508 */, L64(0x4DF7F0B7B1498371) /* 509 */,
L64(0xD62A2EABC0977179) /* 510 */, L64(0x22FAC097AA8D5C0E) /* 511 */,
L64(0xF49FCC2FF1DAF39B) /* 512 */, L64(0x487FD5C66FF29281) /* 513 */,
L64(0xE8A30667FCDCA83F) /* 514 */, L64(0x2C9B4BE3D2FCCE63) /* 515 */,
L64(0xDA3FF74B93FBBBC2) /* 516 */, L64(0x2FA165D2FE70BA66) /* 517 */,
L64(0xA103E279970E93D4) /* 518 */, L64(0xBECDEC77B0E45E71) /* 519 */,
L64(0xCFB41E723985E497) /* 520 */, L64(0xB70AAA025EF75017) /* 521 */,
L64(0xD42309F03840B8E0) /* 522 */, L64(0x8EFC1AD035898579) /* 523 */,
L64(0x96C6920BE2B2ABC5) /* 524 */, L64(0x66AF4163375A9172) /* 525 */,
L64(0x2174ABDCCA7127FB) /* 526 */, L64(0xB33CCEA64A72FF41) /* 527 */,
L64(0xF04A4933083066A5) /* 528 */, L64(0x8D970ACDD7289AF5) /* 529 */,
L64(0x8F96E8E031C8C25E) /* 530 */, L64(0xF3FEC02276875D47) /* 531 */,
L64(0xEC7BF310056190DD) /* 532 */, L64(0xF5ADB0AEBB0F1491) /* 533 */,
L64(0x9B50F8850FD58892) /* 534 */, L64(0x4975488358B74DE8) /* 535 */,
L64(0xA3354FF691531C61) /* 536 */, L64(0x0702BBE481D2C6EE) /* 537 */,
L64(0x89FB24057DEDED98) /* 538 */, L64(0xAC3075138596E902) /* 539 */,
L64(0x1D2D3580172772ED) /* 540 */, L64(0xEB738FC28E6BC30D) /* 541 */,
L64(0x5854EF8F63044326) /* 542 */, L64(0x9E5C52325ADD3BBE) /* 543 */,
L64(0x90AA53CF325C4623) /* 544 */, L64(0xC1D24D51349DD067) /* 545 */,
L64(0x2051CFEEA69EA624) /* 546 */, L64(0x13220F0A862E7E4F) /* 547 */,
L64(0xCE39399404E04864) /* 548 */, L64(0xD9C42CA47086FCB7) /* 549 */,
L64(0x685AD2238A03E7CC) /* 550 */, L64(0x066484B2AB2FF1DB) /* 551 */,
L64(0xFE9D5D70EFBF79EC) /* 552 */, L64(0x5B13B9DD9C481854) /* 553 */,
L64(0x15F0D475ED1509AD) /* 554 */, L64(0x0BEBCD060EC79851) /* 555 */,
L64(0xD58C6791183AB7F8) /* 556 */, L64(0xD1187C5052F3EEE4) /* 557 */,
L64(0xC95D1192E54E82FF) /* 558 */, L64(0x86EEA14CB9AC6CA2) /* 559 */,
L64(0x3485BEB153677D5D) /* 560 */, L64(0xDD191D781F8C492A) /* 561 */,
L64(0xF60866BAA784EBF9) /* 562 */, L64(0x518F643BA2D08C74) /* 563 */,
L64(0x8852E956E1087C22) /* 564 */, L64(0xA768CB8DC410AE8D) /* 565 */,
L64(0x38047726BFEC8E1A) /* 566 */, L64(0xA67738B4CD3B45AA) /* 567 */,
L64(0xAD16691CEC0DDE19) /* 568 */, L64(0xC6D4319380462E07) /* 569 */,
L64(0xC5A5876D0BA61938) /* 570 */, L64(0x16B9FA1FA58FD840) /* 571 */,
L64(0x188AB1173CA74F18) /* 572 */, L64(0xABDA2F98C99C021F) /* 573 */,
L64(0x3E0580AB134AE816) /* 574 */, L64(0x5F3B05B773645ABB) /* 575 */,
L64(0x2501A2BE5575F2F6) /* 576 */, L64(0x1B2F74004E7E8BA9) /* 577 */,
L64(0x1CD7580371E8D953) /* 578 */, L64(0x7F6ED89562764E30) /* 579 */,
L64(0xB15926FF596F003D) /* 580 */, L64(0x9F65293DA8C5D6B9) /* 581 */,
L64(0x6ECEF04DD690F84C) /* 582 */, L64(0x4782275FFF33AF88) /* 583 */,
L64(0xE41433083F820801) /* 584 */, L64(0xFD0DFE409A1AF9B5) /* 585 */,
L64(0x4325A3342CDB396B) /* 586 */, L64(0x8AE77E62B301B252) /* 587 */,
L64(0xC36F9E9F6655615A) /* 588 */, L64(0x85455A2D92D32C09) /* 589 */,
L64(0xF2C7DEA949477485) /* 590 */, L64(0x63CFB4C133A39EBA) /* 591 */,
L64(0x83B040CC6EBC5462) /* 592 */, L64(0x3B9454C8FDB326B0) /* 593 */,
L64(0x56F56A9E87FFD78C) /* 594 */, L64(0x2DC2940D99F42BC6) /* 595 */,
L64(0x98F7DF096B096E2D) /* 596 */, L64(0x19A6E01E3AD852BF) /* 597 */,
L64(0x42A99CCBDBD4B40B) /* 598 */, L64(0xA59998AF45E9C559) /* 599 */,
L64(0x366295E807D93186) /* 600 */, L64(0x6B48181BFAA1F773) /* 601 */,
L64(0x1FEC57E2157A0A1D) /* 602 */, L64(0x4667446AF6201AD5) /* 603 */,
L64(0xE615EBCACFB0F075) /* 604 */, L64(0xB8F31F4F68290778) /* 605 */,
L64(0x22713ED6CE22D11E) /* 606 */, L64(0x3057C1A72EC3C93B) /* 607 */,
L64(0xCB46ACC37C3F1F2F) /* 608 */, L64(0xDBB893FD02AAF50E) /* 609 */,
L64(0x331FD92E600B9FCF) /* 610 */, L64(0xA498F96148EA3AD6) /* 611 */,
L64(0xA8D8426E8B6A83EA) /* 612 */, L64(0xA089B274B7735CDC) /* 613 */,
L64(0x87F6B3731E524A11) /* 614 */, L64(0x118808E5CBC96749) /* 615 */,
L64(0x9906E4C7B19BD394) /* 616 */, L64(0xAFED7F7E9B24A20C) /* 617 */,
L64(0x6509EADEEB3644A7) /* 618 */, L64(0x6C1EF1D3E8EF0EDE) /* 619 */,
L64(0xB9C97D43E9798FB4) /* 620 */, L64(0xA2F2D784740C28A3) /* 621 */,
L64(0x7B8496476197566F) /* 622 */, L64(0x7A5BE3E6B65F069D) /* 623 */,
L64(0xF96330ED78BE6F10) /* 624 */, L64(0xEEE60DE77A076A15) /* 625 */,
L64(0x2B4BEE4AA08B9BD0) /* 626 */, L64(0x6A56A63EC7B8894E) /* 627 */,
L64(0x02121359BA34FEF4) /* 628 */, L64(0x4CBF99F8283703FC) /* 629 */,
L64(0x398071350CAF30C8) /* 630 */, L64(0xD0A77A89F017687A) /* 631 */,
L64(0xF1C1A9EB9E423569) /* 632 */, L64(0x8C7976282DEE8199) /* 633 */,
L64(0x5D1737A5DD1F7ABD) /* 634 */, L64(0x4F53433C09A9FA80) /* 635 */,
L64(0xFA8B0C53DF7CA1D9) /* 636 */, L64(0x3FD9DCBC886CCB77) /* 637 */,
L64(0xC040917CA91B4720) /* 638 */, L64(0x7DD00142F9D1DCDF) /* 639 */,
L64(0x8476FC1D4F387B58) /* 640 */, L64(0x23F8E7C5F3316503) /* 641 */,
L64(0x032A2244E7E37339) /* 642 */, L64(0x5C87A5D750F5A74B) /* 643 */,
L64(0x082B4CC43698992E) /* 644 */, L64(0xDF917BECB858F63C) /* 645 */,
L64(0x3270B8FC5BF86DDA) /* 646 */, L64(0x10AE72BB29B5DD76) /* 647 */,
L64(0x576AC94E7700362B) /* 648 */, L64(0x1AD112DAC61EFB8F) /* 649 */,
L64(0x691BC30EC5FAA427) /* 650 */, L64(0xFF246311CC327143) /* 651 */,
L64(0x3142368E30E53206) /* 652 */, L64(0x71380E31E02CA396) /* 653 */,
L64(0x958D5C960AAD76F1) /* 654 */, L64(0xF8D6F430C16DA536) /* 655 */,
L64(0xC8FFD13F1BE7E1D2) /* 656 */, L64(0x7578AE66004DDBE1) /* 657 */,
L64(0x05833F01067BE646) /* 658 */, L64(0xBB34B5AD3BFE586D) /* 659 */,
L64(0x095F34C9A12B97F0) /* 660 */, L64(0x247AB64525D60CA8) /* 661 */,
L64(0xDCDBC6F3017477D1) /* 662 */, L64(0x4A2E14D4DECAD24D) /* 663 */,
L64(0xBDB5E6D9BE0A1EEB) /* 664 */, L64(0x2A7E70F7794301AB) /* 665 */,
L64(0xDEF42D8A270540FD) /* 666 */, L64(0x01078EC0A34C22C1) /* 667 */,
L64(0xE5DE511AF4C16387) /* 668 */, L64(0x7EBB3A52BD9A330A) /* 669 */,
L64(0x77697857AA7D6435) /* 670 */, L64(0x004E831603AE4C32) /* 671 */,
L64(0xE7A21020AD78E312) /* 672 */, L64(0x9D41A70C6AB420F2) /* 673 */,
L64(0x28E06C18EA1141E6) /* 674 */, L64(0xD2B28CBD984F6B28) /* 675 */,
L64(0x26B75F6C446E9D83) /* 676 */, L64(0xBA47568C4D418D7F) /* 677 */,
L64(0xD80BADBFE6183D8E) /* 678 */, L64(0x0E206D7F5F166044) /* 679 */,
L64(0xE258A43911CBCA3E) /* 680 */, L64(0x723A1746B21DC0BC) /* 681 */,
L64(0xC7CAA854F5D7CDD3) /* 682 */, L64(0x7CAC32883D261D9C) /* 683 */,
L64(0x7690C26423BA942C) /* 684 */, L64(0x17E55524478042B8) /* 685 */,
L64(0xE0BE477656A2389F) /* 686 */, L64(0x4D289B5E67AB2DA0) /* 687 */,
L64(0x44862B9C8FBBFD31) /* 688 */, L64(0xB47CC8049D141365) /* 689 */,
L64(0x822C1B362B91C793) /* 690 */, L64(0x4EB14655FB13DFD8) /* 691 */,
L64(0x1ECBBA0714E2A97B) /* 692 */, L64(0x6143459D5CDE5F14) /* 693 */,
L64(0x53A8FBF1D5F0AC89) /* 694 */, L64(0x97EA04D81C5E5B00) /* 695 */,
L64(0x622181A8D4FDB3F3) /* 696 */, L64(0xE9BCD341572A1208) /* 697 */,
L64(0x1411258643CCE58A) /* 698 */, L64(0x9144C5FEA4C6E0A4) /* 699 */,
L64(0x0D33D06565CF620F) /* 700 */, L64(0x54A48D489F219CA1) /* 701 */,
L64(0xC43E5EAC6D63C821) /* 702 */, L64(0xA9728B3A72770DAF) /* 703 */,
L64(0xD7934E7B20DF87EF) /* 704 */, L64(0xE35503B61A3E86E5) /* 705 */,
L64(0xCAE321FBC819D504) /* 706 */, L64(0x129A50B3AC60BFA6) /* 707 */,
L64(0xCD5E68EA7E9FB6C3) /* 708 */, L64(0xB01C90199483B1C7) /* 709 */,
L64(0x3DE93CD5C295376C) /* 710 */, L64(0xAED52EDF2AB9AD13) /* 711 */,
L64(0x2E60F512C0A07884) /* 712 */, L64(0xBC3D86A3E36210C9) /* 713 */,
L64(0x35269D9B163951CE) /* 714 */, L64(0x0C7D6E2AD0CDB5FA) /* 715 */,
L64(0x59E86297D87F5733) /* 716 */, L64(0x298EF221898DB0E7) /* 717 */,
L64(0x55000029D1A5AA7E) /* 718 */, L64(0x8BC08AE1B5061B45) /* 719 */,
L64(0xC2C31C2B6C92703A) /* 720 */, L64(0x94CC596BAF25EF42) /* 721 */,
L64(0x0A1D73DB22540456) /* 722 */, L64(0x04B6A0F9D9C4179A) /* 723 */,
L64(0xEFFDAFA2AE3D3C60) /* 724 */, L64(0xF7C8075BB49496C4) /* 725 */,
L64(0x9CC5C7141D1CD4E3) /* 726 */, L64(0x78BD1638218E5534) /* 727 */,
L64(0xB2F11568F850246A) /* 728 */, L64(0xEDFABCFA9502BC29) /* 729 */,
L64(0x796CE5F2DA23051B) /* 730 */, L64(0xAAE128B0DC93537C) /* 731 */,
L64(0x3A493DA0EE4B29AE) /* 732 */, L64(0xB5DF6B2C416895D7) /* 733 */,
L64(0xFCABBD25122D7F37) /* 734 */, L64(0x70810B58105DC4B1) /* 735 */,
L64(0xE10FDD37F7882A90) /* 736 */, L64(0x524DCAB5518A3F5C) /* 737 */,
L64(0x3C9E85878451255B) /* 738 */, L64(0x4029828119BD34E2) /* 739 */,
L64(0x74A05B6F5D3CECCB) /* 740 */, L64(0xB610021542E13ECA) /* 741 */,
L64(0x0FF979D12F59E2AC) /* 742 */, L64(0x6037DA27E4F9CC50) /* 743 */,
L64(0x5E92975A0DF1847D) /* 744 */, L64(0xD66DE190D3E623FE) /* 745 */,
L64(0x5032D6B87B568048) /* 746 */, L64(0x9A36B7CE8235216E) /* 747 */,
L64(0x80272A7A24F64B4A) /* 748 */, L64(0x93EFED8B8C6916F7) /* 749 */,
L64(0x37DDBFF44CCE1555) /* 750 */, L64(0x4B95DB5D4B99BD25) /* 751 */,
L64(0x92D3FDA169812FC0) /* 752 */, L64(0xFB1A4A9A90660BB6) /* 753 */,
L64(0x730C196946A4B9B2) /* 754 */, L64(0x81E289AA7F49DA68) /* 755 */,
L64(0x64669A0F83B1A05F) /* 756 */, L64(0x27B3FF7D9644F48B) /* 757 */,
L64(0xCC6B615C8DB675B3) /* 758 */, L64(0x674F20B9BCEBBE95) /* 759 */,
L64(0x6F31238275655982) /* 760 */, L64(0x5AE488713E45CF05) /* 761 */,
L64(0xBF619F9954C21157) /* 762 */, L64(0xEABAC46040A8EAE9) /* 763 */,
L64(0x454C6FE9F2C0C1CD) /* 764 */, L64(0x419CF6496412691C) /* 765 */,
L64(0xD3DC3BEF265B0F70) /* 766 */, L64(0x6D0E60F5C3578A9E) /* 767 */,
L64(0x5B0E608526323C55) /* 768 */, L64(0x1A46C1A9FA1B59F5) /* 769 */,
L64(0xA9E245A17C4C8FFA) /* 770 */, L64(0x65CA5159DB2955D7) /* 771 */,
L64(0x05DB0A76CE35AFC2) /* 772 */, L64(0x81EAC77EA9113D45) /* 773 */,
L64(0x528EF88AB6AC0A0D) /* 774 */, L64(0xA09EA253597BE3FF) /* 775 */,
L64(0x430DDFB3AC48CD56) /* 776 */, L64(0xC4B3A67AF45CE46F) /* 777 */,
L64(0x4ECECFD8FBE2D05E) /* 778 */, L64(0x3EF56F10B39935F0) /* 779 */,
L64(0x0B22D6829CD619C6) /* 780 */, L64(0x17FD460A74DF2069) /* 781 */,
L64(0x6CF8CC8E8510ED40) /* 782 */, L64(0xD6C824BF3A6ECAA7) /* 783 */,
L64(0x61243D581A817049) /* 784 */, L64(0x048BACB6BBC163A2) /* 785 */,
L64(0xD9A38AC27D44CC32) /* 786 */, L64(0x7FDDFF5BAAF410AB) /* 787 */,
L64(0xAD6D495AA804824B) /* 788 */, L64(0xE1A6A74F2D8C9F94) /* 789 */,
L64(0xD4F7851235DEE8E3) /* 790 */, L64(0xFD4B7F886540D893) /* 791 */,
L64(0x247C20042AA4BFDA) /* 792 */, L64(0x096EA1C517D1327C) /* 793 */,
L64(0xD56966B4361A6685) /* 794 */, L64(0x277DA5C31221057D) /* 795 */,
L64(0x94D59893A43ACFF7) /* 796 */, L64(0x64F0C51CCDC02281) /* 797 */,
L64(0x3D33BCC4FF6189DB) /* 798 */, L64(0xE005CB184CE66AF1) /* 799 */,
L64(0xFF5CCD1D1DB99BEA) /* 800 */, L64(0xB0B854A7FE42980F) /* 801 */,
L64(0x7BD46A6A718D4B9F) /* 802 */, L64(0xD10FA8CC22A5FD8C) /* 803 */,
L64(0xD31484952BE4BD31) /* 804 */, L64(0xC7FA975FCB243847) /* 805 */,
L64(0x4886ED1E5846C407) /* 806 */, L64(0x28CDDB791EB70B04) /* 807 */,
L64(0xC2B00BE2F573417F) /* 808 */, L64(0x5C9590452180F877) /* 809 */,
L64(0x7A6BDDFFF370EB00) /* 810 */, L64(0xCE509E38D6D9D6A4) /* 811 */,
L64(0xEBEB0F00647FA702) /* 812 */, L64(0x1DCC06CF76606F06) /* 813 */,
L64(0xE4D9F28BA286FF0A) /* 814 */, L64(0xD85A305DC918C262) /* 815 */,
L64(0x475B1D8732225F54) /* 816 */, L64(0x2D4FB51668CCB5FE) /* 817 */,
L64(0xA679B9D9D72BBA20) /* 818 */, L64(0x53841C0D912D43A5) /* 819 */,
L64(0x3B7EAA48BF12A4E8) /* 820 */, L64(0x781E0E47F22F1DDF) /* 821 */,
L64(0xEFF20CE60AB50973) /* 822 */, L64(0x20D261D19DFFB742) /* 823 */,
L64(0x16A12B03062A2E39) /* 824 */, L64(0x1960EB2239650495) /* 825 */,
L64(0x251C16FED50EB8B8) /* 826 */, L64(0x9AC0C330F826016E) /* 827 */,
L64(0xED152665953E7671) /* 828 */, L64(0x02D63194A6369570) /* 829 */,
L64(0x5074F08394B1C987) /* 830 */, L64(0x70BA598C90B25CE1) /* 831 */,
L64(0x794A15810B9742F6) /* 832 */, L64(0x0D5925E9FCAF8C6C) /* 833 */,
L64(0x3067716CD868744E) /* 834 */, L64(0x910AB077E8D7731B) /* 835 */,
L64(0x6A61BBDB5AC42F61) /* 836 */, L64(0x93513EFBF0851567) /* 837 */,
L64(0xF494724B9E83E9D5) /* 838 */, L64(0xE887E1985C09648D) /* 839 */,
L64(0x34B1D3C675370CFD) /* 840 */, L64(0xDC35E433BC0D255D) /* 841 */,
L64(0xD0AAB84234131BE0) /* 842 */, L64(0x08042A50B48B7EAF) /* 843 */,
L64(0x9997C4EE44A3AB35) /* 844 */, L64(0x829A7B49201799D0) /* 845 */,
L64(0x263B8307B7C54441) /* 846 */, L64(0x752F95F4FD6A6CA6) /* 847 */,
L64(0x927217402C08C6E5) /* 848 */, L64(0x2A8AB754A795D9EE) /* 849 */,
L64(0xA442F7552F72943D) /* 850 */, L64(0x2C31334E19781208) /* 851 */,
L64(0x4FA98D7CEAEE6291) /* 852 */, L64(0x55C3862F665DB309) /* 853 */,
L64(0xBD0610175D53B1F3) /* 854 */, L64(0x46FE6CB840413F27) /* 855 */,
L64(0x3FE03792DF0CFA59) /* 856 */, L64(0xCFE700372EB85E8F) /* 857 */,
L64(0xA7BE29E7ADBCE118) /* 858 */, L64(0xE544EE5CDE8431DD) /* 859 */,
L64(0x8A781B1B41F1873E) /* 860 */, L64(0xA5C94C78A0D2F0E7) /* 861 */,
L64(0x39412E2877B60728) /* 862 */, L64(0xA1265EF3AFC9A62C) /* 863 */,
L64(0xBCC2770C6A2506C5) /* 864 */, L64(0x3AB66DD5DCE1CE12) /* 865 */,
L64(0xE65499D04A675B37) /* 866 */, L64(0x7D8F523481BFD216) /* 867 */,
L64(0x0F6F64FCEC15F389) /* 868 */, L64(0x74EFBE618B5B13C8) /* 869 */,
L64(0xACDC82B714273E1D) /* 870 */, L64(0xDD40BFE003199D17) /* 871 */,
L64(0x37E99257E7E061F8) /* 872 */, L64(0xFA52626904775AAA) /* 873 */,
L64(0x8BBBF63A463D56F9) /* 874 */, L64(0xF0013F1543A26E64) /* 875 */,
L64(0xA8307E9F879EC898) /* 876 */, L64(0xCC4C27A4150177CC) /* 877 */,
L64(0x1B432F2CCA1D3348) /* 878 */, L64(0xDE1D1F8F9F6FA013) /* 879 */,
L64(0x606602A047A7DDD6) /* 880 */, L64(0xD237AB64CC1CB2C7) /* 881 */,
L64(0x9B938E7225FCD1D3) /* 882 */, L64(0xEC4E03708E0FF476) /* 883 */,
L64(0xFEB2FBDA3D03C12D) /* 884 */, L64(0xAE0BCED2EE43889A) /* 885 */,
L64(0x22CB8923EBFB4F43) /* 886 */, L64(0x69360D013CF7396D) /* 887 */,
L64(0x855E3602D2D4E022) /* 888 */, L64(0x073805BAD01F784C) /* 889 */,
L64(0x33E17A133852F546) /* 890 */, L64(0xDF4874058AC7B638) /* 891 */,
L64(0xBA92B29C678AA14A) /* 892 */, L64(0x0CE89FC76CFAADCD) /* 893 */,
L64(0x5F9D4E0908339E34) /* 894 */, L64(0xF1AFE9291F5923B9) /* 895 */,
L64(0x6E3480F60F4A265F) /* 896 */, L64(0xEEBF3A2AB29B841C) /* 897 */,
L64(0xE21938A88F91B4AD) /* 898 */, L64(0x57DFEFF845C6D3C3) /* 899 */,
L64(0x2F006B0BF62CAAF2) /* 900 */, L64(0x62F479EF6F75EE78) /* 901 */,
L64(0x11A55AD41C8916A9) /* 902 */, L64(0xF229D29084FED453) /* 903 */,
L64(0x42F1C27B16B000E6) /* 904 */, L64(0x2B1F76749823C074) /* 905 */,
L64(0x4B76ECA3C2745360) /* 906 */, L64(0x8C98F463B91691BD) /* 907 */,
L64(0x14BCC93CF1ADE66A) /* 908 */, L64(0x8885213E6D458397) /* 909 */,
L64(0x8E177DF0274D4711) /* 910 */, L64(0xB49B73B5503F2951) /* 911 */,
L64(0x10168168C3F96B6B) /* 912 */, L64(0x0E3D963B63CAB0AE) /* 913 */,
L64(0x8DFC4B5655A1DB14) /* 914 */, L64(0xF789F1356E14DE5C) /* 915 */,
L64(0x683E68AF4E51DAC1) /* 916 */, L64(0xC9A84F9D8D4B0FD9) /* 917 */,
L64(0x3691E03F52A0F9D1) /* 918 */, L64(0x5ED86E46E1878E80) /* 919 */,
L64(0x3C711A0E99D07150) /* 920 */, L64(0x5A0865B20C4E9310) /* 921 */,
L64(0x56FBFC1FE4F0682E) /* 922 */, L64(0xEA8D5DE3105EDF9B) /* 923 */,
L64(0x71ABFDB12379187A) /* 924 */, L64(0x2EB99DE1BEE77B9C) /* 925 */,
L64(0x21ECC0EA33CF4523) /* 926 */, L64(0x59A4D7521805C7A1) /* 927 */,
L64(0x3896F5EB56AE7C72) /* 928 */, L64(0xAA638F3DB18F75DC) /* 929 */,
L64(0x9F39358DABE9808E) /* 930 */, L64(0xB7DEFA91C00B72AC) /* 931 */,
L64(0x6B5541FD62492D92) /* 932 */, L64(0x6DC6DEE8F92E4D5B) /* 933 */,
L64(0x353F57ABC4BEEA7E) /* 934 */, L64(0x735769D6DA5690CE) /* 935 */,
L64(0x0A234AA642391484) /* 936 */, L64(0xF6F9508028F80D9D) /* 937 */,
L64(0xB8E319A27AB3F215) /* 938 */, L64(0x31AD9C1151341A4D) /* 939 */,
L64(0x773C22A57BEF5805) /* 940 */, L64(0x45C7561A07968633) /* 941 */,
L64(0xF913DA9E249DBE36) /* 942 */, L64(0xDA652D9B78A64C68) /* 943 */,
L64(0x4C27A97F3BC334EF) /* 944 */, L64(0x76621220E66B17F4) /* 945 */,
L64(0x967743899ACD7D0B) /* 946 */, L64(0xF3EE5BCAE0ED6782) /* 947 */,
L64(0x409F753600C879FC) /* 948 */, L64(0x06D09A39B5926DB6) /* 949 */,
L64(0x6F83AEB0317AC588) /* 950 */, L64(0x01E6CA4A86381F21) /* 951 */,
L64(0x66FF3462D19F3025) /* 952 */, L64(0x72207C24DDFD3BFB) /* 953 */,
L64(0x4AF6B6D3E2ECE2EB) /* 954 */, L64(0x9C994DBEC7EA08DE) /* 955 */,
L64(0x49ACE597B09A8BC4) /* 956 */, L64(0xB38C4766CF0797BA) /* 957 */,
L64(0x131B9373C57C2A75) /* 958 */, L64(0xB1822CCE61931E58) /* 959 */,
L64(0x9D7555B909BA1C0C) /* 960 */, L64(0x127FAFDD937D11D2) /* 961 */,
L64(0x29DA3BADC66D92E4) /* 962 */, L64(0xA2C1D57154C2ECBC) /* 963 */,
L64(0x58C5134D82F6FE24) /* 964 */, L64(0x1C3AE3515B62274F) /* 965 */,
L64(0xE907C82E01CB8126) /* 966 */, L64(0xF8ED091913E37FCB) /* 967 */,
L64(0x3249D8F9C80046C9) /* 968 */, L64(0x80CF9BEDE388FB63) /* 969 */,
L64(0x1881539A116CF19E) /* 970 */, L64(0x5103F3F76BD52457) /* 971 */,
L64(0x15B7E6F5AE47F7A8) /* 972 */, L64(0xDBD7C6DED47E9CCF) /* 973 */,
L64(0x44E55C410228BB1A) /* 974 */, L64(0xB647D4255EDB4E99) /* 975 */,
L64(0x5D11882BB8AAFC30) /* 976 */, L64(0xF5098BBB29D3212A) /* 977 */,
L64(0x8FB5EA14E90296B3) /* 978 */, L64(0x677B942157DD025A) /* 979 */,
L64(0xFB58E7C0A390ACB5) /* 980 */, L64(0x89D3674C83BD4A01) /* 981 */,
L64(0x9E2DA4DF4BF3B93B) /* 982 */, L64(0xFCC41E328CAB4829) /* 983 */,
L64(0x03F38C96BA582C52) /* 984 */, L64(0xCAD1BDBD7FD85DB2) /* 985 */,
L64(0xBBB442C16082AE83) /* 986 */, L64(0xB95FE86BA5DA9AB0) /* 987 */,
L64(0xB22E04673771A93F) /* 988 */, L64(0x845358C9493152D8) /* 989 */,
L64(0xBE2A488697B4541E) /* 990 */, L64(0x95A2DC2DD38E6966) /* 991 */,
L64(0xC02C11AC923C852B) /* 992 */, L64(0x2388B1990DF2A87B) /* 993 */,
L64(0x7C8008FA1B4F37BE) /* 994 */, L64(0x1F70D0C84D54E503) /* 995 */,
L64(0x5490ADEC7ECE57D4) /* 996 */, L64(0x002B3C27D9063A3A) /* 997 */,
L64(0x7EAEA3848030A2BF) /* 998 */, L64(0xC602326DED2003C0) /* 999 */,
L64(0x83A7287D69A94086) /* 1000 */, L64(0xC57A5FCB30F57A8A) /* 1001 */,
L64(0xB56844E479EBE779) /* 1002 */, L64(0xA373B40F05DCBCE9) /* 1003 */,
L64(0xD71A786E88570EE2) /* 1004 */, L64(0x879CBACDBDE8F6A0) /* 1005 */,
L64(0x976AD1BCC164A32F) /* 1006 */, L64(0xAB21E25E9666D78B) /* 1007 */,
L64(0x901063AAE5E5C33C) /* 1008 */, L64(0x9818B34448698D90) /* 1009 */,
L64(0xE36487AE3E1E8ABB) /* 1010 */, L64(0xAFBDF931893BDCB4) /* 1011 */,
L64(0x6345A0DC5FBBD519) /* 1012 */, L64(0x8628FE269B9465CA) /* 1013 */,
L64(0x1E5D01603F9C51EC) /* 1014 */, L64(0x4DE44006A15049B7) /* 1015 */,
L64(0xBF6C70E5F776CBB1) /* 1016 */, L64(0x411218F2EF552BED) /* 1017 */,
L64(0xCB0C0708705A36A3) /* 1018 */, L64(0xE74D14754F986044) /* 1019 */,
L64(0xCD56D9430EA8280E) /* 1020 */, L64(0xC12591D7535F5065) /* 1021 */,
L64(0xC83223F1720AEF96) /* 1022 */, L64(0xC3A0396F7363A51F) /* 1023 */,
};
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: sw=4 ts=4 fdm=marker
* vim<600: sw=4 ts=4
*/
-67
View File
@@ -1,67 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2005 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Michael Wallner <mike@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef PHP_HASH_TYPES_H
#define PHP_HASH_TYPES_H
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifndef PHP_WIN32
#if SIZEOF_LONG == 8
#define L64(x) x
typedef unsigned long php_hash_uint64;
#if SIZEOF_INT == 4
typedef unsigned int php_hash_uint32;
#elif SIZEOF_SHORT == 4
typedef unsigned short php_hash_uint32;
#else
#error "Need a 32bit integer type"
#endif
#elif SIZEOF_LONG_LONG == 8
#define L64(x) x##LL
typedef unsigned long long php_hash_uint64;
#if SIZEOF_INT == 4
typedef unsigned int php_hash_uint32;
#elif SIZEOF_LONG == 4
typedef unsigned long php_hash_uint32;
#else
#error "Need a 32bit integer type"
#endif
#else
#error "Need a 64bit integer type"
#endif
#else
#define L64(x) x##i64
typedef unsigned __int64 php_hash_uint64;
typedef unsigned __int32 php_hash_uint32;
#endif
#endif
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: sw=4 ts=4 fdm=marker
* vim<600: sw=4 ts=4
*/
-48
View File
@@ -1,48 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2005 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Michael Wallner <mike@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef PHP_HASH_WHIRLPOOL_H
#define PHP_HASH_WHIRLPOOL_H
/* WHIRLPOOL context */
typedef struct {
php_hash_uint64 state[8];
unsigned char bitlength[32];
struct {
int pos;
int bits;
unsigned char data[64];
} buffer;
} PHP_WHIRLPOOL_CTX;
PHP_HASH_API void PHP_WHIRLPOOLInit(PHP_WHIRLPOOL_CTX *);
PHP_HASH_API void PHP_WHIRLPOOLUpdate(PHP_WHIRLPOOL_CTX *, const unsigned char *, size_t);
PHP_HASH_API void PHP_WHIRLPOOLFinal(unsigned char[64], PHP_WHIRLPOOL_CTX *);
#endif
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: sw=4 ts=4 fdm=marker
* vim<600: sw=4 ts=4
*/
-585
View File
@@ -1,585 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2005 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Michael Wallner <mike@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef PHP_HASH_WHIRLPOOL_TABLES_H
#define PHP_HASH_WHIRLPOOL_TABLES_H
#define R 10
static const php_hash_uint64 rc[R + 1] = {
L64(0x0000000000000000),
L64(0x1823c6e887b8014f),
L64(0x36a6d2f5796f9152),
L64(0x60bc9b8ea30c7b35),
L64(0x1de0d7c22e4bfe57),
L64(0x157737e59ff04ada),
L64(0x58c9290ab1a06b85),
L64(0xbd5d10f4cb3e0567),
L64(0xe427418ba77d95d8),
L64(0xfbee7c66dd17479e),
L64(0xca2dbf07ad5a8333),
};
static const php_hash_uint64 C0[256] = {
L64(0x18186018c07830d8), L64(0x23238c2305af4626), L64(0xc6c63fc67ef991b8), L64(0xe8e887e8136fcdfb),
L64(0x878726874ca113cb), L64(0xb8b8dab8a9626d11), L64(0x0101040108050209), L64(0x4f4f214f426e9e0d),
L64(0x3636d836adee6c9b), L64(0xa6a6a2a6590451ff), L64(0xd2d26fd2debdb90c), L64(0xf5f5f3f5fb06f70e),
L64(0x7979f979ef80f296), L64(0x6f6fa16f5fcede30), L64(0x91917e91fcef3f6d), L64(0x52525552aa07a4f8),
L64(0x60609d6027fdc047), L64(0xbcbccabc89766535), L64(0x9b9b569baccd2b37), L64(0x8e8e028e048c018a),
L64(0xa3a3b6a371155bd2), L64(0x0c0c300c603c186c), L64(0x7b7bf17bff8af684), L64(0x3535d435b5e16a80),
L64(0x1d1d741de8693af5), L64(0xe0e0a7e05347ddb3), L64(0xd7d77bd7f6acb321), L64(0xc2c22fc25eed999c),
L64(0x2e2eb82e6d965c43), L64(0x4b4b314b627a9629), L64(0xfefedffea321e15d), L64(0x575741578216aed5),
L64(0x15155415a8412abd), L64(0x7777c1779fb6eee8), L64(0x3737dc37a5eb6e92), L64(0xe5e5b3e57b56d79e),
L64(0x9f9f469f8cd92313), L64(0xf0f0e7f0d317fd23), L64(0x4a4a354a6a7f9420), L64(0xdada4fda9e95a944),
L64(0x58587d58fa25b0a2), L64(0xc9c903c906ca8fcf), L64(0x2929a429558d527c), L64(0x0a0a280a5022145a),
L64(0xb1b1feb1e14f7f50), L64(0xa0a0baa0691a5dc9), L64(0x6b6bb16b7fdad614), L64(0x85852e855cab17d9),
L64(0xbdbdcebd8173673c), L64(0x5d5d695dd234ba8f), L64(0x1010401080502090), L64(0xf4f4f7f4f303f507),
L64(0xcbcb0bcb16c08bdd), L64(0x3e3ef83eedc67cd3), L64(0x0505140528110a2d), L64(0x676781671fe6ce78),
L64(0xe4e4b7e47353d597), L64(0x27279c2725bb4e02), L64(0x4141194132588273), L64(0x8b8b168b2c9d0ba7),
L64(0xa7a7a6a7510153f6), L64(0x7d7de97dcf94fab2), L64(0x95956e95dcfb3749), L64(0xd8d847d88e9fad56),
L64(0xfbfbcbfb8b30eb70), L64(0xeeee9fee2371c1cd), L64(0x7c7ced7cc791f8bb), L64(0x6666856617e3cc71),
L64(0xdddd53dda68ea77b), L64(0x17175c17b84b2eaf), L64(0x4747014702468e45), L64(0x9e9e429e84dc211a),
L64(0xcaca0fca1ec589d4), L64(0x2d2db42d75995a58), L64(0xbfbfc6bf9179632e), L64(0x07071c07381b0e3f),
L64(0xadad8ead012347ac), L64(0x5a5a755aea2fb4b0), L64(0x838336836cb51bef), L64(0x3333cc3385ff66b6),
L64(0x636391633ff2c65c), L64(0x02020802100a0412), L64(0xaaaa92aa39384993), L64(0x7171d971afa8e2de),
L64(0xc8c807c80ecf8dc6), L64(0x19196419c87d32d1), L64(0x494939497270923b), L64(0xd9d943d9869aaf5f),
L64(0xf2f2eff2c31df931), L64(0xe3e3abe34b48dba8), L64(0x5b5b715be22ab6b9), L64(0x88881a8834920dbc),
L64(0x9a9a529aa4c8293e), L64(0x262698262dbe4c0b), L64(0x3232c8328dfa64bf), L64(0xb0b0fab0e94a7d59),
L64(0xe9e983e91b6acff2), L64(0x0f0f3c0f78331e77), L64(0xd5d573d5e6a6b733), L64(0x80803a8074ba1df4),
L64(0xbebec2be997c6127), L64(0xcdcd13cd26de87eb), L64(0x3434d034bde46889), L64(0x48483d487a759032),
L64(0xffffdbffab24e354), L64(0x7a7af57af78ff48d), L64(0x90907a90f4ea3d64), L64(0x5f5f615fc23ebe9d),
L64(0x202080201da0403d), L64(0x6868bd6867d5d00f), L64(0x1a1a681ad07234ca), L64(0xaeae82ae192c41b7),
L64(0xb4b4eab4c95e757d), L64(0x54544d549a19a8ce), L64(0x93937693ece53b7f), L64(0x222288220daa442f),
L64(0x64648d6407e9c863), L64(0xf1f1e3f1db12ff2a), L64(0x7373d173bfa2e6cc), L64(0x12124812905a2482),
L64(0x40401d403a5d807a), L64(0x0808200840281048), L64(0xc3c32bc356e89b95), L64(0xecec97ec337bc5df),
L64(0xdbdb4bdb9690ab4d), L64(0xa1a1bea1611f5fc0), L64(0x8d8d0e8d1c830791), L64(0x3d3df43df5c97ac8),
L64(0x97976697ccf1335b), L64(0x0000000000000000), L64(0xcfcf1bcf36d483f9), L64(0x2b2bac2b4587566e),
L64(0x7676c57697b3ece1), L64(0x8282328264b019e6), L64(0xd6d67fd6fea9b128), L64(0x1b1b6c1bd87736c3),
L64(0xb5b5eeb5c15b7774), L64(0xafaf86af112943be), L64(0x6a6ab56a77dfd41d), L64(0x50505d50ba0da0ea),
L64(0x45450945124c8a57), L64(0xf3f3ebf3cb18fb38), L64(0x3030c0309df060ad), L64(0xefef9bef2b74c3c4),
L64(0x3f3ffc3fe5c37eda), L64(0x55554955921caac7), L64(0xa2a2b2a2791059db), L64(0xeaea8fea0365c9e9),
L64(0x656589650fecca6a), L64(0xbabad2bab9686903), L64(0x2f2fbc2f65935e4a), L64(0xc0c027c04ee79d8e),
L64(0xdede5fdebe81a160), L64(0x1c1c701ce06c38fc), L64(0xfdfdd3fdbb2ee746), L64(0x4d4d294d52649a1f),
L64(0x92927292e4e03976), L64(0x7575c9758fbceafa), L64(0x06061806301e0c36), L64(0x8a8a128a249809ae),
L64(0xb2b2f2b2f940794b), L64(0xe6e6bfe66359d185), L64(0x0e0e380e70361c7e), L64(0x1f1f7c1ff8633ee7),
L64(0x6262956237f7c455), L64(0xd4d477d4eea3b53a), L64(0xa8a89aa829324d81), L64(0x96966296c4f43152),
L64(0xf9f9c3f99b3aef62), L64(0xc5c533c566f697a3), L64(0x2525942535b14a10), L64(0x59597959f220b2ab),
L64(0x84842a8454ae15d0), L64(0x7272d572b7a7e4c5), L64(0x3939e439d5dd72ec), L64(0x4c4c2d4c5a619816),
L64(0x5e5e655eca3bbc94), L64(0x7878fd78e785f09f), L64(0x3838e038ddd870e5), L64(0x8c8c0a8c14860598),
L64(0xd1d163d1c6b2bf17), L64(0xa5a5aea5410b57e4), L64(0xe2e2afe2434dd9a1), L64(0x616199612ff8c24e),
L64(0xb3b3f6b3f1457b42), L64(0x2121842115a54234), L64(0x9c9c4a9c94d62508), L64(0x1e1e781ef0663cee),
L64(0x4343114322528661), L64(0xc7c73bc776fc93b1), L64(0xfcfcd7fcb32be54f), L64(0x0404100420140824),
L64(0x51515951b208a2e3), L64(0x99995e99bcc72f25), L64(0x6d6da96d4fc4da22), L64(0x0d0d340d68391a65),
L64(0xfafacffa8335e979), L64(0xdfdf5bdfb684a369), L64(0x7e7ee57ed79bfca9), L64(0x242490243db44819),
L64(0x3b3bec3bc5d776fe), L64(0xabab96ab313d4b9a), L64(0xcece1fce3ed181f0), L64(0x1111441188552299),
L64(0x8f8f068f0c890383), L64(0x4e4e254e4a6b9c04), L64(0xb7b7e6b7d1517366), L64(0xebeb8beb0b60cbe0),
L64(0x3c3cf03cfdcc78c1), L64(0x81813e817cbf1ffd), L64(0x94946a94d4fe3540), L64(0xf7f7fbf7eb0cf31c),
L64(0xb9b9deb9a1676f18), L64(0x13134c13985f268b), L64(0x2c2cb02c7d9c5851), L64(0xd3d36bd3d6b8bb05),
L64(0xe7e7bbe76b5cd38c), L64(0x6e6ea56e57cbdc39), L64(0xc4c437c46ef395aa), L64(0x03030c03180f061b),
L64(0x565645568a13acdc), L64(0x44440d441a49885e), L64(0x7f7fe17fdf9efea0), L64(0xa9a99ea921374f88),
L64(0x2a2aa82a4d825467), L64(0xbbbbd6bbb16d6b0a), L64(0xc1c123c146e29f87), L64(0x53535153a202a6f1),
L64(0xdcdc57dcae8ba572), L64(0x0b0b2c0b58271653), L64(0x9d9d4e9d9cd32701), L64(0x6c6cad6c47c1d82b),
L64(0x3131c43195f562a4), L64(0x7474cd7487b9e8f3), L64(0xf6f6fff6e309f115), L64(0x464605460a438c4c),
L64(0xacac8aac092645a5), L64(0x89891e893c970fb5), L64(0x14145014a04428b4), L64(0xe1e1a3e15b42dfba),
L64(0x16165816b04e2ca6), L64(0x3a3ae83acdd274f7), L64(0x6969b9696fd0d206), L64(0x09092409482d1241),
L64(0x7070dd70a7ade0d7), L64(0xb6b6e2b6d954716f), L64(0xd0d067d0ceb7bd1e), L64(0xeded93ed3b7ec7d6),
L64(0xcccc17cc2edb85e2), L64(0x424215422a578468), L64(0x98985a98b4c22d2c), L64(0xa4a4aaa4490e55ed),
L64(0x2828a0285d885075), L64(0x5c5c6d5cda31b886), L64(0xf8f8c7f8933fed6b), L64(0x8686228644a411c2),
};
static const php_hash_uint64 C1[256] = {
L64(0xd818186018c07830), L64(0x2623238c2305af46), L64(0xb8c6c63fc67ef991), L64(0xfbe8e887e8136fcd),
L64(0xcb878726874ca113), L64(0x11b8b8dab8a9626d), L64(0x0901010401080502), L64(0x0d4f4f214f426e9e),
L64(0x9b3636d836adee6c), L64(0xffa6a6a2a6590451), L64(0x0cd2d26fd2debdb9), L64(0x0ef5f5f3f5fb06f7),
L64(0x967979f979ef80f2), L64(0x306f6fa16f5fcede), L64(0x6d91917e91fcef3f), L64(0xf852525552aa07a4),
L64(0x4760609d6027fdc0), L64(0x35bcbccabc897665), L64(0x379b9b569baccd2b), L64(0x8a8e8e028e048c01),
L64(0xd2a3a3b6a371155b), L64(0x6c0c0c300c603c18), L64(0x847b7bf17bff8af6), L64(0x803535d435b5e16a),
L64(0xf51d1d741de8693a), L64(0xb3e0e0a7e05347dd), L64(0x21d7d77bd7f6acb3), L64(0x9cc2c22fc25eed99),
L64(0x432e2eb82e6d965c), L64(0x294b4b314b627a96), L64(0x5dfefedffea321e1), L64(0xd5575741578216ae),
L64(0xbd15155415a8412a), L64(0xe87777c1779fb6ee), L64(0x923737dc37a5eb6e), L64(0x9ee5e5b3e57b56d7),
L64(0x139f9f469f8cd923), L64(0x23f0f0e7f0d317fd), L64(0x204a4a354a6a7f94), L64(0x44dada4fda9e95a9),
L64(0xa258587d58fa25b0), L64(0xcfc9c903c906ca8f), L64(0x7c2929a429558d52), L64(0x5a0a0a280a502214),
L64(0x50b1b1feb1e14f7f), L64(0xc9a0a0baa0691a5d), L64(0x146b6bb16b7fdad6), L64(0xd985852e855cab17),
L64(0x3cbdbdcebd817367), L64(0x8f5d5d695dd234ba), L64(0x9010104010805020), L64(0x07f4f4f7f4f303f5),
L64(0xddcbcb0bcb16c08b), L64(0xd33e3ef83eedc67c), L64(0x2d0505140528110a), L64(0x78676781671fe6ce),
L64(0x97e4e4b7e47353d5), L64(0x0227279c2725bb4e), L64(0x7341411941325882), L64(0xa78b8b168b2c9d0b),
L64(0xf6a7a7a6a7510153), L64(0xb27d7de97dcf94fa), L64(0x4995956e95dcfb37), L64(0x56d8d847d88e9fad),
L64(0x70fbfbcbfb8b30eb), L64(0xcdeeee9fee2371c1), L64(0xbb7c7ced7cc791f8), L64(0x716666856617e3cc),
L64(0x7bdddd53dda68ea7), L64(0xaf17175c17b84b2e), L64(0x454747014702468e), L64(0x1a9e9e429e84dc21),
L64(0xd4caca0fca1ec589), L64(0x582d2db42d75995a), L64(0x2ebfbfc6bf917963), L64(0x3f07071c07381b0e),
L64(0xacadad8ead012347), L64(0xb05a5a755aea2fb4), L64(0xef838336836cb51b), L64(0xb63333cc3385ff66),
L64(0x5c636391633ff2c6), L64(0x1202020802100a04), L64(0x93aaaa92aa393849), L64(0xde7171d971afa8e2),
L64(0xc6c8c807c80ecf8d), L64(0xd119196419c87d32), L64(0x3b49493949727092), L64(0x5fd9d943d9869aaf),
L64(0x31f2f2eff2c31df9), L64(0xa8e3e3abe34b48db), L64(0xb95b5b715be22ab6), L64(0xbc88881a8834920d),
L64(0x3e9a9a529aa4c829), L64(0x0b262698262dbe4c), L64(0xbf3232c8328dfa64), L64(0x59b0b0fab0e94a7d),
L64(0xf2e9e983e91b6acf), L64(0x770f0f3c0f78331e), L64(0x33d5d573d5e6a6b7), L64(0xf480803a8074ba1d),
L64(0x27bebec2be997c61), L64(0xebcdcd13cd26de87), L64(0x893434d034bde468), L64(0x3248483d487a7590),
L64(0x54ffffdbffab24e3), L64(0x8d7a7af57af78ff4), L64(0x6490907a90f4ea3d), L64(0x9d5f5f615fc23ebe),
L64(0x3d202080201da040), L64(0x0f6868bd6867d5d0), L64(0xca1a1a681ad07234), L64(0xb7aeae82ae192c41),
L64(0x7db4b4eab4c95e75), L64(0xce54544d549a19a8), L64(0x7f93937693ece53b), L64(0x2f222288220daa44),
L64(0x6364648d6407e9c8), L64(0x2af1f1e3f1db12ff), L64(0xcc7373d173bfa2e6), L64(0x8212124812905a24),
L64(0x7a40401d403a5d80), L64(0x4808082008402810), L64(0x95c3c32bc356e89b), L64(0xdfecec97ec337bc5),
L64(0x4ddbdb4bdb9690ab), L64(0xc0a1a1bea1611f5f), L64(0x918d8d0e8d1c8307), L64(0xc83d3df43df5c97a),
L64(0x5b97976697ccf133), L64(0x0000000000000000), L64(0xf9cfcf1bcf36d483), L64(0x6e2b2bac2b458756),
L64(0xe17676c57697b3ec), L64(0xe68282328264b019), L64(0x28d6d67fd6fea9b1), L64(0xc31b1b6c1bd87736),
L64(0x74b5b5eeb5c15b77), L64(0xbeafaf86af112943), L64(0x1d6a6ab56a77dfd4), L64(0xea50505d50ba0da0),
L64(0x5745450945124c8a), L64(0x38f3f3ebf3cb18fb), L64(0xad3030c0309df060), L64(0xc4efef9bef2b74c3),
L64(0xda3f3ffc3fe5c37e), L64(0xc755554955921caa), L64(0xdba2a2b2a2791059), L64(0xe9eaea8fea0365c9),
L64(0x6a656589650fecca), L64(0x03babad2bab96869), L64(0x4a2f2fbc2f65935e), L64(0x8ec0c027c04ee79d),
L64(0x60dede5fdebe81a1), L64(0xfc1c1c701ce06c38), L64(0x46fdfdd3fdbb2ee7), L64(0x1f4d4d294d52649a),
L64(0x7692927292e4e039), L64(0xfa7575c9758fbcea), L64(0x3606061806301e0c), L64(0xae8a8a128a249809),
L64(0x4bb2b2f2b2f94079), L64(0x85e6e6bfe66359d1), L64(0x7e0e0e380e70361c), L64(0xe71f1f7c1ff8633e),
L64(0x556262956237f7c4), L64(0x3ad4d477d4eea3b5), L64(0x81a8a89aa829324d), L64(0x5296966296c4f431),
L64(0x62f9f9c3f99b3aef), L64(0xa3c5c533c566f697), L64(0x102525942535b14a), L64(0xab59597959f220b2),
L64(0xd084842a8454ae15), L64(0xc57272d572b7a7e4), L64(0xec3939e439d5dd72), L64(0x164c4c2d4c5a6198),
L64(0x945e5e655eca3bbc), L64(0x9f7878fd78e785f0), L64(0xe53838e038ddd870), L64(0x988c8c0a8c148605),
L64(0x17d1d163d1c6b2bf), L64(0xe4a5a5aea5410b57), L64(0xa1e2e2afe2434dd9), L64(0x4e616199612ff8c2),
L64(0x42b3b3f6b3f1457b), L64(0x342121842115a542), L64(0x089c9c4a9c94d625), L64(0xee1e1e781ef0663c),
L64(0x6143431143225286), L64(0xb1c7c73bc776fc93), L64(0x4ffcfcd7fcb32be5), L64(0x2404041004201408),
L64(0xe351515951b208a2), L64(0x2599995e99bcc72f), L64(0x226d6da96d4fc4da), L64(0x650d0d340d68391a),
L64(0x79fafacffa8335e9), L64(0x69dfdf5bdfb684a3), L64(0xa97e7ee57ed79bfc), L64(0x19242490243db448),
L64(0xfe3b3bec3bc5d776), L64(0x9aabab96ab313d4b), L64(0xf0cece1fce3ed181), L64(0x9911114411885522),
L64(0x838f8f068f0c8903), L64(0x044e4e254e4a6b9c), L64(0x66b7b7e6b7d15173), L64(0xe0ebeb8beb0b60cb),
L64(0xc13c3cf03cfdcc78), L64(0xfd81813e817cbf1f), L64(0x4094946a94d4fe35), L64(0x1cf7f7fbf7eb0cf3),
L64(0x18b9b9deb9a1676f), L64(0x8b13134c13985f26), L64(0x512c2cb02c7d9c58), L64(0x05d3d36bd3d6b8bb),
L64(0x8ce7e7bbe76b5cd3), L64(0x396e6ea56e57cbdc), L64(0xaac4c437c46ef395), L64(0x1b03030c03180f06),
L64(0xdc565645568a13ac), L64(0x5e44440d441a4988), L64(0xa07f7fe17fdf9efe), L64(0x88a9a99ea921374f),
L64(0x672a2aa82a4d8254), L64(0x0abbbbd6bbb16d6b), L64(0x87c1c123c146e29f), L64(0xf153535153a202a6),
L64(0x72dcdc57dcae8ba5), L64(0x530b0b2c0b582716), L64(0x019d9d4e9d9cd327), L64(0x2b6c6cad6c47c1d8),
L64(0xa43131c43195f562), L64(0xf37474cd7487b9e8), L64(0x15f6f6fff6e309f1), L64(0x4c464605460a438c),
L64(0xa5acac8aac092645), L64(0xb589891e893c970f), L64(0xb414145014a04428), L64(0xbae1e1a3e15b42df),
L64(0xa616165816b04e2c), L64(0xf73a3ae83acdd274), L64(0x066969b9696fd0d2), L64(0x4109092409482d12),
L64(0xd77070dd70a7ade0), L64(0x6fb6b6e2b6d95471), L64(0x1ed0d067d0ceb7bd), L64(0xd6eded93ed3b7ec7),
L64(0xe2cccc17cc2edb85), L64(0x68424215422a5784), L64(0x2c98985a98b4c22d), L64(0xeda4a4aaa4490e55),
L64(0x752828a0285d8850), L64(0x865c5c6d5cda31b8), L64(0x6bf8f8c7f8933fed), L64(0xc28686228644a411),
};
static const php_hash_uint64 C2[256] = {
L64(0x30d818186018c078), L64(0x462623238c2305af), L64(0x91b8c6c63fc67ef9), L64(0xcdfbe8e887e8136f),
L64(0x13cb878726874ca1), L64(0x6d11b8b8dab8a962), L64(0x0209010104010805), L64(0x9e0d4f4f214f426e),
L64(0x6c9b3636d836adee), L64(0x51ffa6a6a2a65904), L64(0xb90cd2d26fd2debd), L64(0xf70ef5f5f3f5fb06),
L64(0xf2967979f979ef80), L64(0xde306f6fa16f5fce), L64(0x3f6d91917e91fcef), L64(0xa4f852525552aa07),
L64(0xc04760609d6027fd), L64(0x6535bcbccabc8976), L64(0x2b379b9b569baccd), L64(0x018a8e8e028e048c),
L64(0x5bd2a3a3b6a37115), L64(0x186c0c0c300c603c), L64(0xf6847b7bf17bff8a), L64(0x6a803535d435b5e1),
L64(0x3af51d1d741de869), L64(0xddb3e0e0a7e05347), L64(0xb321d7d77bd7f6ac), L64(0x999cc2c22fc25eed),
L64(0x5c432e2eb82e6d96), L64(0x96294b4b314b627a), L64(0xe15dfefedffea321), L64(0xaed5575741578216),
L64(0x2abd15155415a841), L64(0xeee87777c1779fb6), L64(0x6e923737dc37a5eb), L64(0xd79ee5e5b3e57b56),
L64(0x23139f9f469f8cd9), L64(0xfd23f0f0e7f0d317), L64(0x94204a4a354a6a7f), L64(0xa944dada4fda9e95),
L64(0xb0a258587d58fa25), L64(0x8fcfc9c903c906ca), L64(0x527c2929a429558d), L64(0x145a0a0a280a5022),
L64(0x7f50b1b1feb1e14f), L64(0x5dc9a0a0baa0691a), L64(0xd6146b6bb16b7fda), L64(0x17d985852e855cab),
L64(0x673cbdbdcebd8173), L64(0xba8f5d5d695dd234), L64(0x2090101040108050), L64(0xf507f4f4f7f4f303),
L64(0x8bddcbcb0bcb16c0), L64(0x7cd33e3ef83eedc6), L64(0x0a2d050514052811), L64(0xce78676781671fe6),
L64(0xd597e4e4b7e47353), L64(0x4e0227279c2725bb), L64(0x8273414119413258), L64(0x0ba78b8b168b2c9d),
L64(0x53f6a7a7a6a75101), L64(0xfab27d7de97dcf94), L64(0x374995956e95dcfb), L64(0xad56d8d847d88e9f),
L64(0xeb70fbfbcbfb8b30), L64(0xc1cdeeee9fee2371), L64(0xf8bb7c7ced7cc791), L64(0xcc716666856617e3),
L64(0xa77bdddd53dda68e), L64(0x2eaf17175c17b84b), L64(0x8e45474701470246), L64(0x211a9e9e429e84dc),
L64(0x89d4caca0fca1ec5), L64(0x5a582d2db42d7599), L64(0x632ebfbfc6bf9179), L64(0x0e3f07071c07381b),
L64(0x47acadad8ead0123), L64(0xb4b05a5a755aea2f), L64(0x1bef838336836cb5), L64(0x66b63333cc3385ff),
L64(0xc65c636391633ff2), L64(0x041202020802100a), L64(0x4993aaaa92aa3938), L64(0xe2de7171d971afa8),
L64(0x8dc6c8c807c80ecf), L64(0x32d119196419c87d), L64(0x923b494939497270), L64(0xaf5fd9d943d9869a),
L64(0xf931f2f2eff2c31d), L64(0xdba8e3e3abe34b48), L64(0xb6b95b5b715be22a), L64(0x0dbc88881a883492),
L64(0x293e9a9a529aa4c8), L64(0x4c0b262698262dbe), L64(0x64bf3232c8328dfa), L64(0x7d59b0b0fab0e94a),
L64(0xcff2e9e983e91b6a), L64(0x1e770f0f3c0f7833), L64(0xb733d5d573d5e6a6), L64(0x1df480803a8074ba),
L64(0x6127bebec2be997c), L64(0x87ebcdcd13cd26de), L64(0x68893434d034bde4), L64(0x903248483d487a75),
L64(0xe354ffffdbffab24), L64(0xf48d7a7af57af78f), L64(0x3d6490907a90f4ea), L64(0xbe9d5f5f615fc23e),
L64(0x403d202080201da0), L64(0xd00f6868bd6867d5), L64(0x34ca1a1a681ad072), L64(0x41b7aeae82ae192c),
L64(0x757db4b4eab4c95e), L64(0xa8ce54544d549a19), L64(0x3b7f93937693ece5), L64(0x442f222288220daa),
L64(0xc86364648d6407e9), L64(0xff2af1f1e3f1db12), L64(0xe6cc7373d173bfa2), L64(0x248212124812905a),
L64(0x807a40401d403a5d), L64(0x1048080820084028), L64(0x9b95c3c32bc356e8), L64(0xc5dfecec97ec337b),
L64(0xab4ddbdb4bdb9690), L64(0x5fc0a1a1bea1611f), L64(0x07918d8d0e8d1c83), L64(0x7ac83d3df43df5c9),
L64(0x335b97976697ccf1), L64(0x0000000000000000), L64(0x83f9cfcf1bcf36d4), L64(0x566e2b2bac2b4587),
L64(0xece17676c57697b3), L64(0x19e68282328264b0), L64(0xb128d6d67fd6fea9), L64(0x36c31b1b6c1bd877),
L64(0x7774b5b5eeb5c15b), L64(0x43beafaf86af1129), L64(0xd41d6a6ab56a77df), L64(0xa0ea50505d50ba0d),
L64(0x8a5745450945124c), L64(0xfb38f3f3ebf3cb18), L64(0x60ad3030c0309df0), L64(0xc3c4efef9bef2b74),
L64(0x7eda3f3ffc3fe5c3), L64(0xaac755554955921c), L64(0x59dba2a2b2a27910), L64(0xc9e9eaea8fea0365),
L64(0xca6a656589650fec), L64(0x6903babad2bab968), L64(0x5e4a2f2fbc2f6593), L64(0x9d8ec0c027c04ee7),
L64(0xa160dede5fdebe81), L64(0x38fc1c1c701ce06c), L64(0xe746fdfdd3fdbb2e), L64(0x9a1f4d4d294d5264),
L64(0x397692927292e4e0), L64(0xeafa7575c9758fbc), L64(0x0c3606061806301e), L64(0x09ae8a8a128a2498),
L64(0x794bb2b2f2b2f940), L64(0xd185e6e6bfe66359), L64(0x1c7e0e0e380e7036), L64(0x3ee71f1f7c1ff863),
L64(0xc4556262956237f7), L64(0xb53ad4d477d4eea3), L64(0x4d81a8a89aa82932), L64(0x315296966296c4f4),
L64(0xef62f9f9c3f99b3a), L64(0x97a3c5c533c566f6), L64(0x4a102525942535b1), L64(0xb2ab59597959f220),
L64(0x15d084842a8454ae), L64(0xe4c57272d572b7a7), L64(0x72ec3939e439d5dd), L64(0x98164c4c2d4c5a61),
L64(0xbc945e5e655eca3b), L64(0xf09f7878fd78e785), L64(0x70e53838e038ddd8), L64(0x05988c8c0a8c1486),
L64(0xbf17d1d163d1c6b2), L64(0x57e4a5a5aea5410b), L64(0xd9a1e2e2afe2434d), L64(0xc24e616199612ff8),
L64(0x7b42b3b3f6b3f145), L64(0x42342121842115a5), L64(0x25089c9c4a9c94d6), L64(0x3cee1e1e781ef066),
L64(0x8661434311432252), L64(0x93b1c7c73bc776fc), L64(0xe54ffcfcd7fcb32b), L64(0x0824040410042014),
L64(0xa2e351515951b208), L64(0x2f2599995e99bcc7), L64(0xda226d6da96d4fc4), L64(0x1a650d0d340d6839),
L64(0xe979fafacffa8335), L64(0xa369dfdf5bdfb684), L64(0xfca97e7ee57ed79b), L64(0x4819242490243db4),
L64(0x76fe3b3bec3bc5d7), L64(0x4b9aabab96ab313d), L64(0x81f0cece1fce3ed1), L64(0x2299111144118855),
L64(0x03838f8f068f0c89), L64(0x9c044e4e254e4a6b), L64(0x7366b7b7e6b7d151), L64(0xcbe0ebeb8beb0b60),
L64(0x78c13c3cf03cfdcc), L64(0x1ffd81813e817cbf), L64(0x354094946a94d4fe), L64(0xf31cf7f7fbf7eb0c),
L64(0x6f18b9b9deb9a167), L64(0x268b13134c13985f), L64(0x58512c2cb02c7d9c), L64(0xbb05d3d36bd3d6b8),
L64(0xd38ce7e7bbe76b5c), L64(0xdc396e6ea56e57cb), L64(0x95aac4c437c46ef3), L64(0x061b03030c03180f),
L64(0xacdc565645568a13), L64(0x885e44440d441a49), L64(0xfea07f7fe17fdf9e), L64(0x4f88a9a99ea92137),
L64(0x54672a2aa82a4d82), L64(0x6b0abbbbd6bbb16d), L64(0x9f87c1c123c146e2), L64(0xa6f153535153a202),
L64(0xa572dcdc57dcae8b), L64(0x16530b0b2c0b5827), L64(0x27019d9d4e9d9cd3), L64(0xd82b6c6cad6c47c1),
L64(0x62a43131c43195f5), L64(0xe8f37474cd7487b9), L64(0xf115f6f6fff6e309), L64(0x8c4c464605460a43),
L64(0x45a5acac8aac0926), L64(0x0fb589891e893c97), L64(0x28b414145014a044), L64(0xdfbae1e1a3e15b42),
L64(0x2ca616165816b04e), L64(0x74f73a3ae83acdd2), L64(0xd2066969b9696fd0), L64(0x124109092409482d),
L64(0xe0d77070dd70a7ad), L64(0x716fb6b6e2b6d954), L64(0xbd1ed0d067d0ceb7), L64(0xc7d6eded93ed3b7e),
L64(0x85e2cccc17cc2edb), L64(0x8468424215422a57), L64(0x2d2c98985a98b4c2), L64(0x55eda4a4aaa4490e),
L64(0x50752828a0285d88), L64(0xb8865c5c6d5cda31), L64(0xed6bf8f8c7f8933f), L64(0x11c28686228644a4),
};
static const php_hash_uint64 C3[256] = {
L64(0x7830d818186018c0), L64(0xaf462623238c2305), L64(0xf991b8c6c63fc67e), L64(0x6fcdfbe8e887e813),
L64(0xa113cb878726874c), L64(0x626d11b8b8dab8a9), L64(0x0502090101040108), L64(0x6e9e0d4f4f214f42),
L64(0xee6c9b3636d836ad), L64(0x0451ffa6a6a2a659), L64(0xbdb90cd2d26fd2de), L64(0x06f70ef5f5f3f5fb),
L64(0x80f2967979f979ef), L64(0xcede306f6fa16f5f), L64(0xef3f6d91917e91fc), L64(0x07a4f852525552aa),
L64(0xfdc04760609d6027), L64(0x766535bcbccabc89), L64(0xcd2b379b9b569bac), L64(0x8c018a8e8e028e04),
L64(0x155bd2a3a3b6a371), L64(0x3c186c0c0c300c60), L64(0x8af6847b7bf17bff), L64(0xe16a803535d435b5),
L64(0x693af51d1d741de8), L64(0x47ddb3e0e0a7e053), L64(0xacb321d7d77bd7f6), L64(0xed999cc2c22fc25e),
L64(0x965c432e2eb82e6d), L64(0x7a96294b4b314b62), L64(0x21e15dfefedffea3), L64(0x16aed55757415782),
L64(0x412abd15155415a8), L64(0xb6eee87777c1779f), L64(0xeb6e923737dc37a5), L64(0x56d79ee5e5b3e57b),
L64(0xd923139f9f469f8c), L64(0x17fd23f0f0e7f0d3), L64(0x7f94204a4a354a6a), L64(0x95a944dada4fda9e),
L64(0x25b0a258587d58fa), L64(0xca8fcfc9c903c906), L64(0x8d527c2929a42955), L64(0x22145a0a0a280a50),
L64(0x4f7f50b1b1feb1e1), L64(0x1a5dc9a0a0baa069), L64(0xdad6146b6bb16b7f), L64(0xab17d985852e855c),
L64(0x73673cbdbdcebd81), L64(0x34ba8f5d5d695dd2), L64(0x5020901010401080), L64(0x03f507f4f4f7f4f3),
L64(0xc08bddcbcb0bcb16), L64(0xc67cd33e3ef83eed), L64(0x110a2d0505140528), L64(0xe6ce78676781671f),
L64(0x53d597e4e4b7e473), L64(0xbb4e0227279c2725), L64(0x5882734141194132), L64(0x9d0ba78b8b168b2c),
L64(0x0153f6a7a7a6a751), L64(0x94fab27d7de97dcf), L64(0xfb374995956e95dc), L64(0x9fad56d8d847d88e),
L64(0x30eb70fbfbcbfb8b), L64(0x71c1cdeeee9fee23), L64(0x91f8bb7c7ced7cc7), L64(0xe3cc716666856617),
L64(0x8ea77bdddd53dda6), L64(0x4b2eaf17175c17b8), L64(0x468e454747014702), L64(0xdc211a9e9e429e84),
L64(0xc589d4caca0fca1e), L64(0x995a582d2db42d75), L64(0x79632ebfbfc6bf91), L64(0x1b0e3f07071c0738),
L64(0x2347acadad8ead01), L64(0x2fb4b05a5a755aea), L64(0xb51bef838336836c), L64(0xff66b63333cc3385),
L64(0xf2c65c636391633f), L64(0x0a04120202080210), L64(0x384993aaaa92aa39), L64(0xa8e2de7171d971af),
L64(0xcf8dc6c8c807c80e), L64(0x7d32d119196419c8), L64(0x70923b4949394972), L64(0x9aaf5fd9d943d986),
L64(0x1df931f2f2eff2c3), L64(0x48dba8e3e3abe34b), L64(0x2ab6b95b5b715be2), L64(0x920dbc88881a8834),
L64(0xc8293e9a9a529aa4), L64(0xbe4c0b262698262d), L64(0xfa64bf3232c8328d), L64(0x4a7d59b0b0fab0e9),
L64(0x6acff2e9e983e91b), L64(0x331e770f0f3c0f78), L64(0xa6b733d5d573d5e6), L64(0xba1df480803a8074),
L64(0x7c6127bebec2be99), L64(0xde87ebcdcd13cd26), L64(0xe468893434d034bd), L64(0x75903248483d487a),
L64(0x24e354ffffdbffab), L64(0x8ff48d7a7af57af7), L64(0xea3d6490907a90f4), L64(0x3ebe9d5f5f615fc2),
L64(0xa0403d202080201d), L64(0xd5d00f6868bd6867), L64(0x7234ca1a1a681ad0), L64(0x2c41b7aeae82ae19),
L64(0x5e757db4b4eab4c9), L64(0x19a8ce54544d549a), L64(0xe53b7f93937693ec), L64(0xaa442f222288220d),
L64(0xe9c86364648d6407), L64(0x12ff2af1f1e3f1db), L64(0xa2e6cc7373d173bf), L64(0x5a24821212481290),
L64(0x5d807a40401d403a), L64(0x2810480808200840), L64(0xe89b95c3c32bc356), L64(0x7bc5dfecec97ec33),
L64(0x90ab4ddbdb4bdb96), L64(0x1f5fc0a1a1bea161), L64(0x8307918d8d0e8d1c), L64(0xc97ac83d3df43df5),
L64(0xf1335b97976697cc), L64(0x0000000000000000), L64(0xd483f9cfcf1bcf36), L64(0x87566e2b2bac2b45),
L64(0xb3ece17676c57697), L64(0xb019e68282328264), L64(0xa9b128d6d67fd6fe), L64(0x7736c31b1b6c1bd8),
L64(0x5b7774b5b5eeb5c1), L64(0x2943beafaf86af11), L64(0xdfd41d6a6ab56a77), L64(0x0da0ea50505d50ba),
L64(0x4c8a574545094512), L64(0x18fb38f3f3ebf3cb), L64(0xf060ad3030c0309d), L64(0x74c3c4efef9bef2b),
L64(0xc37eda3f3ffc3fe5), L64(0x1caac75555495592), L64(0x1059dba2a2b2a279), L64(0x65c9e9eaea8fea03),
L64(0xecca6a656589650f), L64(0x686903babad2bab9), L64(0x935e4a2f2fbc2f65), L64(0xe79d8ec0c027c04e),
L64(0x81a160dede5fdebe), L64(0x6c38fc1c1c701ce0), L64(0x2ee746fdfdd3fdbb), L64(0x649a1f4d4d294d52),
L64(0xe0397692927292e4), L64(0xbceafa7575c9758f), L64(0x1e0c360606180630), L64(0x9809ae8a8a128a24),
L64(0x40794bb2b2f2b2f9), L64(0x59d185e6e6bfe663), L64(0x361c7e0e0e380e70), L64(0x633ee71f1f7c1ff8),
L64(0xf7c4556262956237), L64(0xa3b53ad4d477d4ee), L64(0x324d81a8a89aa829), L64(0xf4315296966296c4),
L64(0x3aef62f9f9c3f99b), L64(0xf697a3c5c533c566), L64(0xb14a102525942535), L64(0x20b2ab59597959f2),
L64(0xae15d084842a8454), L64(0xa7e4c57272d572b7), L64(0xdd72ec3939e439d5), L64(0x6198164c4c2d4c5a),
L64(0x3bbc945e5e655eca), L64(0x85f09f7878fd78e7), L64(0xd870e53838e038dd), L64(0x8605988c8c0a8c14),
L64(0xb2bf17d1d163d1c6), L64(0x0b57e4a5a5aea541), L64(0x4dd9a1e2e2afe243), L64(0xf8c24e616199612f),
L64(0x457b42b3b3f6b3f1), L64(0xa542342121842115), L64(0xd625089c9c4a9c94), L64(0x663cee1e1e781ef0),
L64(0x5286614343114322), L64(0xfc93b1c7c73bc776), L64(0x2be54ffcfcd7fcb3), L64(0x1408240404100420),
L64(0x08a2e351515951b2), L64(0xc72f2599995e99bc), L64(0xc4da226d6da96d4f), L64(0x391a650d0d340d68),
L64(0x35e979fafacffa83), L64(0x84a369dfdf5bdfb6), L64(0x9bfca97e7ee57ed7), L64(0xb44819242490243d),
L64(0xd776fe3b3bec3bc5), L64(0x3d4b9aabab96ab31), L64(0xd181f0cece1fce3e), L64(0x5522991111441188),
L64(0x8903838f8f068f0c), L64(0x6b9c044e4e254e4a), L64(0x517366b7b7e6b7d1), L64(0x60cbe0ebeb8beb0b),
L64(0xcc78c13c3cf03cfd), L64(0xbf1ffd81813e817c), L64(0xfe354094946a94d4), L64(0x0cf31cf7f7fbf7eb),
L64(0x676f18b9b9deb9a1), L64(0x5f268b13134c1398), L64(0x9c58512c2cb02c7d), L64(0xb8bb05d3d36bd3d6),
L64(0x5cd38ce7e7bbe76b), L64(0xcbdc396e6ea56e57), L64(0xf395aac4c437c46e), L64(0x0f061b03030c0318),
L64(0x13acdc565645568a), L64(0x49885e44440d441a), L64(0x9efea07f7fe17fdf), L64(0x374f88a9a99ea921),
L64(0x8254672a2aa82a4d), L64(0x6d6b0abbbbd6bbb1), L64(0xe29f87c1c123c146), L64(0x02a6f153535153a2),
L64(0x8ba572dcdc57dcae), L64(0x2716530b0b2c0b58), L64(0xd327019d9d4e9d9c), L64(0xc1d82b6c6cad6c47),
L64(0xf562a43131c43195), L64(0xb9e8f37474cd7487), L64(0x09f115f6f6fff6e3), L64(0x438c4c464605460a),
L64(0x2645a5acac8aac09), L64(0x970fb589891e893c), L64(0x4428b414145014a0), L64(0x42dfbae1e1a3e15b),
L64(0x4e2ca616165816b0), L64(0xd274f73a3ae83acd), L64(0xd0d2066969b9696f), L64(0x2d12410909240948),
L64(0xade0d77070dd70a7), L64(0x54716fb6b6e2b6d9), L64(0xb7bd1ed0d067d0ce), L64(0x7ec7d6eded93ed3b),
L64(0xdb85e2cccc17cc2e), L64(0x578468424215422a), L64(0xc22d2c98985a98b4), L64(0x0e55eda4a4aaa449),
L64(0x8850752828a0285d), L64(0x31b8865c5c6d5cda), L64(0x3fed6bf8f8c7f893), L64(0xa411c28686228644),
};
static const php_hash_uint64 C4[256] = {
L64(0xc07830d818186018), L64(0x05af462623238c23), L64(0x7ef991b8c6c63fc6), L64(0x136fcdfbe8e887e8),
L64(0x4ca113cb87872687), L64(0xa9626d11b8b8dab8), L64(0x0805020901010401), L64(0x426e9e0d4f4f214f),
L64(0xadee6c9b3636d836), L64(0x590451ffa6a6a2a6), L64(0xdebdb90cd2d26fd2), L64(0xfb06f70ef5f5f3f5),
L64(0xef80f2967979f979), L64(0x5fcede306f6fa16f), L64(0xfcef3f6d91917e91), L64(0xaa07a4f852525552),
L64(0x27fdc04760609d60), L64(0x89766535bcbccabc), L64(0xaccd2b379b9b569b), L64(0x048c018a8e8e028e),
L64(0x71155bd2a3a3b6a3), L64(0x603c186c0c0c300c), L64(0xff8af6847b7bf17b), L64(0xb5e16a803535d435),
L64(0xe8693af51d1d741d), L64(0x5347ddb3e0e0a7e0), L64(0xf6acb321d7d77bd7), L64(0x5eed999cc2c22fc2),
L64(0x6d965c432e2eb82e), L64(0x627a96294b4b314b), L64(0xa321e15dfefedffe), L64(0x8216aed557574157),
L64(0xa8412abd15155415), L64(0x9fb6eee87777c177), L64(0xa5eb6e923737dc37), L64(0x7b56d79ee5e5b3e5),
L64(0x8cd923139f9f469f), L64(0xd317fd23f0f0e7f0), L64(0x6a7f94204a4a354a), L64(0x9e95a944dada4fda),
L64(0xfa25b0a258587d58), L64(0x06ca8fcfc9c903c9), L64(0x558d527c2929a429), L64(0x5022145a0a0a280a),
L64(0xe14f7f50b1b1feb1), L64(0x691a5dc9a0a0baa0), L64(0x7fdad6146b6bb16b), L64(0x5cab17d985852e85),
L64(0x8173673cbdbdcebd), L64(0xd234ba8f5d5d695d), L64(0x8050209010104010), L64(0xf303f507f4f4f7f4),
L64(0x16c08bddcbcb0bcb), L64(0xedc67cd33e3ef83e), L64(0x28110a2d05051405), L64(0x1fe6ce7867678167),
L64(0x7353d597e4e4b7e4), L64(0x25bb4e0227279c27), L64(0x3258827341411941), L64(0x2c9d0ba78b8b168b),
L64(0x510153f6a7a7a6a7), L64(0xcf94fab27d7de97d), L64(0xdcfb374995956e95), L64(0x8e9fad56d8d847d8),
L64(0x8b30eb70fbfbcbfb), L64(0x2371c1cdeeee9fee), L64(0xc791f8bb7c7ced7c), L64(0x17e3cc7166668566),
L64(0xa68ea77bdddd53dd), L64(0xb84b2eaf17175c17), L64(0x02468e4547470147), L64(0x84dc211a9e9e429e),
L64(0x1ec589d4caca0fca), L64(0x75995a582d2db42d), L64(0x9179632ebfbfc6bf), L64(0x381b0e3f07071c07),
L64(0x012347acadad8ead), L64(0xea2fb4b05a5a755a), L64(0x6cb51bef83833683), L64(0x85ff66b63333cc33),
L64(0x3ff2c65c63639163), L64(0x100a041202020802), L64(0x39384993aaaa92aa), L64(0xafa8e2de7171d971),
L64(0x0ecf8dc6c8c807c8), L64(0xc87d32d119196419), L64(0x7270923b49493949), L64(0x869aaf5fd9d943d9),
L64(0xc31df931f2f2eff2), L64(0x4b48dba8e3e3abe3), L64(0xe22ab6b95b5b715b), L64(0x34920dbc88881a88),
L64(0xa4c8293e9a9a529a), L64(0x2dbe4c0b26269826), L64(0x8dfa64bf3232c832), L64(0xe94a7d59b0b0fab0),
L64(0x1b6acff2e9e983e9), L64(0x78331e770f0f3c0f), L64(0xe6a6b733d5d573d5), L64(0x74ba1df480803a80),
L64(0x997c6127bebec2be), L64(0x26de87ebcdcd13cd), L64(0xbde468893434d034), L64(0x7a75903248483d48),
L64(0xab24e354ffffdbff), L64(0xf78ff48d7a7af57a), L64(0xf4ea3d6490907a90), L64(0xc23ebe9d5f5f615f),
L64(0x1da0403d20208020), L64(0x67d5d00f6868bd68), L64(0xd07234ca1a1a681a), L64(0x192c41b7aeae82ae),
L64(0xc95e757db4b4eab4), L64(0x9a19a8ce54544d54), L64(0xece53b7f93937693), L64(0x0daa442f22228822),
L64(0x07e9c86364648d64), L64(0xdb12ff2af1f1e3f1), L64(0xbfa2e6cc7373d173), L64(0x905a248212124812),
L64(0x3a5d807a40401d40), L64(0x4028104808082008), L64(0x56e89b95c3c32bc3), L64(0x337bc5dfecec97ec),
L64(0x9690ab4ddbdb4bdb), L64(0x611f5fc0a1a1bea1), L64(0x1c8307918d8d0e8d), L64(0xf5c97ac83d3df43d),
L64(0xccf1335b97976697), L64(0x0000000000000000), L64(0x36d483f9cfcf1bcf), L64(0x4587566e2b2bac2b),
L64(0x97b3ece17676c576), L64(0x64b019e682823282), L64(0xfea9b128d6d67fd6), L64(0xd87736c31b1b6c1b),
L64(0xc15b7774b5b5eeb5), L64(0x112943beafaf86af), L64(0x77dfd41d6a6ab56a), L64(0xba0da0ea50505d50),
L64(0x124c8a5745450945), L64(0xcb18fb38f3f3ebf3), L64(0x9df060ad3030c030), L64(0x2b74c3c4efef9bef),
L64(0xe5c37eda3f3ffc3f), L64(0x921caac755554955), L64(0x791059dba2a2b2a2), L64(0x0365c9e9eaea8fea),
L64(0x0fecca6a65658965), L64(0xb9686903babad2ba), L64(0x65935e4a2f2fbc2f), L64(0x4ee79d8ec0c027c0),
L64(0xbe81a160dede5fde), L64(0xe06c38fc1c1c701c), L64(0xbb2ee746fdfdd3fd), L64(0x52649a1f4d4d294d),
L64(0xe4e0397692927292), L64(0x8fbceafa7575c975), L64(0x301e0c3606061806), L64(0x249809ae8a8a128a),
L64(0xf940794bb2b2f2b2), L64(0x6359d185e6e6bfe6), L64(0x70361c7e0e0e380e), L64(0xf8633ee71f1f7c1f),
L64(0x37f7c45562629562), L64(0xeea3b53ad4d477d4), L64(0x29324d81a8a89aa8), L64(0xc4f4315296966296),
L64(0x9b3aef62f9f9c3f9), L64(0x66f697a3c5c533c5), L64(0x35b14a1025259425), L64(0xf220b2ab59597959),
L64(0x54ae15d084842a84), L64(0xb7a7e4c57272d572), L64(0xd5dd72ec3939e439), L64(0x5a6198164c4c2d4c),
L64(0xca3bbc945e5e655e), L64(0xe785f09f7878fd78), L64(0xddd870e53838e038), L64(0x148605988c8c0a8c),
L64(0xc6b2bf17d1d163d1), L64(0x410b57e4a5a5aea5), L64(0x434dd9a1e2e2afe2), L64(0x2ff8c24e61619961),
L64(0xf1457b42b3b3f6b3), L64(0x15a5423421218421), L64(0x94d625089c9c4a9c), L64(0xf0663cee1e1e781e),
L64(0x2252866143431143), L64(0x76fc93b1c7c73bc7), L64(0xb32be54ffcfcd7fc), L64(0x2014082404041004),
L64(0xb208a2e351515951), L64(0xbcc72f2599995e99), L64(0x4fc4da226d6da96d), L64(0x68391a650d0d340d),
L64(0x8335e979fafacffa), L64(0xb684a369dfdf5bdf), L64(0xd79bfca97e7ee57e), L64(0x3db4481924249024),
L64(0xc5d776fe3b3bec3b), L64(0x313d4b9aabab96ab), L64(0x3ed181f0cece1fce), L64(0x8855229911114411),
L64(0x0c8903838f8f068f), L64(0x4a6b9c044e4e254e), L64(0xd1517366b7b7e6b7), L64(0x0b60cbe0ebeb8beb),
L64(0xfdcc78c13c3cf03c), L64(0x7cbf1ffd81813e81), L64(0xd4fe354094946a94), L64(0xeb0cf31cf7f7fbf7),
L64(0xa1676f18b9b9deb9), L64(0x985f268b13134c13), L64(0x7d9c58512c2cb02c), L64(0xd6b8bb05d3d36bd3),
L64(0x6b5cd38ce7e7bbe7), L64(0x57cbdc396e6ea56e), L64(0x6ef395aac4c437c4), L64(0x180f061b03030c03),
L64(0x8a13acdc56564556), L64(0x1a49885e44440d44), L64(0xdf9efea07f7fe17f), L64(0x21374f88a9a99ea9),
L64(0x4d8254672a2aa82a), L64(0xb16d6b0abbbbd6bb), L64(0x46e29f87c1c123c1), L64(0xa202a6f153535153),
L64(0xae8ba572dcdc57dc), L64(0x582716530b0b2c0b), L64(0x9cd327019d9d4e9d), L64(0x47c1d82b6c6cad6c),
L64(0x95f562a43131c431), L64(0x87b9e8f37474cd74), L64(0xe309f115f6f6fff6), L64(0x0a438c4c46460546),
L64(0x092645a5acac8aac), L64(0x3c970fb589891e89), L64(0xa04428b414145014), L64(0x5b42dfbae1e1a3e1),
L64(0xb04e2ca616165816), L64(0xcdd274f73a3ae83a), L64(0x6fd0d2066969b969), L64(0x482d124109092409),
L64(0xa7ade0d77070dd70), L64(0xd954716fb6b6e2b6), L64(0xceb7bd1ed0d067d0), L64(0x3b7ec7d6eded93ed),
L64(0x2edb85e2cccc17cc), L64(0x2a57846842421542), L64(0xb4c22d2c98985a98), L64(0x490e55eda4a4aaa4),
L64(0x5d8850752828a028), L64(0xda31b8865c5c6d5c), L64(0x933fed6bf8f8c7f8), L64(0x44a411c286862286),
};
static const php_hash_uint64 C5[256] = {
L64(0x18c07830d8181860), L64(0x2305af462623238c), L64(0xc67ef991b8c6c63f), L64(0xe8136fcdfbe8e887),
L64(0x874ca113cb878726), L64(0xb8a9626d11b8b8da), L64(0x0108050209010104), L64(0x4f426e9e0d4f4f21),
L64(0x36adee6c9b3636d8), L64(0xa6590451ffa6a6a2), L64(0xd2debdb90cd2d26f), L64(0xf5fb06f70ef5f5f3),
L64(0x79ef80f2967979f9), L64(0x6f5fcede306f6fa1), L64(0x91fcef3f6d91917e), L64(0x52aa07a4f8525255),
L64(0x6027fdc04760609d), L64(0xbc89766535bcbcca), L64(0x9baccd2b379b9b56), L64(0x8e048c018a8e8e02),
L64(0xa371155bd2a3a3b6), L64(0x0c603c186c0c0c30), L64(0x7bff8af6847b7bf1), L64(0x35b5e16a803535d4),
L64(0x1de8693af51d1d74), L64(0xe05347ddb3e0e0a7), L64(0xd7f6acb321d7d77b), L64(0xc25eed999cc2c22f),
L64(0x2e6d965c432e2eb8), L64(0x4b627a96294b4b31), L64(0xfea321e15dfefedf), L64(0x578216aed5575741),
L64(0x15a8412abd151554), L64(0x779fb6eee87777c1), L64(0x37a5eb6e923737dc), L64(0xe57b56d79ee5e5b3),
L64(0x9f8cd923139f9f46), L64(0xf0d317fd23f0f0e7), L64(0x4a6a7f94204a4a35), L64(0xda9e95a944dada4f),
L64(0x58fa25b0a258587d), L64(0xc906ca8fcfc9c903), L64(0x29558d527c2929a4), L64(0x0a5022145a0a0a28),
L64(0xb1e14f7f50b1b1fe), L64(0xa0691a5dc9a0a0ba), L64(0x6b7fdad6146b6bb1), L64(0x855cab17d985852e),
L64(0xbd8173673cbdbdce), L64(0x5dd234ba8f5d5d69), L64(0x1080502090101040), L64(0xf4f303f507f4f4f7),
L64(0xcb16c08bddcbcb0b), L64(0x3eedc67cd33e3ef8), L64(0x0528110a2d050514), L64(0x671fe6ce78676781),
L64(0xe47353d597e4e4b7), L64(0x2725bb4e0227279c), L64(0x4132588273414119), L64(0x8b2c9d0ba78b8b16),
L64(0xa7510153f6a7a7a6), L64(0x7dcf94fab27d7de9), L64(0x95dcfb374995956e), L64(0xd88e9fad56d8d847),
L64(0xfb8b30eb70fbfbcb), L64(0xee2371c1cdeeee9f), L64(0x7cc791f8bb7c7ced), L64(0x6617e3cc71666685),
L64(0xdda68ea77bdddd53), L64(0x17b84b2eaf17175c), L64(0x4702468e45474701), L64(0x9e84dc211a9e9e42),
L64(0xca1ec589d4caca0f), L64(0x2d75995a582d2db4), L64(0xbf9179632ebfbfc6), L64(0x07381b0e3f07071c),
L64(0xad012347acadad8e), L64(0x5aea2fb4b05a5a75), L64(0x836cb51bef838336), L64(0x3385ff66b63333cc),
L64(0x633ff2c65c636391), L64(0x02100a0412020208), L64(0xaa39384993aaaa92), L64(0x71afa8e2de7171d9),
L64(0xc80ecf8dc6c8c807), L64(0x19c87d32d1191964), L64(0x497270923b494939), L64(0xd9869aaf5fd9d943),
L64(0xf2c31df931f2f2ef), L64(0xe34b48dba8e3e3ab), L64(0x5be22ab6b95b5b71), L64(0x8834920dbc88881a),
L64(0x9aa4c8293e9a9a52), L64(0x262dbe4c0b262698), L64(0x328dfa64bf3232c8), L64(0xb0e94a7d59b0b0fa),
L64(0xe91b6acff2e9e983), L64(0x0f78331e770f0f3c), L64(0xd5e6a6b733d5d573), L64(0x8074ba1df480803a),
L64(0xbe997c6127bebec2), L64(0xcd26de87ebcdcd13), L64(0x34bde468893434d0), L64(0x487a75903248483d),
L64(0xffab24e354ffffdb), L64(0x7af78ff48d7a7af5), L64(0x90f4ea3d6490907a), L64(0x5fc23ebe9d5f5f61),
L64(0x201da0403d202080), L64(0x6867d5d00f6868bd), L64(0x1ad07234ca1a1a68), L64(0xae192c41b7aeae82),
L64(0xb4c95e757db4b4ea), L64(0x549a19a8ce54544d), L64(0x93ece53b7f939376), L64(0x220daa442f222288),
L64(0x6407e9c86364648d), L64(0xf1db12ff2af1f1e3), L64(0x73bfa2e6cc7373d1), L64(0x12905a2482121248),
L64(0x403a5d807a40401d), L64(0x0840281048080820), L64(0xc356e89b95c3c32b), L64(0xec337bc5dfecec97),
L64(0xdb9690ab4ddbdb4b), L64(0xa1611f5fc0a1a1be), L64(0x8d1c8307918d8d0e), L64(0x3df5c97ac83d3df4),
L64(0x97ccf1335b979766), L64(0x0000000000000000), L64(0xcf36d483f9cfcf1b), L64(0x2b4587566e2b2bac),
L64(0x7697b3ece17676c5), L64(0x8264b019e6828232), L64(0xd6fea9b128d6d67f), L64(0x1bd87736c31b1b6c),
L64(0xb5c15b7774b5b5ee), L64(0xaf112943beafaf86), L64(0x6a77dfd41d6a6ab5), L64(0x50ba0da0ea50505d),
L64(0x45124c8a57454509), L64(0xf3cb18fb38f3f3eb), L64(0x309df060ad3030c0), L64(0xef2b74c3c4efef9b),
L64(0x3fe5c37eda3f3ffc), L64(0x55921caac7555549), L64(0xa2791059dba2a2b2), L64(0xea0365c9e9eaea8f),
L64(0x650fecca6a656589), L64(0xbab9686903babad2), L64(0x2f65935e4a2f2fbc), L64(0xc04ee79d8ec0c027),
L64(0xdebe81a160dede5f), L64(0x1ce06c38fc1c1c70), L64(0xfdbb2ee746fdfdd3), L64(0x4d52649a1f4d4d29),
L64(0x92e4e03976929272), L64(0x758fbceafa7575c9), L64(0x06301e0c36060618), L64(0x8a249809ae8a8a12),
L64(0xb2f940794bb2b2f2), L64(0xe66359d185e6e6bf), L64(0x0e70361c7e0e0e38), L64(0x1ff8633ee71f1f7c),
L64(0x6237f7c455626295), L64(0xd4eea3b53ad4d477), L64(0xa829324d81a8a89a), L64(0x96c4f43152969662),
L64(0xf99b3aef62f9f9c3), L64(0xc566f697a3c5c533), L64(0x2535b14a10252594), L64(0x59f220b2ab595979),
L64(0x8454ae15d084842a), L64(0x72b7a7e4c57272d5), L64(0x39d5dd72ec3939e4), L64(0x4c5a6198164c4c2d),
L64(0x5eca3bbc945e5e65), L64(0x78e785f09f7878fd), L64(0x38ddd870e53838e0), L64(0x8c148605988c8c0a),
L64(0xd1c6b2bf17d1d163), L64(0xa5410b57e4a5a5ae), L64(0xe2434dd9a1e2e2af), L64(0x612ff8c24e616199),
L64(0xb3f1457b42b3b3f6), L64(0x2115a54234212184), L64(0x9c94d625089c9c4a), L64(0x1ef0663cee1e1e78),
L64(0x4322528661434311), L64(0xc776fc93b1c7c73b), L64(0xfcb32be54ffcfcd7), L64(0x0420140824040410),
L64(0x51b208a2e3515159), L64(0x99bcc72f2599995e), L64(0x6d4fc4da226d6da9), L64(0x0d68391a650d0d34),
L64(0xfa8335e979fafacf), L64(0xdfb684a369dfdf5b), L64(0x7ed79bfca97e7ee5), L64(0x243db44819242490),
L64(0x3bc5d776fe3b3bec), L64(0xab313d4b9aabab96), L64(0xce3ed181f0cece1f), L64(0x1188552299111144),
L64(0x8f0c8903838f8f06), L64(0x4e4a6b9c044e4e25), L64(0xb7d1517366b7b7e6), L64(0xeb0b60cbe0ebeb8b),
L64(0x3cfdcc78c13c3cf0), L64(0x817cbf1ffd81813e), L64(0x94d4fe354094946a), L64(0xf7eb0cf31cf7f7fb),
L64(0xb9a1676f18b9b9de), L64(0x13985f268b13134c), L64(0x2c7d9c58512c2cb0), L64(0xd3d6b8bb05d3d36b),
L64(0xe76b5cd38ce7e7bb), L64(0x6e57cbdc396e6ea5), L64(0xc46ef395aac4c437), L64(0x03180f061b03030c),
L64(0x568a13acdc565645), L64(0x441a49885e44440d), L64(0x7fdf9efea07f7fe1), L64(0xa921374f88a9a99e),
L64(0x2a4d8254672a2aa8), L64(0xbbb16d6b0abbbbd6), L64(0xc146e29f87c1c123), L64(0x53a202a6f1535351),
L64(0xdcae8ba572dcdc57), L64(0x0b582716530b0b2c), L64(0x9d9cd327019d9d4e), L64(0x6c47c1d82b6c6cad),
L64(0x3195f562a43131c4), L64(0x7487b9e8f37474cd), L64(0xf6e309f115f6f6ff), L64(0x460a438c4c464605),
L64(0xac092645a5acac8a), L64(0x893c970fb589891e), L64(0x14a04428b4141450), L64(0xe15b42dfbae1e1a3),
L64(0x16b04e2ca6161658), L64(0x3acdd274f73a3ae8), L64(0x696fd0d2066969b9), L64(0x09482d1241090924),
L64(0x70a7ade0d77070dd), L64(0xb6d954716fb6b6e2), L64(0xd0ceb7bd1ed0d067), L64(0xed3b7ec7d6eded93),
L64(0xcc2edb85e2cccc17), L64(0x422a578468424215), L64(0x98b4c22d2c98985a), L64(0xa4490e55eda4a4aa),
L64(0x285d8850752828a0), L64(0x5cda31b8865c5c6d), L64(0xf8933fed6bf8f8c7), L64(0x8644a411c2868622),
};
static const php_hash_uint64 C6[256] = {
L64(0x6018c07830d81818), L64(0x8c2305af46262323), L64(0x3fc67ef991b8c6c6), L64(0x87e8136fcdfbe8e8),
L64(0x26874ca113cb8787), L64(0xdab8a9626d11b8b8), L64(0x0401080502090101), L64(0x214f426e9e0d4f4f),
L64(0xd836adee6c9b3636), L64(0xa2a6590451ffa6a6), L64(0x6fd2debdb90cd2d2), L64(0xf3f5fb06f70ef5f5),
L64(0xf979ef80f2967979), L64(0xa16f5fcede306f6f), L64(0x7e91fcef3f6d9191), L64(0x5552aa07a4f85252),
L64(0x9d6027fdc0476060), L64(0xcabc89766535bcbc), L64(0x569baccd2b379b9b), L64(0x028e048c018a8e8e),
L64(0xb6a371155bd2a3a3), L64(0x300c603c186c0c0c), L64(0xf17bff8af6847b7b), L64(0xd435b5e16a803535),
L64(0x741de8693af51d1d), L64(0xa7e05347ddb3e0e0), L64(0x7bd7f6acb321d7d7), L64(0x2fc25eed999cc2c2),
L64(0xb82e6d965c432e2e), L64(0x314b627a96294b4b), L64(0xdffea321e15dfefe), L64(0x41578216aed55757),
L64(0x5415a8412abd1515), L64(0xc1779fb6eee87777), L64(0xdc37a5eb6e923737), L64(0xb3e57b56d79ee5e5),
L64(0x469f8cd923139f9f), L64(0xe7f0d317fd23f0f0), L64(0x354a6a7f94204a4a), L64(0x4fda9e95a944dada),
L64(0x7d58fa25b0a25858), L64(0x03c906ca8fcfc9c9), L64(0xa429558d527c2929), L64(0x280a5022145a0a0a),
L64(0xfeb1e14f7f50b1b1), L64(0xbaa0691a5dc9a0a0), L64(0xb16b7fdad6146b6b), L64(0x2e855cab17d98585),
L64(0xcebd8173673cbdbd), L64(0x695dd234ba8f5d5d), L64(0x4010805020901010), L64(0xf7f4f303f507f4f4),
L64(0x0bcb16c08bddcbcb), L64(0xf83eedc67cd33e3e), L64(0x140528110a2d0505), L64(0x81671fe6ce786767),
L64(0xb7e47353d597e4e4), L64(0x9c2725bb4e022727), L64(0x1941325882734141), L64(0x168b2c9d0ba78b8b),
L64(0xa6a7510153f6a7a7), L64(0xe97dcf94fab27d7d), L64(0x6e95dcfb37499595), L64(0x47d88e9fad56d8d8),
L64(0xcbfb8b30eb70fbfb), L64(0x9fee2371c1cdeeee), L64(0xed7cc791f8bb7c7c), L64(0x856617e3cc716666),
L64(0x53dda68ea77bdddd), L64(0x5c17b84b2eaf1717), L64(0x014702468e454747), L64(0x429e84dc211a9e9e),
L64(0x0fca1ec589d4caca), L64(0xb42d75995a582d2d), L64(0xc6bf9179632ebfbf), L64(0x1c07381b0e3f0707),
L64(0x8ead012347acadad), L64(0x755aea2fb4b05a5a), L64(0x36836cb51bef8383), L64(0xcc3385ff66b63333),
L64(0x91633ff2c65c6363), L64(0x0802100a04120202), L64(0x92aa39384993aaaa), L64(0xd971afa8e2de7171),
L64(0x07c80ecf8dc6c8c8), L64(0x6419c87d32d11919), L64(0x39497270923b4949), L64(0x43d9869aaf5fd9d9),
L64(0xeff2c31df931f2f2), L64(0xabe34b48dba8e3e3), L64(0x715be22ab6b95b5b), L64(0x1a8834920dbc8888),
L64(0x529aa4c8293e9a9a), L64(0x98262dbe4c0b2626), L64(0xc8328dfa64bf3232), L64(0xfab0e94a7d59b0b0),
L64(0x83e91b6acff2e9e9), L64(0x3c0f78331e770f0f), L64(0x73d5e6a6b733d5d5), L64(0x3a8074ba1df48080),
L64(0xc2be997c6127bebe), L64(0x13cd26de87ebcdcd), L64(0xd034bde468893434), L64(0x3d487a7590324848),
L64(0xdbffab24e354ffff), L64(0xf57af78ff48d7a7a), L64(0x7a90f4ea3d649090), L64(0x615fc23ebe9d5f5f),
L64(0x80201da0403d2020), L64(0xbd6867d5d00f6868), L64(0x681ad07234ca1a1a), L64(0x82ae192c41b7aeae),
L64(0xeab4c95e757db4b4), L64(0x4d549a19a8ce5454), L64(0x7693ece53b7f9393), L64(0x88220daa442f2222),
L64(0x8d6407e9c8636464), L64(0xe3f1db12ff2af1f1), L64(0xd173bfa2e6cc7373), L64(0x4812905a24821212),
L64(0x1d403a5d807a4040), L64(0x2008402810480808), L64(0x2bc356e89b95c3c3), L64(0x97ec337bc5dfecec),
L64(0x4bdb9690ab4ddbdb), L64(0xbea1611f5fc0a1a1), L64(0x0e8d1c8307918d8d), L64(0xf43df5c97ac83d3d),
L64(0x6697ccf1335b9797), L64(0x0000000000000000), L64(0x1bcf36d483f9cfcf), L64(0xac2b4587566e2b2b),
L64(0xc57697b3ece17676), L64(0x328264b019e68282), L64(0x7fd6fea9b128d6d6), L64(0x6c1bd87736c31b1b),
L64(0xeeb5c15b7774b5b5), L64(0x86af112943beafaf), L64(0xb56a77dfd41d6a6a), L64(0x5d50ba0da0ea5050),
L64(0x0945124c8a574545), L64(0xebf3cb18fb38f3f3), L64(0xc0309df060ad3030), L64(0x9bef2b74c3c4efef),
L64(0xfc3fe5c37eda3f3f), L64(0x4955921caac75555), L64(0xb2a2791059dba2a2), L64(0x8fea0365c9e9eaea),
L64(0x89650fecca6a6565), L64(0xd2bab9686903baba), L64(0xbc2f65935e4a2f2f), L64(0x27c04ee79d8ec0c0),
L64(0x5fdebe81a160dede), L64(0x701ce06c38fc1c1c), L64(0xd3fdbb2ee746fdfd), L64(0x294d52649a1f4d4d),
L64(0x7292e4e039769292), L64(0xc9758fbceafa7575), L64(0x1806301e0c360606), L64(0x128a249809ae8a8a),
L64(0xf2b2f940794bb2b2), L64(0xbfe66359d185e6e6), L64(0x380e70361c7e0e0e), L64(0x7c1ff8633ee71f1f),
L64(0x956237f7c4556262), L64(0x77d4eea3b53ad4d4), L64(0x9aa829324d81a8a8), L64(0x6296c4f431529696),
L64(0xc3f99b3aef62f9f9), L64(0x33c566f697a3c5c5), L64(0x942535b14a102525), L64(0x7959f220b2ab5959),
L64(0x2a8454ae15d08484), L64(0xd572b7a7e4c57272), L64(0xe439d5dd72ec3939), L64(0x2d4c5a6198164c4c),
L64(0x655eca3bbc945e5e), L64(0xfd78e785f09f7878), L64(0xe038ddd870e53838), L64(0x0a8c148605988c8c),
L64(0x63d1c6b2bf17d1d1), L64(0xaea5410b57e4a5a5), L64(0xafe2434dd9a1e2e2), L64(0x99612ff8c24e6161),
L64(0xf6b3f1457b42b3b3), L64(0x842115a542342121), L64(0x4a9c94d625089c9c), L64(0x781ef0663cee1e1e),
L64(0x1143225286614343), L64(0x3bc776fc93b1c7c7), L64(0xd7fcb32be54ffcfc), L64(0x1004201408240404),
L64(0x5951b208a2e35151), L64(0x5e99bcc72f259999), L64(0xa96d4fc4da226d6d), L64(0x340d68391a650d0d),
L64(0xcffa8335e979fafa), L64(0x5bdfb684a369dfdf), L64(0xe57ed79bfca97e7e), L64(0x90243db448192424),
L64(0xec3bc5d776fe3b3b), L64(0x96ab313d4b9aabab), L64(0x1fce3ed181f0cece), L64(0x4411885522991111),
L64(0x068f0c8903838f8f), L64(0x254e4a6b9c044e4e), L64(0xe6b7d1517366b7b7), L64(0x8beb0b60cbe0ebeb),
L64(0xf03cfdcc78c13c3c), L64(0x3e817cbf1ffd8181), L64(0x6a94d4fe35409494), L64(0xfbf7eb0cf31cf7f7),
L64(0xdeb9a1676f18b9b9), L64(0x4c13985f268b1313), L64(0xb02c7d9c58512c2c), L64(0x6bd3d6b8bb05d3d3),
L64(0xbbe76b5cd38ce7e7), L64(0xa56e57cbdc396e6e), L64(0x37c46ef395aac4c4), L64(0x0c03180f061b0303),
L64(0x45568a13acdc5656), L64(0x0d441a49885e4444), L64(0xe17fdf9efea07f7f), L64(0x9ea921374f88a9a9),
L64(0xa82a4d8254672a2a), L64(0xd6bbb16d6b0abbbb), L64(0x23c146e29f87c1c1), L64(0x5153a202a6f15353),
L64(0x57dcae8ba572dcdc), L64(0x2c0b582716530b0b), L64(0x4e9d9cd327019d9d), L64(0xad6c47c1d82b6c6c),
L64(0xc43195f562a43131), L64(0xcd7487b9e8f37474), L64(0xfff6e309f115f6f6), L64(0x05460a438c4c4646),
L64(0x8aac092645a5acac), L64(0x1e893c970fb58989), L64(0x5014a04428b41414), L64(0xa3e15b42dfbae1e1),
L64(0x5816b04e2ca61616), L64(0xe83acdd274f73a3a), L64(0xb9696fd0d2066969), L64(0x2409482d12410909),
L64(0xdd70a7ade0d77070), L64(0xe2b6d954716fb6b6), L64(0x67d0ceb7bd1ed0d0), L64(0x93ed3b7ec7d6eded),
L64(0x17cc2edb85e2cccc), L64(0x15422a5784684242), L64(0x5a98b4c22d2c9898), L64(0xaaa4490e55eda4a4),
L64(0xa0285d8850752828), L64(0x6d5cda31b8865c5c), L64(0xc7f8933fed6bf8f8), L64(0x228644a411c28686),
};
static const php_hash_uint64 C7[256] = {
L64(0x186018c07830d818), L64(0x238c2305af462623), L64(0xc63fc67ef991b8c6), L64(0xe887e8136fcdfbe8),
L64(0x8726874ca113cb87), L64(0xb8dab8a9626d11b8), L64(0x0104010805020901), L64(0x4f214f426e9e0d4f),
L64(0x36d836adee6c9b36), L64(0xa6a2a6590451ffa6), L64(0xd26fd2debdb90cd2), L64(0xf5f3f5fb06f70ef5),
L64(0x79f979ef80f29679), L64(0x6fa16f5fcede306f), L64(0x917e91fcef3f6d91), L64(0x525552aa07a4f852),
L64(0x609d6027fdc04760), L64(0xbccabc89766535bc), L64(0x9b569baccd2b379b), L64(0x8e028e048c018a8e),
L64(0xa3b6a371155bd2a3), L64(0x0c300c603c186c0c), L64(0x7bf17bff8af6847b), L64(0x35d435b5e16a8035),
L64(0x1d741de8693af51d), L64(0xe0a7e05347ddb3e0), L64(0xd77bd7f6acb321d7), L64(0xc22fc25eed999cc2),
L64(0x2eb82e6d965c432e), L64(0x4b314b627a96294b), L64(0xfedffea321e15dfe), L64(0x5741578216aed557),
L64(0x155415a8412abd15), L64(0x77c1779fb6eee877), L64(0x37dc37a5eb6e9237), L64(0xe5b3e57b56d79ee5),
L64(0x9f469f8cd923139f), L64(0xf0e7f0d317fd23f0), L64(0x4a354a6a7f94204a), L64(0xda4fda9e95a944da),
L64(0x587d58fa25b0a258), L64(0xc903c906ca8fcfc9), L64(0x29a429558d527c29), L64(0x0a280a5022145a0a),
L64(0xb1feb1e14f7f50b1), L64(0xa0baa0691a5dc9a0), L64(0x6bb16b7fdad6146b), L64(0x852e855cab17d985),
L64(0xbdcebd8173673cbd), L64(0x5d695dd234ba8f5d), L64(0x1040108050209010), L64(0xf4f7f4f303f507f4),
L64(0xcb0bcb16c08bddcb), L64(0x3ef83eedc67cd33e), L64(0x05140528110a2d05), L64(0x6781671fe6ce7867),
L64(0xe4b7e47353d597e4), L64(0x279c2725bb4e0227), L64(0x4119413258827341), L64(0x8b168b2c9d0ba78b),
L64(0xa7a6a7510153f6a7), L64(0x7de97dcf94fab27d), L64(0x956e95dcfb374995), L64(0xd847d88e9fad56d8),
L64(0xfbcbfb8b30eb70fb), L64(0xee9fee2371c1cdee), L64(0x7ced7cc791f8bb7c), L64(0x66856617e3cc7166),
L64(0xdd53dda68ea77bdd), L64(0x175c17b84b2eaf17), L64(0x47014702468e4547), L64(0x9e429e84dc211a9e),
L64(0xca0fca1ec589d4ca), L64(0x2db42d75995a582d), L64(0xbfc6bf9179632ebf), L64(0x071c07381b0e3f07),
L64(0xad8ead012347acad), L64(0x5a755aea2fb4b05a), L64(0x8336836cb51bef83), L64(0x33cc3385ff66b633),
L64(0x6391633ff2c65c63), L64(0x020802100a041202), L64(0xaa92aa39384993aa), L64(0x71d971afa8e2de71),
L64(0xc807c80ecf8dc6c8), L64(0x196419c87d32d119), L64(0x4939497270923b49), L64(0xd943d9869aaf5fd9),
L64(0xf2eff2c31df931f2), L64(0xe3abe34b48dba8e3), L64(0x5b715be22ab6b95b), L64(0x881a8834920dbc88),
L64(0x9a529aa4c8293e9a), L64(0x2698262dbe4c0b26), L64(0x32c8328dfa64bf32), L64(0xb0fab0e94a7d59b0),
L64(0xe983e91b6acff2e9), L64(0x0f3c0f78331e770f), L64(0xd573d5e6a6b733d5), L64(0x803a8074ba1df480),
L64(0xbec2be997c6127be), L64(0xcd13cd26de87ebcd), L64(0x34d034bde4688934), L64(0x483d487a75903248),
L64(0xffdbffab24e354ff), L64(0x7af57af78ff48d7a), L64(0x907a90f4ea3d6490), L64(0x5f615fc23ebe9d5f),
L64(0x2080201da0403d20), L64(0x68bd6867d5d00f68), L64(0x1a681ad07234ca1a), L64(0xae82ae192c41b7ae),
L64(0xb4eab4c95e757db4), L64(0x544d549a19a8ce54), L64(0x937693ece53b7f93), L64(0x2288220daa442f22),
L64(0x648d6407e9c86364), L64(0xf1e3f1db12ff2af1), L64(0x73d173bfa2e6cc73), L64(0x124812905a248212),
L64(0x401d403a5d807a40), L64(0x0820084028104808), L64(0xc32bc356e89b95c3), L64(0xec97ec337bc5dfec),
L64(0xdb4bdb9690ab4ddb), L64(0xa1bea1611f5fc0a1), L64(0x8d0e8d1c8307918d), L64(0x3df43df5c97ac83d),
L64(0x976697ccf1335b97), L64(0x0000000000000000), L64(0xcf1bcf36d483f9cf), L64(0x2bac2b4587566e2b),
L64(0x76c57697b3ece176), L64(0x82328264b019e682), L64(0xd67fd6fea9b128d6), L64(0x1b6c1bd87736c31b),
L64(0xb5eeb5c15b7774b5), L64(0xaf86af112943beaf), L64(0x6ab56a77dfd41d6a), L64(0x505d50ba0da0ea50),
L64(0x450945124c8a5745), L64(0xf3ebf3cb18fb38f3), L64(0x30c0309df060ad30), L64(0xef9bef2b74c3c4ef),
L64(0x3ffc3fe5c37eda3f), L64(0x554955921caac755), L64(0xa2b2a2791059dba2), L64(0xea8fea0365c9e9ea),
L64(0x6589650fecca6a65), L64(0xbad2bab9686903ba), L64(0x2fbc2f65935e4a2f), L64(0xc027c04ee79d8ec0),
L64(0xde5fdebe81a160de), L64(0x1c701ce06c38fc1c), L64(0xfdd3fdbb2ee746fd), L64(0x4d294d52649a1f4d),
L64(0x927292e4e0397692), L64(0x75c9758fbceafa75), L64(0x061806301e0c3606), L64(0x8a128a249809ae8a),
L64(0xb2f2b2f940794bb2), L64(0xe6bfe66359d185e6), L64(0x0e380e70361c7e0e), L64(0x1f7c1ff8633ee71f),
L64(0x62956237f7c45562), L64(0xd477d4eea3b53ad4), L64(0xa89aa829324d81a8), L64(0x966296c4f4315296),
L64(0xf9c3f99b3aef62f9), L64(0xc533c566f697a3c5), L64(0x25942535b14a1025), L64(0x597959f220b2ab59),
L64(0x842a8454ae15d084), L64(0x72d572b7a7e4c572), L64(0x39e439d5dd72ec39), L64(0x4c2d4c5a6198164c),
L64(0x5e655eca3bbc945e), L64(0x78fd78e785f09f78), L64(0x38e038ddd870e538), L64(0x8c0a8c148605988c),
L64(0xd163d1c6b2bf17d1), L64(0xa5aea5410b57e4a5), L64(0xe2afe2434dd9a1e2), L64(0x6199612ff8c24e61),
L64(0xb3f6b3f1457b42b3), L64(0x21842115a5423421), L64(0x9c4a9c94d625089c), L64(0x1e781ef0663cee1e),
L64(0x4311432252866143), L64(0xc73bc776fc93b1c7), L64(0xfcd7fcb32be54ffc), L64(0x0410042014082404),
L64(0x515951b208a2e351), L64(0x995e99bcc72f2599), L64(0x6da96d4fc4da226d), L64(0x0d340d68391a650d),
L64(0xfacffa8335e979fa), L64(0xdf5bdfb684a369df), L64(0x7ee57ed79bfca97e), L64(0x2490243db4481924),
L64(0x3bec3bc5d776fe3b), L64(0xab96ab313d4b9aab), L64(0xce1fce3ed181f0ce), L64(0x1144118855229911),
L64(0x8f068f0c8903838f), L64(0x4e254e4a6b9c044e), L64(0xb7e6b7d1517366b7), L64(0xeb8beb0b60cbe0eb),
L64(0x3cf03cfdcc78c13c), L64(0x813e817cbf1ffd81), L64(0x946a94d4fe354094), L64(0xf7fbf7eb0cf31cf7),
L64(0xb9deb9a1676f18b9), L64(0x134c13985f268b13), L64(0x2cb02c7d9c58512c), L64(0xd36bd3d6b8bb05d3),
L64(0xe7bbe76b5cd38ce7), L64(0x6ea56e57cbdc396e), L64(0xc437c46ef395aac4), L64(0x030c03180f061b03),
L64(0x5645568a13acdc56), L64(0x440d441a49885e44), L64(0x7fe17fdf9efea07f), L64(0xa99ea921374f88a9),
L64(0x2aa82a4d8254672a), L64(0xbbd6bbb16d6b0abb), L64(0xc123c146e29f87c1), L64(0x535153a202a6f153),
L64(0xdc57dcae8ba572dc), L64(0x0b2c0b582716530b), L64(0x9d4e9d9cd327019d), L64(0x6cad6c47c1d82b6c),
L64(0x31c43195f562a431), L64(0x74cd7487b9e8f374), L64(0xf6fff6e309f115f6), L64(0x4605460a438c4c46),
L64(0xac8aac092645a5ac), L64(0x891e893c970fb589), L64(0x145014a04428b414), L64(0xe1a3e15b42dfbae1),
L64(0x165816b04e2ca616), L64(0x3ae83acdd274f73a), L64(0x69b9696fd0d20669), L64(0x092409482d124109),
L64(0x70dd70a7ade0d770), L64(0xb6e2b6d954716fb6), L64(0xd067d0ceb7bd1ed0), L64(0xed93ed3b7ec7d6ed),
L64(0xcc17cc2edb85e2cc), L64(0x4215422a57846842), L64(0x985a98b4c22d2c98), L64(0xa4aaa4490e55eda4),
L64(0x28a0285d88507528), L64(0x5c6d5cda31b8865c), L64(0xf8c7f8933fed6bf8), L64(0x86228644a411c286),
};
#endif
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: sw=4 ts=4 fdm=marker
* vim<600: sw=4 ts=4
*/
-22
View File
@@ -1,22 +0,0 @@
--TEST--
ADLER32
--SKIPIF--
<?php extension_loaded('hash') or die('skip'); ?>
--FILE--
<?php
echo hash('adler32', ''), "\n";
echo hash('adler32', 'a'), "\n";
echo hash('adler32', 'abc'), "\n";
echo hash('adler32', 'message digest'), "\n";
echo hash('adler32', 'abcdefghijklmnopqrstuvwxyz'), "\n";
echo hash('adler32', 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'), "\n";
echo hash('adler32', '12345678901234567890123456789012345678901234567890123456789012345678901234567890'), "\n";
?>
--EXPECT--
01000000
62006200
27014d02
86057529
200b8690
0c15db8a
6910b697
-36
View File
@@ -1,36 +0,0 @@
--TEST--
CRC32
--SKIPIF--
<?php extension_loaded('hash') or die('skip'); ?>
--FILE--
<?php
echo hash('crc32', ''), "\n";
echo hash('crc32', 'a'), "\n";
echo hash('crc32', 'abc'), "\n";
echo hash('crc32', 'message digest'), "\n";
echo hash('crc32', 'abcdefghijklmnopqrstuvwxyz'), "\n";
echo hash('crc32', 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'), "\n";
echo hash('crc32', '12345678901234567890123456789012345678901234567890123456789012345678901234567890'), "\n";
echo hash('crc32b', ''), "\n";
echo hash('crc32b', 'a'), "\n";
echo hash('crc32b', 'abc'), "\n";
echo hash('crc32b', 'message digest'), "\n";
echo hash('crc32b', 'abcdefghijklmnopqrstuvwxyz'), "\n";
echo hash('crc32b', 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'), "\n";
echo hash('crc32b', '12345678901234567890123456789012345678901234567890123456789012345678901234567890'), "\n";
?>
--EXPECT--
00000000
6b9b9319
73bb8c64
5703c9bf
9693bf77
882174a0
96790816
00000000
43beb7e8
c2412435
7f9d1520
bd50274c
d2e6c21f
724aa97c
-20
View File
@@ -1,20 +0,0 @@
--TEST--
gost
--SKIPIF--
<?php extension_loaded('hash') or die('skip'); ?>
--FILE--
<?php
echo hash('gost', ''), "\n";
echo hash('gost', 'The quick brown fox jumps over the lazy dog'), "\n";
echo hash('gost', 'The quick brown fox jumps over the lazy cog'), "\n";
echo hash('gost', str_repeat('a', 31)), "\n";
echo hash('gost', str_repeat('a', 32)), "\n";
echo hash('gost', str_repeat('a', 33)), "\n";
?>
--EXPECT--
ce85b99cc46752fffee35cab9a7b0278abb4c2d2055cff685af4912c49490f8d
77b7fa410c9ac58a25f49bca7d0468c9296529315eaca76bd1a10f376d1f4294
a3ebc4daaab78b0be131dab5737a7f67e602670d543521319150d2e14eeec445
03840d6348763f11e28e7b1ecc4da0cdf7f898fa555b928ef684c6c5b8f46d9f
fd1b746d9397e78edd311baef391450434271e02816caa37680d6d7381c79d4e
715e59cdc8ebde9fdf0fe2a2e811b3bf7f48209a01505e467d2cd2aa2bbb5ecf
-76
View File
@@ -1,76 +0,0 @@
--TEST--
haval algorithm (multi-vector, multi-pass, multi-width)
--SKIPIF--
<?php if(!extension_loaded("hash")) print "skip"; ?>
--FILE--
<?php
echo "Empty String\n";
for($pass=3; $pass<=5; $pass++)
for($bits=128; $bits <= 256; $bits += 32) {
$algo = sprintf('haval%d,%d',$bits,$pass);
echo $algo . ': ' . hash($algo,'') . "\n";
}
echo "\"abc\"\n";
for($pass=3; $pass<=5; $pass++)
for($bits=128; $bits <= 256; $bits += 32) {
$algo = sprintf('haval%d,%d',$bits,$pass);
echo $algo . ': ' . hash($algo,'abc') . "\n";
}
echo "\"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ0123456789\"\n";
for($pass=3; $pass<=5; $pass++)
for($bits=128; $bits <= 256; $bits += 32) {
$algo = sprintf('haval%d,%d',$bits,$pass);
echo $algo . ': ' . hash($algo,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ0123456789') . "\n";
}
--EXPECT--
Empty String
haval128,3: c68f39913f901f3ddf44c707357a7d70
haval160,3: d353c3ae22a25401d257643836d7231a9a95f953
haval192,3: e9c48d7903eaf2a91c5b350151efcb175c0fc82de2289a4e
haval224,3: c5aae9d47bffcaaf84a8c6e7ccacd60a0dd1932be7b1a192b9214b6d
haval256,3: 4f6938531f0bc8991f62da7bbd6f7de3fad44562b8c6f4ebf146d5b4e46f7c17
haval128,4: ee6bbf4d6a46a679b3a856c88538bb98
haval160,4: 1d33aae1be4146dbaaca0b6e70d7a11f10801525
haval192,4: 4a8372945afa55c7dead800311272523ca19d42ea47b72da
haval224,4: 3e56243275b3b81561750550e36fcd676ad2f5dd9e15f2e89e6ed78e
haval256,4: c92b2e23091e80e375dadce26982482d197b1a2521be82da819f8ca2c579b99b
haval128,5: 184b8482a0c050dca54b59c7f05bf5dd
haval160,5: 255158cfc1eed1a7be7c55ddd64d9790415b933b
haval192,5: 4839d0626f95935e17ee2fc4509387bbe2cc46cb382ffe85
haval224,5: 4a0513c032754f5582a758d35917ac9adf3854219b39e3ac77d1837e
haval256,5: be417bb4dd5cfb76c7126f4f8eeb1553a449039307b1a3cd451dbfdc0fbbe330
"abc"
haval128,3: 9e40ed883fb63e985d299b40cda2b8f2
haval160,3: b21e876c4d391e2a897661149d83576b5530a089
haval192,3: a7b14c9ef3092319b0e75e3b20b957d180bf20745629e8de
haval224,3: 5bc955220ba2346a948d2848eca37bdd5eca6ecca7b594bd32923fab
haval256,3: 8699f1e3384d05b2a84b032693e2b6f46df85a13a50d93808d6874bb8fb9e86c
haval128,4: 6f2132867c9648419adcd5013e532fa2
haval160,4: 77aca22f5b12cc09010afc9c0797308638b1cb9b
haval192,4: 7e29881ed05c915903dd5e24a8e81cde5d910142ae66207c
haval224,4: 124c43d2ba4884599d013e8c872bfea4c88b0b6bf6303974cbe04e68
haval256,4: 8f409f1bb6b30c5016fdce55f652642261575bedca0b9533f32f5455459142b5
haval128,5: d054232fe874d9c6c6dc8e6a853519ea
haval160,5: ae646b04845e3351f00c5161d138940e1fa0c11c
haval192,5: d12091104555b00119a8d07808a3380bf9e60018915b9025
haval224,5: 8081027a500147c512e5f1055986674d746d92af4841abeb89da64ad
haval256,5: 976cd6254c337969e5913b158392a2921af16fca51f5601d486e0a9de01156e7
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ0123456789"
haval128,3: ddf4304cc5ffa3db8aab60d4f8fc2a00
haval160,3: e709559359b15917623050e41d27a306c6c3a9db
haval192,3: 51e25280ad356c06f4b913b3cdb3abaaac5879dda0a4fea4
haval224,3: 28aa2c164e10bb3076574cc8aa8584fd6d04f6d82c37ea5c21e451b3
haval256,3: 5537364e3d75174b846d21adf9b113f9d8f97e4750df64d428c01e782f9ade4d
haval128,4: c7d981e8270e39888ba96cafe8745636
haval160,4: 3444e38cc2a132b818b554ced8f7d9592df28f57
haval192,4: 0ca58f140ed92828a27913ce5636611abcada220fccf3af7
haval224,4: a9d0571d0857773e71363e4e9dfcca4696dba3e5019e7225e65e0cb1
haval256,4: 1858d106bdc2fc787445364a163cfc6027597a45a58a2490d14203c8b9bdd268
haval128,5: d41e927ea041d2f0c255352b1a9f6195
haval160,5: f3245e222e6581d0c3077bd7af322af4b4fedab7
haval192,5: fc45dc17a7b19adfed2a6485921f7af7951d70703b9357c1
haval224,5: 29687958a6f0d54d495105df00dbda0153ee0f5708408db68a5bbea5
haval256,5: f93421623f852ac877584d1e4bba5d9345a95f81bfd277fe36dfeed1815f83d5
-20
View File
@@ -1,20 +0,0 @@
--TEST--
hmac-md5 algorithm
--SKIPIF--
<?php if(!extension_loaded("hash")) print "skip"; ?>
--FILE--
<?php
/* Test Vectors from RFC 2104 */
$ctx = hash_init('md5',HASH_HMAC,str_repeat(chr(0x0b), 16));
hash_update($ctx, 'Hi There');
echo hash_final($ctx) . "\n";
$ctx = hash_init('md5',HASH_HMAC,'Jefe');
hash_update($ctx, 'what do ya want for nothing?');
echo hash_final($ctx) . "\n";
echo hash_hmac('md5', str_repeat(chr(0xDD), 50), str_repeat(chr(0xAA), 16)) . "\n";
--EXPECT--
9294727a3638bb1c13f48ef8158bfc9d
750c783e6ab0b503eaa86e310a5db738
56be34521d144c88dbb8c733f0e8b3f6
-24
View File
@@ -1,24 +0,0 @@
--TEST--
md4 algorithm
--SKIPIF--
<?php if(!extension_loaded("hash")) print "skip"; ?>
--FILE--
<?php
/* RFC 1320 vectors */
echo hash('md4', '') . "\n";
echo hash('md4', 'a') . "\n";
echo hash('md4', 'abc') . "\n";
echo hash('md4', 'message digest') . "\n";
echo hash('md4', 'abcdefghijklmnopqrstuvwxyz') . "\n";
echo hash('md4', 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789') . "\n";
echo hash('md4', '12345678901234567890123456789012345678901234567890123456789012345678901234567890') . "\n";
--EXPECT--
31d6cfe0d16ae931b73c59d7e0c089c0
bde52cb31de33e46245e05fbdbd6fb24
a448017aaf21d8525fc10ae87aa6729d
d9130a8164549fe818874806e1c7014b
d79e1c308aa5bbcdeea8ed63df412da9
043f8582f241db351ce627e153e7f0e4
e33b4ddc9c38f2199c3e7b164fcc0536
-16
View File
@@ -1,16 +0,0 @@
--TEST--
md5 algorithm
--SKIPIF--
<?php if(!extension_loaded("hash")) print "skip"; ?>
--FILE--
<?php
echo hash('md5', '') . "\n";
echo hash('md5', 'a') . "\n";
echo hash('md5', '012345678901234567890123456789012345678901234567890123456789') . "\n";
echo hash('md5', str_repeat('a', 1000000)) . "\n";
--EXPECT--
d41d8cd98f00b204e9800998ecf8427e
0cc175b9c0f1b6a831c399e269772661
1ced811af47ead374872fcca9d73dd71
7707d6ae4e027c70eea2a935c2296f21
-25
View File
@@ -1,25 +0,0 @@
--TEST--
ripemd128 algorithm
--SKIPIF--
<?php if(!extension_loaded("hash")) print "skip"; ?>
--FILE--
<?php
echo hash('ripemd128', '') . "\n";
echo hash('ripemd128', 'a') . "\n";
echo hash('ripemd128', 'abc') . "\n";
echo hash('ripemd128', 'message digest') . "\n";
echo hash('ripemd128', 'abcdefghijklmnopqrstuvwxyz') . "\n";
echo hash('ripemd128', 'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq') . "\n";
echo hash('ripemd128', 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789') . "\n";
echo hash('ripemd128', '12345678901234567890123456789012345678901234567890123456789012345678901234567890') . "\n";
echo hash('ripemd128', str_repeat('a', 1000000)) . "\n";
--EXPECT--
cdf26213a150dc3ecb610f18f6b38b46
86be7afa339d0fc7cfc785e72f578d33
c14a12199c66e4ba84636b0f69144c77
9e327b3d6e523062afc1132d7df9d1b8
fd2aa607f71dc8f510714922b371834e
a1aa0689d0fafa2ddc22e88b49133a06
d1e959eb179c911faea4624c60c5c702
3f45ef194732c2dbb2c4a2c769795fa3
4a7f5723f954eba1216c9d8f6320431f
-25
View File
@@ -1,25 +0,0 @@
--TEST--
ripemd160 algorithm
--SKIPIF--
<?php if(!extension_loaded("hash")) print "skip"; ?>
--FILE--
<?php
echo hash('ripemd160', '') . "\n";
echo hash('ripemd160', 'a') . "\n";
echo hash('ripemd160', 'abc') . "\n";
echo hash('ripemd160', 'message digest') . "\n";
echo hash('ripemd160', 'abcdefghijklmnopqrstuvwxyz') . "\n";
echo hash('ripemd160', 'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq') . "\n";
echo hash('ripemd160', 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789') . "\n";
echo hash('ripemd160', '12345678901234567890123456789012345678901234567890123456789012345678901234567890') . "\n";
echo hash('ripemd160', str_repeat('a', 1000000)) . "\n";
--EXPECT--
9c1185a5c5e9fc54612808977ee8f548b2258d31
0bdc9d2d256b3ee9daae347be6f4dc835a467ffe
8eb208f7e05d987a9b044a8e98c6b087f15a0bfc
5d0689ef49d2fae572b881b123a85ffa21595f36
f71c27109c692c1b56bbdceb5b9d2865b3708dbc
12a053384a9c0c88e405a06c27dcf49ada62eb2b
b0e20b6e3116640286ed3a87a5713079b21f5189
9b752e45573d4b39f4dbd3323cab82bf63326bfb
52783243c1697bdbe16d37f97f68f08325dc1528
-21
View File
@@ -1,21 +0,0 @@
--TEST--
sha1 algorithm
--SKIPIF--
<?php if(!extension_loaded("hash")) print "skip"; ?>
--FILE--
<?php
echo hash('sha1', '') . "\n";
echo hash('sha1', 'a') . "\n";
echo hash('sha1', '012345678901234567890123456789012345678901234567890123456789') . "\n";
/* FIPS-180 Vectors */
echo hash('sha1', 'abc') . "\n";
echo hash('sha1', 'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq') . "\n";
echo hash('sha1', str_repeat('a', 1000000)) . "\n";
--EXPECT--
da39a3ee5e6b4b0d3255bfef95601890afd80709
86f7e437faa5a7fce15d1ddcb9eaeaea377667b8
f52e3c2732de7bea28f216d877d78dae1aa1ac6a
a9993e364706816aba3e25717850c26c9cd0d89d
84983e441c3bd26ebaae4aa1f95129e5e54670f1
34aa973cd4c4daa4f61eeb2bdbad27316534016f
-22
View File
@@ -1,22 +0,0 @@
--TEST--
sha256 algorithm
--SKIPIF--
<?php if(!extension_loaded("hash")) print "skip"; ?>
--FILE--
<?php
echo hash('sha256', '') . "\n";
echo hash('sha256', 'a') . "\n";
echo hash('sha256', '012345678901234567890123456789012345678901234567890123456789') . "\n";
/* FIPS-180 Vectors */
echo hash('sha256', 'abc') . "\n";
echo hash('sha256', 'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq') . "\n";
echo hash('sha256', str_repeat('a', 1000000)) . "\n";
--EXPECT--
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb
5e43c8704ac81f33d701c1ace046ba9f257062b4d17e78f3254cbf243177e4f2
ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad
248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1
cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0
-21
View File
@@ -1,21 +0,0 @@
--TEST--
sha384 algorithm
--SKIPIF--
<?php if(!extension_loaded("hash")) print "skip"; ?>
--FILE--
<?php
echo hash('sha384', '') . "\n";
echo hash('sha384', 'a') . "\n";
echo hash('sha384', '012345678901234567890123456789012345678901234567890123456789') . "\n";
/* FIPS-180 Vectors */
echo hash('sha384', 'abc') . "\n";
echo hash('sha384', 'abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu') . "\n";
echo hash('sha384', str_repeat('a', 1000000)) . "\n";
--EXPECT--
38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b
54a59b9f22b0b80880d8427e548b7c23abd873486e1f035dce9cd697e85175033caa88e6d57bc35efae0b5afd3145f31
ce6bebce38aad0fd35805b50f77f3e1814d46df8e930356ec905a5d7b94bfa615fce4c3b6caf50eb4a7f1a1164887470
cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7
09330c33f71147e83d192fc782cd1b4753111b173b3b05d22fa08086e3b0f712fcc7c71a557e2db966c3e9fa91746039
9d0e1809716474cb086e834e310a4a1ced149e9c00f248527972cec5704c2a5b07b8b3dc38ecc4ebae97ddd87f3d8985
-21
View File
@@ -1,21 +0,0 @@
--TEST--
sha512 algorithm
--SKIPIF--
<?php if(!extension_loaded("hash")) print "skip"; ?>
--FILE--
<?php
echo hash('sha512', '') . "\n";
echo hash('sha512', 'a') . "\n";
echo hash('sha512', '012345678901234567890123456789012345678901234567890123456789') . "\n";
/* FIPS-180 Vectors */
echo hash('sha512', 'abc') . "\n";
echo hash('sha512', 'abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu') . "\n";
echo hash('sha512', str_repeat('a', 1000000)) . "\n";
--EXPECT--
cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e
1f40fc92da241694750979ee6cf582f2d5d7d28e18335de05abc54d0560e0f5302860c652bf08d560252aa5e74210546f369fbbbce8c12cfc7957b2652fe9a75
e3e33e00eec4753ea01c134b21c52badc44d364648ba2321ff18aa213902759b04f7f0dbfff426acec097c09476adcd0666d2d86e8cc2fcd4f7c549acbfbfd94
ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f
8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909
e718483d0ce769644e2e42c7bc15b4638e1f98b13b2044285632a803afa973ebde0ff244877ea60a4cb0432ce577c31beb009c5c2c49aa2e4eadb217ad8cc09b
-18
View File
@@ -1,18 +0,0 @@
--TEST--
snefru
--SKIPIF--
<?php extension_loaded('hash') or die('skip'); ?>
--FILE--
<?php
echo hash('snefru', ''), "\n";
echo hash('snefru', 'The quick brown fox jumps over the lazy dog'), "\n";
echo hash('snefru', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'), "\n";
echo hash('snefru', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'), "\n";
echo hash('snefru', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'), "\n";
?>
--EXPECT--
8617f366566a011837f4fb4ba5bedea2b892f3ed8b894023d16ae344b2be5881
674caa75f9d8fd2089856b95e93a4fb42fa6c8702f8980e11d97a142d76cb358
94682bc46e5fbb8417e2f3e10ed360484048d946bb8cbb0ea4cad2700dbeaab0
c54c602ac46383716ee7200a76c9c90a7b435bbe31d13f04e0b00a7ea5c347fa
7a8539c59e192e8d70b1ab82aa86a1b54560d42020bda4e00ddd6d048fe3bcaa
-18
View File
@@ -1,18 +0,0 @@
--TEST--
tiger
--SKIPIF--
<?php extension_loaded('hash') or die('skip'); ?>
--FILE--
<?php
echo hash('tiger192,3', ''),"\n";
echo hash('tiger192,3', 'abc'),"\n";
echo hash('tiger192,3', str_repeat('a', 63)),"\n";
echo hash('tiger192,3', str_repeat('abc', 61)),"\n";
echo hash('tiger192,3', str_repeat('abc', 64)),"\n";
?>
--EXPECT--
24f0130c63ac933216166e76b1bb925ff373de2d49584e7a
f258c1e88414ab2a527ab541ffc5b8bf935f7b951c132951
8ee409a14e6066933b63d5b2abca63d71a78f55e29eb4649
2586156d16bf9ab1e6e48bdf5e038f8053c30e071db3bcb0
3ee8a9405396ddba1bc038508af4164ac1fe59ef58916a85
-14
View File
@@ -1,14 +0,0 @@
--TEST--
whirlpool
--SKIPIF--
<?php extension_loaded('hash') or die('skip'); ?>
--FILE--
<?php
echo hash('whirlpool', ''), "\n";
echo hash('whirlpool', $s='---qwertzuiopasdfghjklyxcvbnm------qwertzuiopasdfghjklyxcvbnm---'), "\n";
echo hash('whirlpool', str_repeat($s.'0', 1000)), "\n";
?>
--EXPECT--
19fa61d75522a4669b44e39c1d2e1726c530232130d407f89afee0964997f7a73e83be698b288febcf88e3e03c4f0757ea8964e59b63d93708b138cc42a66eb3
916ce6431d2f384be68d96bcaba800c21b82e9cc2f07076554c9557f85476b5d8f2b263951121fa955e34b31a4cdc857bdf076b123c2252543dcef34f84a7ef3
b51984710d11893ac08e10529519f9801d82ea534629d14bc8c810307934496017ccdf23bfcb62c7e1259664e84c9388ff646b0b46688b0a6c32e5571234dd95
-2
View File
@@ -1,2 +0,0 @@
MySQL
Zeev Suraski, Zak Greant, Georg Richter
-146
View File
@@ -1,146 +0,0 @@
dnl
dnl $Id$
dnl
AC_DEFUN([MYSQL_LIB_CHK], [
str="$MYSQL_DIR/$1/lib$MYSQL_LIBNAME.*"
for j in `echo $str`; do
if test -r $j; then
MYSQL_LIB_DIR=$MYSQL_DIR/$1
break 2
fi
done
])
AC_DEFUN([PHP_MYSQL_SOCKET_SEARCH], [
for i in \
/var/run/mysqld/mysqld.sock \
/var/tmp/mysql.sock \
/var/run/mysql/mysql.sock \
/var/lib/mysql/mysql.sock \
/var/mysql/mysql.sock \
/usr/local/mysql/var/mysql.sock \
/Private/tmp/mysql.sock \
/private/tmp/mysql.sock \
/tmp/mysql.sock \
; do
if test -r $i; then
MYSQL_SOCK=$i
break 2
fi
done
if test -n "$MYSQL_SOCK"; then
AC_DEFINE_UNQUOTED(MYSQL_UNIX_ADDR, "$MYSQL_SOCK", [ ])
AC_MSG_RESULT([$MYSQL_SOCK])
else
AC_MSG_RESULT([no])
fi
])
PHP_ARG_WITH(mysql, for MySQL support,
[ --with-mysql[=DIR] Include MySQL support. DIR is the MySQL base directory])
PHP_ARG_WITH(mysql-sock, for specified location of the MySQL UNIX socket,
[ --with-mysql-sock[=DIR] MySQL: Location of the MySQL unix socket pointer.
If unspecified, the default locations are searched], no, no)
if test -z "$PHP_ZLIB_DIR"; then
PHP_ARG_WITH(zlib-dir, for the location of libz,
[ --with-zlib-dir[=DIR] MySQL: Set the path to libz install prefix], no, no)
fi
if test "$PHP_MYSQL" != "no"; then
AC_DEFINE(HAVE_MYSQL, 1, [Whether you have MySQL])
AC_MSG_CHECKING([for MySQL UNIX socket location])
if test "$PHP_MYSQL_SOCK" != "no" && test "$PHP_MYSQL_SOCK" != "yes"; then
MYSQL_SOCK=$PHP_MYSQL_SOCK
AC_DEFINE_UNQUOTED(MYSQL_UNIX_ADDR, "$MYSQL_SOCK", [ ])
AC_MSG_RESULT([$MYSQL_SOCK])
elif test "$PHP_MYSQL" = "yes" || test "$PHP_MYSQL_SOCK" = "yes"; then
PHP_MYSQL_SOCKET_SEARCH
else
AC_MSG_RESULT([no])
fi
MYSQL_DIR=
MYSQL_INC_DIR=
for i in $PHP_MYSQL /usr/local /usr; do
if test -r $i/include/mysql/mysql.h; then
MYSQL_DIR=$i
MYSQL_INC_DIR=$i/include/mysql
break
elif test -r $i/include/mysql.h; then
MYSQL_DIR=$i
MYSQL_INC_DIR=$i/include
break
fi
done
if test -z "$MYSQL_DIR"; then
AC_MSG_ERROR([Cannot find MySQL header files under $PHP_MYSQL.
Note that the MySQL client library is not bundled anymore!])
fi
MYSQL_LIBNAME=mysqlclient
case $host_alias in
*netware*[)]
MYSQL_LIBNAME=mysql
;;
esac
dnl for compat with PHP 4 build system
if test -z "$PHP_LIBDIR"; then
PHP_LIBDIR=lib
fi
for i in $PHP_LIBDIR $PHP_LIBDIR/mysql; do
MYSQL_LIB_CHK($i)
done
if test -z "$MYSQL_LIB_DIR"; then
AC_MSG_ERROR([Cannot find lib$MYSQL_LIBNAME under $MYSQL_DIR.
Note that the MySQL client library is not bundled anymore!])
fi
PHP_CHECK_LIBRARY($MYSQL_LIBNAME, mysql_close, [ ],
[
if test "$PHP_ZLIB_DIR" != "no"; then
PHP_ADD_LIBRARY_WITH_PATH(z, $PHP_ZLIB_DIR, MYSQL_SHARED_LIBADD)
PHP_CHECK_LIBRARY($MYSQL_LIBNAME, mysql_error, [], [
AC_MSG_ERROR([mysql configure failed. Please check config.log for more information.])
], [
-L$PHP_ZLIB_DIR/$PHP_LIBDIR -L$MYSQL_LIB_DIR
])
MYSQL_LIBS="-L$PHP_ZLIB_DIR/$PHP_LIBDIR -lz"
else
PHP_ADD_LIBRARY(z,, MYSQL_SHARED_LIBADD)
PHP_CHECK_LIBRARY($MYSQL_LIBNAME, mysql_errno, [], [
AC_MSG_ERROR([Try adding --with-zlib-dir=<DIR>. Please check config.log for more information.])
], [
-L$MYSQL_LIB_DIR
])
MYSQL_LIBS="-lz"
fi
], [
-L$MYSQL_LIB_DIR
])
PHP_ADD_LIBRARY_WITH_PATH($MYSQL_LIBNAME, $MYSQL_LIB_DIR, MYSQL_SHARED_LIBADD)
PHP_ADD_INCLUDE($MYSQL_INC_DIR)
PHP_NEW_EXTENSION(mysql, php_mysql.c, $ext_shared)
MYSQL_MODULE_TYPE=external
MYSQL_LIBS="-L$MYSQL_LIB_DIR -l$MYSQL_LIBNAME $MYSQL_LIBS"
MYSQL_INCLUDE=-I$MYSQL_INC_DIR
PHP_SUBST(MYSQL_SHARED_LIBADD)
PHP_SUBST_OLD(MYSQL_MODULE_TYPE)
PHP_SUBST_OLD(MYSQL_LIBS)
PHP_SUBST_OLD(MYSQL_INCLUDE)
fi
-15
View File
@@ -1,15 +0,0 @@
// $Id$
// vim:ft=javascript
ARG_WITH("mysql", "MySQL support", "no");
if (PHP_MYSQL != "no") {
if (CHECK_LIB("libmysql.lib", "mysql", PHP_MYSQL) &&
CHECK_HEADER_ADD_INCLUDE("mysql.h", "CFLAGS_MYSQL",
PHP_MYSQL + "\\include;" + PHP_PHP_BUILD + "\\include\\mysql;" + PHP_MYSQL)) {
EXTENSION("mysql", "php_mysql.c");
AC_DEFINE('HAVE_MYSQL', 1, 'Have MySQL library');
} else {
WARNING("mysql not enabled; libraries and headers not found");
}
}
-171
View File
@@ -1,171 +0,0 @@
# Microsoft Developer Studio Project File - Name="mysql" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=mysql - Win32 Debug_TS
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "mysql.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "mysql.mak" CFG="mysql - Win32 Debug_TS"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "mysql - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "mysql - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "mysql - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "mysql - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "mysql - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MYSQL_EXPORTS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\MySQL\include" /I "..\..\TSRM" /D "NDEBUG" /D "MYSQL_EXPORTS" /D "COMPILE_DL_MYSQL" /D HAVE_MYSQL=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D "COMPILE_DL_MYSQL" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x40d /d "NDEBUG"
# ADD RSC /l 0x40d /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libmySQL.lib php5nts.lib /nologo /dll /machine:I386 /out:"Release/php_mysql.dll" /libpath:"..\..\..\MySQL\lib\opt" /libpath:"..\..\Release"
!ELSEIF "$(CFG)" == "mysql - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MYSQL_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\MySQL\include" /I "..\..\TSRM" /D "_DEBUG" /D ZEND_DEBUG=1 /D "MYSQL_EXPORTS" /D "COMPILE_DL_MYSQL" /D HAVE_MYSQL=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D "COMPILE_DL_MYSQL" /FR /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x40d /d "_DEBUG"
# ADD RSC /l 0x40d /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libmySQL.lib php5nts_debug.lib /nologo /dll /debug /machine:I386 /out:"Debug/php_mysql.dll" /pdbtype:sept /libpath:"..\..\..\MySQL\lib\Debug" /libpath:"..\..\Debug"
!ELSEIF "$(CFG)" == "mysql - Win32 Debug_TS"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug_TS"
# PROP BASE Intermediate_Dir "Debug_TS"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug_TS"
# PROP Intermediate_Dir "Debug_TS"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MYSQL_EXPORTS" /D "COMPILE_DL_MYSQL" /D HAVE_MYSQL=1 /FR /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\MySQL\include" /I "..\..\TSRM" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "MYSQL_EXPORTS" /D "COMPILE_DL_MYSQL" /D HAVE_MYSQL=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D "COMPILE_DL_MYSQL" /FR /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x40d /d "_DEBUG"
# ADD RSC /l 0x40d /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 php5ts_debug.lib libmySQL.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_mysql.dll" /pdbtype:sept /libpath:"..\..\..\MySQL\lib\Debug" /libpath:"..\..\Debug_TS"
!ELSEIF "$(CFG)" == "mysql - Win32 Release_TS"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release_TS"
# PROP BASE Intermediate_Dir "Release_TS"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release_TS"
# PROP Intermediate_Dir "Release_TS"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MYSQL_EXPORTS" /D "COMPILE_DL_MYSQL" /D HAVE_MYSQL=1 /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\MySQL\include" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZTS" /D "MYSQL_EXPORTS" /D "COMPILE_DL_MYSQL" /D HAVE_MYSQL=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D "COMPILE_DL_MYSQL" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x40d /d "NDEBUG"
# ADD RSC /l 0x40d /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libmySQL.lib php5ts.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_mysql.dll" /libpath:"..\..\..\MySQL\lib\opt" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
!ENDIF
# Begin Target
# Name "mysql - Win32 Release"
# Name "mysql - Win32 Debug"
# Name "mysql - Win32 Debug_TS"
# Name "mysql - Win32 Release_TS"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\php_mysql.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\php_mysql.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# Begin Source File
SOURCE=.\Readme_w32.txt
# End Source File
# End Target
# End Project
-169
View File
@@ -1,169 +0,0 @@
# Temporarily here -- later may go into some batch file
# which will set this as an environment variable
PROJECT_ROOT = ..\..
# Module details
MODULE_NAME = phpmysql
MODULE_DESC = "PHP 4.3 - MySQL Extension"
VMAJ = 3
VMIN = 0
VREV = 0
#include the common settings
include $(PROJECT_ROOT)/netware/common.mif
# MYSQL stuff
MYSQL_DIR = P:/APPS/script/sw/mysql
# Build type defaults to 'release'
ifndef BUILD
BUILD = release
endif
# Extensions of all input and output files
.SUFFIXES:
.SUFFIXES: .nlm .lib .obj .cpp .c .msg .mlc .mdb .xdc .d
# Source files
C_SRC = php_mysql.c \
start.c
CPP_SRC_NODIR = $(notdir $(CPP_SRC))
C_SRC_NODIR = $(notdir $(C_SRC))
SRC_DIR = $(dir $(CPP_SRC) $(C_SRC))
# Library files
LIBRARY = $(MYSQL_DIR)/lib/libmysqlclient.lib
# Destination directories and files
OBJ_DIR = $(BUILD)
FINAL_DIR = $(BUILD)
OBJECTS = $(addprefix $(OBJ_DIR)/,$(CPP_SRC_NODIR:.c=.obj) $(C_SRC_NODIR:.c=.obj))
DEPDS = $(addprefix $(OBJ_DIR)/,$(CPP_SRC_NODIR:.c=.d) $(C_SRC_NODIR:.c=.d))
# Binary file
ifndef BINARY
BINARY=$(FINAL_DIR)\$(MODULE_NAME).nlm
endif
# Compile flags
C_FLAGS = -c -maxerrors 25 -msgstyle gcc -wchar_t on -bool on -processor Pentium
C_FLAGS += -nostdinc -nosyspath
C_FLAGS += -relax_pointers # To remove type-casting errors
C_FLAGS += -DNETWARE -DZTS -DNEW_LIBC -DUSE_OLD_FUNCTIONS -DCOMPILE_DL_MYSQL=1
C_FLAGS += -I. -I- -I$(PROJECT_ROOT) -I$(PROJECT_ROOT)/main
C_FLAGS += -I$(PROJECT_ROOT)/ext/standard -I$(PROJECT_ROOT)/netware
C_FLAGS += -I$(PROJECT_ROOT)/zend -I$(PROJECT_ROOT)/tsrm
C_FLAGS += -I$(SDK_DIR)/include -I$(MWCIncludes)
C_FLAGS += -I$(MYSQL_DIR)/include
C_FLAGS += -I$(WINSOCK_DIR)/include/nlm -I$(WINSOCK_DIR)/include
# Extra stuff based on debug / release builds
ifeq '$(BUILD)' 'debug'
SYM_FILE = $(FINAL_DIR)\$(MODULE_NAME).sym
C_FLAGS += -inline smart -sym on -sym codeview4 -opt off -opt intrinsics -DDEBUGGING -DDKFBPON
C_FLAGS += -exc cw -DZEND_DEBUG=1
LD_FLAGS += -sym on -sym codeview4 -osym $(SYM_FILE)
export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtld.lib
else
C_FLAGS += -opt speed -inline on -inline smart -inline auto -sym off -opt intrinsics
C_FLAGS += -opt level=4 -DZEND_DEBUG=0
LD_FLAGS += -sym off
export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtl.lib
endif
# Dependencies
MODULE = LibC \
phplib
IMPORT = @$(SDK_DIR)/imports/libc.imp \
@$(SDK_DIR)/imports/ws2nlm.imp \
@$(MPK_DIR)/import/mpkOrg.imp \
@$(PROJECT_ROOT)/netware/phplib.imp
EXPORT = ($(MODULE_NAME)) get_module
API = OutputToScreen
# Virtual paths
vpath %.cpp .
vpath %.c . ..\..\netware
vpath %.obj $(OBJ_DIR)
all: prebuild project
.PHONY: all
prebuild:
@if not exist $(OBJ_DIR) md $(OBJ_DIR)
project: $(BINARY)
@echo Build complete.
$(OBJ_DIR)/%.d: %.cpp
@echo Building Dependencies for $(<F)
@$(CC) -M $< $(C_FLAGS) -o $@
$(OBJ_DIR)/%.d: %.c
@echo Building Dependencies for $(<F)
@$(CC) -M $< $(C_FLAGS) -o $@
$(OBJ_DIR)/%.obj: %.cpp
@echo Compiling $?...
@$(CC) $< $(C_FLAGS) -o $@
$(OBJ_DIR)/%.obj: %.c
@echo Compiling $?...
@$(CC) $< $(C_FLAGS) -o $@
$(BINARY): $(OBJECTS)
@echo Import $(IMPORT) > $(basename $@).def
ifdef API
@echo Import $(API) >> $(basename $@).def
endif
@echo Module $(MODULE) >> $(basename $@).def
ifdef EXPORT
@echo Export $(EXPORT) >> $(basename $@).def
endif
@echo AutoUnload >> $(basename $@).def
ifeq '$(BUILD)' 'debug'
@echo Debug >> $(basename $@).def
endif
@echo Flag_On 0x00000008 >> $(basename $@).def
@echo Start _LibCPrelude >> $(basename $@).def
@echo Exit _LibCPostlude >> $(basename $@).def
$(MPKTOOL) $(XDCFLAGS) $(basename $@).xdc
@echo xdcdata $(basename $@).xdc >> $(basename $@).def
@echo Linking $@...
@echo $(LD_FLAGS) -commandfile $(basename $@).def > $(basename $@).link
@echo $(LIBRARY) $(OBJECTS) >> $(basename $@).link
@$(LINK) @$(basename $@).link
.PHONY: clean
clean: cleanobj cleanbin
.PHONY: cleand
cleand:
@echo Deleting all dependency files...
-@del "$(OBJ_DIR)\*.d"
.PHONY: cleanobj
cleanobj:
@echo Deleting all object files...
-@del "$(OBJ_DIR)\*.obj"
.PHONY: cleanbin
cleanbin:
@echo Deleting binary files...
-@del "$(FINAL_DIR)\$(MODULE_NAME).nlm"
@echo Deleting MAP, DEF files, etc....
-@del "$(FINAL_DIR)\$(MODULE_NAME).map"
-@del "$(FINAL_DIR)\$(MODULE_NAME).def"
-@del "$(FINAL_DIR)\$(MODULE_NAME).link"
ifeq '$(BUILD)' 'debug'
-@del $(FINAL_DIR)\$(MODULE_NAME).sym
endif
-64
View File
@@ -1,64 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE package SYSTEM "../pear/package.dtd">
<package>
<name>mysql</name>
<summary>MySQL database access functions</summary>
<maintainers>
<maintainer>
<user>georg</user>
<name>Georg Richter</name>
<email>georg@php.net</email>
<role>lead</role>
</maintainer>
<maintainer>
<user>zak</user>
<name>Zak Greant</name>
<email>zak@php.net</email>
<role>developer</role>
</maintainer>
<maintainer>
<user>zeev</user>
<name>Zeev Suraski</name>
<email>zeev@php.net</email>
<role>developer</role>
</maintainer>
</maintainers>
<description>
These functions allow you to access MySQL database servers.
</description>
<license>PHP</license>
<release>
<state>stable</state>
<version>1.0</version>
<date>2005-09-04</date>
<notes>
This is the MySQL driver, taken from the PHP 5.1 release.
It can also be built against PHP 4.
</notes>
<configureoptions>
<configureoption name="with-mysql" default="autodetect" prompt="mysql installation dir?"/>
<configureoption name="with-mysql-sock" default="autodetect" prompt="MySQL Unix socket?"/>
<configureoption name="with-zlib-dir" default="autodetect" prompt="zlib installation dir?"/>
</configureoptions>
<filelist>
<file role="src" name="config.m4"/>
<file role="src" name="config.w32"/>
<file role="doc" name="CREDITS"/>
<file role="src" name="mysql.dsp"/>
<file role="src" name="mysql.mak"/>
<file role="src" name="php_mysql.c"/>
<file role="src" name="php_mysql.h"/>
<file role="test" name="tests/001.phpt"/>
<file role="test" name="tests/002.phpt"/>
<file role="test" name="tests/003.phpt"/>
<file role="test" name="tests/connect.inc"/>
<file role="test" name="tests/skipif.inc"/>
</filelist>
<deps>
<dep type="php" rel="ge" version="4" />
</deps>
</release>
</package>
<!--
vim:et:ts=1:sw=1
-->
File diff suppressed because it is too large. Load diff
-125
View File
@@ -1,125 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2005 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Zeev Suraski <zeev@zend.com> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef PHP_MYSQL_H
#define PHP_MYSQL_H
#ifdef PHP_WIN32
#define PHP_MYSQL_API __declspec(dllexport)
#else
#define PHP_MYSQL_API
#endif
#if HAVE_MYSQL
#ifdef ZTS
#include "TSRM.h"
#endif
extern zend_module_entry mysql_module_entry;
#define mysql_module_ptr &mysql_module_entry
PHP_MINIT_FUNCTION(mysql);
PHP_RINIT_FUNCTION(mysql);
PHP_MSHUTDOWN_FUNCTION(mysql);
PHP_RSHUTDOWN_FUNCTION(mysql);
PHP_MINFO_FUNCTION(mysql);
PHP_FUNCTION(mysql_connect);
PHP_FUNCTION(mysql_pconnect);
PHP_FUNCTION(mysql_close);
PHP_FUNCTION(mysql_select_db);
#if MYSQL_VERSION_ID < 40000
PHP_FUNCTION(mysql_create_db);
PHP_FUNCTION(mysql_drop_db);
#endif
PHP_FUNCTION(mysql_query);
PHP_FUNCTION(mysql_unbuffered_query);
PHP_FUNCTION(mysql_db_query);
PHP_FUNCTION(mysql_list_dbs);
PHP_FUNCTION(mysql_list_tables);
PHP_FUNCTION(mysql_list_fields);
PHP_FUNCTION(mysql_list_processes);
PHP_FUNCTION(mysql_error);
PHP_FUNCTION(mysql_errno);
PHP_FUNCTION(mysql_affected_rows);
PHP_FUNCTION(mysql_insert_id);
PHP_FUNCTION(mysql_result);
PHP_FUNCTION(mysql_num_rows);
PHP_FUNCTION(mysql_num_fields);
PHP_FUNCTION(mysql_fetch_row);
PHP_FUNCTION(mysql_fetch_array);
PHP_FUNCTION(mysql_fetch_assoc);
PHP_FUNCTION(mysql_fetch_object);
PHP_FUNCTION(mysql_data_seek);
PHP_FUNCTION(mysql_fetch_lengths);
PHP_FUNCTION(mysql_fetch_field);
PHP_FUNCTION(mysql_field_seek);
PHP_FUNCTION(mysql_free_result);
PHP_FUNCTION(mysql_field_name);
PHP_FUNCTION(mysql_field_table);
PHP_FUNCTION(mysql_field_len);
PHP_FUNCTION(mysql_field_type);
PHP_FUNCTION(mysql_field_flags);
PHP_FUNCTION(mysql_escape_string);
PHP_FUNCTION(mysql_real_escape_string);
PHP_FUNCTION(mysql_get_client_info);
PHP_FUNCTION(mysql_get_host_info);
PHP_FUNCTION(mysql_get_proto_info);
PHP_FUNCTION(mysql_get_server_info);
PHP_FUNCTION(mysql_info);
PHP_FUNCTION(mysql_stat);
PHP_FUNCTION(mysql_thread_id);
PHP_FUNCTION(mysql_client_encoding);
PHP_FUNCTION(mysql_ping);
ZEND_BEGIN_MODULE_GLOBALS(mysql)
long default_link;
long num_links,num_persistent;
long max_links,max_persistent;
long allow_persistent;
long default_port;
char *default_host, *default_user, *default_password;
char *default_socket;
char *connect_error;
long connect_errno;
long connect_timeout;
long result_allocated;
long trace_mode;
ZEND_END_MODULE_GLOBALS(mysql)
#ifdef ZTS
# define MySG(v) TSRMG(mysql_globals_id, zend_mysql_globals *, v)
#else
# define MySG(v) (mysql_globals.v)
#endif
#else
#define mysql_module_ptr NULL
#endif
#define phpext_mysql_ptr mysql_module_ptr
#endif /* PHP_MYSQL_H */
-30
View File
@@ -1,30 +0,0 @@
--TEST--
mysql connect
--SKIPIF--
<?php include 'skipif.inc'; ?>
--FILE--
<?php
include 'connect.inc';
$test = '';
/*** test mysql_connect 127.0.0.1 ***/
$db = mysql_connect('127.0.0.1', $user, $passwd);
$test .= ($db) ? '1' : '0';
mysql_close($db);
/*** test mysql_connect localhost ***/
$db = mysql_connect($host, $user, $passwd);
$test .= ($db) ? '1' : '0';
mysql_close($db);
/*** test mysql_connect localhost:port ***/
$db = mysql_connect("{$host}:3306", $user, $passwd, '');
$test .= ($db) ? '1' : '0';
mysql_close($db);
var_dump($test);
?>
--EXPECT--
string(3) "111"
-53
View File
@@ -1,53 +0,0 @@
--TEST--
mysql_fetch_array
--SKIPIF--
<?php include 'skipif.inc'; ?>
--FILE--
<?php
include 'connect.inc';
$db = mysql_connect($host, $user, $passwd);
var_dump($db);
var_dump(mysql_select_db('test'));
var_dump(mysql_query('DROP TABLE IF EXISTS test'));
var_dump(mysql_query('CREATE TABLE test(col1 int PRIMARY KEY, col2 varchar(50), col3 char(5))'));
var_dump(mysql_query("INSERT INTO test(col1, col2, col3) VALUES(1, 'foo', 'bar'),(2, 'foo', 'bar')"));
var_dump($res = mysql_query('SELECT col1, col2, col3 FROM test ORDER BY col1 ASC'));
while ($data = mysql_fetch_array($res, MYSQL_ASSOC)) {
var_dump($data);
}
mysql_close($db);
?>
--EXPECTF--
resource(%d) of type (mysql link)
bool(true)
bool(true)
bool(true)
bool(true)
resource(%d) of type (mysql result)
array(3) {
["col1"]=>
string(1) "1"
["col2"]=>
string(3) "foo"
["col3"]=>
string(3) "bar"
}
array(3) {
["col1"]=>
string(1) "2"
["col2"]=>
string(3) "foo"
["col3"]=>
string(3) "bar"
}
-84
View File
@@ -1,84 +0,0 @@
--TEST--
mysql_fetch_object
--SKIPIF--
<?php include 'skipif.inc'; ?>
--FILE--
<?php
include 'connect.inc';
class class24 {
function __construct() {
echo __METHOD__ . "\n";
}
}
$data = array(
"one",
"two",
"three"
);
$db = mysql_connect($host, $user, $passwd);
mysql_select_db("test");
mysql_query('DROP TABLE IF EXISTS test');
mysql_query("CREATE TABLE test(a varchar(10))");
foreach ($data as $str) {
mysql_query("INSERT INTO test VALUES('$str')");
var_dump($str);
}
echo "==stdClass==\n";
$res = mysql_query("SELECT a FROM test");
while ($obj = mysql_fetch_object($res)) {
var_dump($obj);
}
echo "==class24==\n";
$res = mysql_query("SELECT a FROM test");
while ($obj = mysql_fetch_object($res, 'class24')) {
var_dump($obj);
}
mysql_close($db);
?>
==DONE==
--EXPECTF--
string(3) "one"
string(3) "two"
string(5) "three"
==stdClass==
object(stdClass)#%d (1) {
["a"]=>
string(3) "one"
}
object(stdClass)#%d (1) {
["a"]=>
string(3) "two"
}
object(stdClass)#%d (1) {
["a"]=>
string(5) "three"
}
==class24==
class24::__construct
object(class24)#%d (1) {
["a"]=>
string(3) "one"
}
class24::__construct
object(class24)#%d (1) {
["a"]=>
string(3) "two"
}
class24::__construct
object(class24)#%d (1) {
["a"]=>
string(5) "three"
}
==DONE==
-10
View File
@@ -1,10 +0,0 @@
<?php
/* default values are localhost, root and empty password
Change the values if you use another configuration */
$host = "localhost";
$user = "root";
$passwd = "";
?>
-8
View File
@@ -1,8 +0,0 @@
<?php
include 'connect.inc';
$link = @mysql_connect($host, $user, $passwd);
if (!$link) die('skip cannot connect');
mysql_close($link);
?>
+16 -3
View File
@@ -5,9 +5,9 @@ PDO_HEADER_FILES= \
php_pdo_driver.h
install-pdo-headers:
@echo "Installing PDO headers: $(INSTALL_ROOT)$(phpincludedir)/ext/pdo/"
@$(mkinstalldirs) $(INSTALL_ROOT)$(phpincludedir)/ext/pdo
@for f in $(PDO_HEADER_FILES); do \
echo "Installing PDO headers: $(INSTALL_ROOT)$(phpincludedir)/ext/pdo/"
$(mkinstalldirs) $(INSTALL_ROOT)$(phpincludedir)/ext/pdo
for f in $(PDO_HEADER_FILES); do \
if test -f "$(top_srcdir)/$$f"; then \
$(INSTALL_DATA) $(top_srcdir)/$$f $(INSTALL_ROOT)$(phpincludedir)/ext/pdo; \
elif test -f "$(top_builddir)/$$f"; then \
@@ -20,7 +20,20 @@ install-pdo-headers:
echo "hmmm"; \
fi \
done;
@echo ""
@echo ""
@echo "You're now ready to install PDO drivers for your database"
@echo "If you'd like to have PDO show up in the list of installed"
@echo "packages when you run \"pear list\", you may now run"
@echo "\"sudo pear install package.xml\""
@echo "this time, when prompted to press enter, you should type"
@echo "\"no\" and press enter instead."
# mini hack
install: $(all_targets) $(install_targets) install-pdo-headers
$(top_srcdir)/ext/pdo/pdo_sql_parser.c: $(top_srcdir)/ext/pdo/pdo_sql_parser.re
exit 0; re2c -b $(top_srcdir)/ext/pdo/pdo_sql_parser.re > $@
$(srcdir)/pdo_sql_parser.c: $(srcdir)/pdo_sql_parser.re
exit 0; re2c -b $(srcdir)/pdo_sql_parser.re > $@
+13 -85
View File
@@ -1,93 +1,21 @@
$Id$
Roadmap for PDO
In no particular order:
Core, version 1.1:
==================
Probable Bugs:
- persistent connections with bound parameters might segv on subsequent
requests
- Separate the handle factory call into two phases:
- handle creation
- connecting
Low-level:
This would then allow PDO to call setAttribute()
for each driver option specified in the constructor.
Right now, the handling of driver attributes is a bit sloppy.
- $dbh->quote()
- LOB support via Streams API
- make errors generated at the pdo level (as opposed to driver level) use the
selected error mode.
- Add:
pdo.max_persistent
pdo.persistent_timeout
pdo.ping_interval
Not-so-low-level:
- fetchAll(), single row, single column fetches etc.
with the same meanings as those options from oci8.
- BLOB/CLOB.
Investigate the various APIs to determine if we can
transparently map BLOBs and CLOBs as PDO_PARAM_LOB.
If the API needs hints from the client side, we need
to introduce a PDO_PARAM_CLOB to differentiate between
binary and character data.
- Character set selection.
Generalize/standardize this.
- meta data.
Formalize getColumnMeta().
Look at retrieving lists of tables and other objects in the db.
- tracing/logging/debugging
Add ini options:
pdo.trace_file
pdo.enable_tracing
And corresponding attributes, ATTR_TRACE_FILE, ATTR_TRACING_ENABLE,
settable at dbh and stmt levels independently. If set at the dbh level,
the stmt will inherit its value. If not set explicitly in code, the
defaults for the dbh will come from the INI settings.
ATTR_TRACE_FILE will accept a string or a stream.
The INI options are useful for administrative tracing/debugging.
Trace mode will output very verbose info.
General DB API Roundup:
=========
Consider how the following can be implemented in PDO:
mysqli_change_user(); alters auth credentials on a live connection
mysqli_info(); info about rows affected by last query
mysqli_master_query(); force query to run on master
mysqli_ping(); ping / reconnect
mysqli_stat(); one line summary of server status
oci_password_change()
Also consider master/slave and/or failover server configuration.
Postgres:
=========
- Real large object support.
- Someone with more pgsql experience can suggest more features
Oracle:
=======
- Support for array types and collections.
Userspace PDO Driver:
=====================
- Will be hard.
PDO Session module:
===================
- Is it worth writing in C?
Probably not.
vim:se et ts=2 sw=2 tw=78:
Could be more...
vim:tw=78:et
+32 -54
View File
@@ -1,68 +1,46 @@
dnl $Id$
dnl config.m4 for extension pdo
dnl vim:se ts=2 sw=2 et:
AC_DEFUN([PHP_PDO_PEAR_CHECK],[
pdo_running_under_pear=0
case `pwd` in
/var/tmp/pear-build-*)
pdo_running_under_pear=1
;;
esac
AC_ARG_WITH(broken-pear-install,
[],[
if test "x$withval" = "xyes"; then
AC_MSG_ERROR([
Due to a bug in the pear installer you should install the PDO package manually
using the following steps:
if test "$pdo_running_under_pear$PHP_PEAR_VERSION" = "1"; then
# we're running in an environment that smells like pear,
# and the PHP_PEAR_VERSION env var is not set. That implies
# that we're running under a slightly broken pear installer
AC_MSG_ERROR([
PDO requires that you upgrade your PEAR installer tools. Please
do so now by running:
1. Download the PDO package to your local machine:
% wget http://pecl.php.net/get/PDO
% sudo pear upgrade pear
2. Determine your PHP bin dir.
If your php5 cli binary lives at /usr/local/php5/bin/php
the bin dir is /usr/local/php5/bin
or by manually downloading and installing PEAR version 1.3.5 or higher.
3. Set your path so that your PHP bin dir is at the front:
export PATH="/usr/local/php5/bin:\$PATH"
Once you've upgraded, please re-try your PDO install.
])
fi
4. Manually build:
% tar xzf PDO-0.2.tgz
% cd PDO-0.2
% phpize
% ./configure
% make
% sudo -s
# make install
# echo extension=pdo.so >> /usr/local/php5/lib/php.ini
We apologize for the inconvenience, and hope to resolve this problem
in a future PHP/PEAR release.
])
fi
])
PHP_ARG_ENABLE(pdo, whether to enable PDO support,
[ --disable-pdo Disable PHP Data Objects support], yes)
PHP_ARG_ENABLE(pdo, whether to disable PDO support,
[ --disable-pdo Disable PHP Data Objects support], yes)
if test "$PHP_PDO" != "no"; then
PHP_PDO_PEAR_CHECK
if test "$ext_shared" = "yes" ; then
case $host_alias in
*darwin*)
if test "$pdo_running_under_pear" = "1"; then
AC_MSG_ERROR([
Due to the way that loadable modules work on OSX/Darwin, you need to
compile the PDO package statically into the PHP core.
Please follow the instructions at: http://netevil.org/node.php?nid=202
for more detail on this issue.
])
fi
ext_shared=no
;;
esac
fi
PHP_NEW_EXTENSION(pdo, pdo.c pdo_dbh.c pdo_stmt.c pdo_sql_parser.c pdo_sqlstate.c, $ext_shared)
ifdef([PHP_ADD_EXTENSION_DEP],
[
PHP_ADD_EXTENSION_DEP(pdo, spl, true)
])
ifdef([PHP_INSTALL_HEADERS],
[
dnl Sadly, this is a complete NOP for pecl extensions
PHP_INSTALL_HEADERS(ext/pdo, [php_pdo.h php_pdo_driver.h])
])
dnl so we always include the known-good working hack.
PHP_ADD_MAKEFILE_FRAGMENT
fi
-1
View File
@@ -5,6 +5,5 @@ ARG_ENABLE("pdo", "Enable PHP Data Objects support", "no");
if (PHP_PDO != "no") {
EXTENSION('pdo', 'pdo.c pdo_dbh.c pdo_stmt.c pdo_sql_parser.c pdo_sqlstate.c');
ADD_EXTENSION_DEP('pdo', 'spl', true);
}
+20 -40
View File
@@ -30,6 +30,12 @@
</maintainer>
</maintainers>
<!-- pear is still broken -->
<configureoptions>
<configureoption name="with-broken-pear-install" default="yes" prompt="the pear installer has a bug; press enter to find out more"/>
</configureoptions>
<description>
PDO provides a uniform data access interface, sporting advanced features such
as prepared statements and bound parameters. PDO drivers are dynamically
@@ -40,53 +46,27 @@
</description>
<license>PHP</license>
<release>
<state>stable</state>
<version>1.0</version>
<date>2005-11-26</date>
<state>beta</state>
<version>0.2.1</version>
<date>2005-02-10</date>
<notes>
** NOTE WELL! **
All the PDO_XXX constants have been renamed to PDO::XXX form for future
compatibility with PHP namespaces. Sorry for the inconvenience, especially
after Release Candidate 1.
Note that PDO on its own is useless.
You need to install a PDO database driver to make use of it,
check http://pecl.php.net for a list of available PDO drivers.
You need to install a PDO database driver to make use of PDO,
check http://pecl.php.net/package-search.php?pkg_name=PDO
for a list of available PDO drivers.
It is highly recommended that you update to the latest stable PHP 5 snapshot
before using PDO.
You can obtain it from http://snaps.php.net.
It is highly recommended that you update to PHP 5.1 before using PDO.
If you are running on Windows, you can find a precompiled binary at:
http://pecl4win.php.net/ext.php/php_pdo.dll
If you are running on Windows, you should download:
http://snaps.php.net/win32/php5.0-win32-latest.zip
http://snaps.php.net/win32/PECL_5_0/php_pdo.dll
You can find additional PDO drivers at:
http://pecl4win.php.net
http://snaps.php.net/win32/PECL_5_0/
** Changes **
- Changed PDO_XXX constants to PDO::XXX
- It is now possible to extend PDO and PDOStatement and override their constructors
- Fixed Bug #35303; PDO::prepare() can cause crashes with invalid parameters
- Fixed Bug #35135; "new PDOStatement" can cause crashes.
- Fixed Bug #35293 and PECL Bug #5589; segfault when creating persistent connections
- Fixed PECL Bug #5010, problem installing headers
- renamed pdo_drivers() to PDO::getAvailableDrivers()
- Various fixes when building with SPL
- PDO::setAttribute(PDO::ATTR_STATEMENT_CLASS) allows you to set your own
PDOStatement replacement when extending PDO and PDOStatement
- Fixed Bug #34687; error information from PDO::query() was not always returned
- Fixed PECL Bug #5750; uri: DSN was not handled correctly
- Fixed PECL Bug #5589; segfault when persistent connection attempt fails
- Fixed Bug #34590; User defined PDOStatement class methods are not callable
- Fixed Bug #34908; FETCH_INTO segfaults without destination object
- Fixed PECL Bug #5809; PDOStatement::execute(array(...)) modifies args
- Fixed PECL Bug #5772; FETCH_FUNC cannot call functions with mixed case names
** Note **
You should uninstall and re-install your individual database drivers whenever
you upgrade the base PDO package, otherwise you will see an error about PDO API
numbers when you run your PHP scripts.
- Added PDO::quote($string). Closes PECL Bug #3393
</notes>
+81 -129
View File
@@ -33,14 +33,12 @@
#include "php_pdo_int.h"
#include "zend_exceptions.h"
static zend_class_entry *spl_ce_RuntimeException;
ZEND_DECLARE_MODULE_GLOBALS(pdo)
/* True global resources - no need for thread safety here */
/* the registry of PDO drivers */
HashTable pdo_driver_hash;
static HashTable pdo_driver_hash;
/* we use persistent resources for the driver connection stuff */
static int le_ppdo;
@@ -58,74 +56,17 @@ PDO_API zend_class_entry *php_pdo_get_exception(void)
return pdo_exception_ce;
}
PDO_API zend_class_entry *php_pdo_get_exception_base(int root TSRMLS_DC)
{
#if can_handle_soft_dependency_on_SPL && defined(HAVE_SPL) && ((PHP_MAJOR_VERSION > 5) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 1))
if (!root) {
if (!spl_ce_RuntimeException) {
zend_class_entry **pce;
if (zend_hash_find(CG(class_table), "runtimeexception", sizeof("RuntimeException"), (void **) &pce) == SUCCESS) {
spl_ce_RuntimeException = *pce;
return *pce;
}
} else {
return spl_ce_RuntimeException;
}
}
#endif
#if (PHP_MAJOR_VERSION < 6)
return zend_exception_get_default();
#else
return zend_exception_get_default(TSRMLS_C);
#endif
}
zend_class_entry *pdo_dbh_ce, *pdo_dbstmt_ce, *pdo_row_ce;
/* proto array pdo_drivers()
Return array of available PDO drivers */
PHP_FUNCTION(pdo_drivers)
{
HashPosition pos;
pdo_driver_t **pdriver;
array_init(return_value);
zend_hash_internal_pointer_reset_ex(&pdo_driver_hash, &pos);
while (SUCCESS == zend_hash_get_current_data_ex(&pdo_driver_hash, (void**)&pdriver, &pos)) {
add_next_index_stringl(return_value, (char*)(*pdriver)->driver_name, (*pdriver)->driver_name_len, 1);
zend_hash_move_forward_ex(&pdo_driver_hash, &pos);
}
}
/* }}} */
/* {{{ pdo_functions[] */
function_entry pdo_functions[] = {
PHP_FE(pdo_drivers, NULL)
{NULL, NULL, NULL}
};
/* }}} */
/* {{{ pdo_functions[] */
#if ZEND_MODULE_API_NO >= 20050922
static zend_module_dep pdo_deps[] = {
#ifdef HAVE_SPL
ZEND_MOD_REQUIRED("spl")
#endif
{NULL, NULL, NULL}
};
#endif
/* }}} */
/* {{{ pdo_module_entry */
zend_module_entry pdo_module_entry = {
#if ZEND_MODULE_API_NO >= 20050922
STANDARD_MODULE_HEADER_EX, NULL,
pdo_deps,
#else
STANDARD_MODULE_HEADER,
#endif
"PDO",
pdo_functions,
PHP_MINIT(pdo),
@@ -133,7 +74,7 @@ zend_module_entry pdo_module_entry = {
PHP_RINIT(pdo),
PHP_RSHUTDOWN(pdo),
PHP_MINFO(pdo),
"1.0",
"0.2.1",
STANDARD_MODULE_PROPERTIES
};
/* }}} */
@@ -257,54 +198,12 @@ PDO_API int php_pdo_parse_data_source(const char *data_source,
return n_matches;
}
static const char digit_vec[] = "0123456789";
PDO_API char *php_pdo_int64_to_str(pdo_int64_t i64 TSRMLS_DC)
{
char buffer[65];
char outbuf[65] = "";
register char *p;
long long_val;
char *dst = outbuf;
if (i64 < 0) {
i64 = -i64;
*dst++ = '-';
}
if (i64 == 0) {
*dst++ = '0';
*dst++ = '\0';
return estrdup(outbuf);
}
p = &buffer[sizeof(buffer)-1];
*p = '\0';
while ((pdo_uint64_t)i64 > (pdo_uint64_t)LONG_MAX) {
pdo_uint64_t quo = (pdo_uint64_t)i64 / (unsigned int)10;
unsigned int rem = (unsigned int)(i64 - quo*10U);
*--p = digit_vec[rem];
i64 = (pdo_int64_t)quo;
}
long_val = (long)i64;
while (long_val != 0) {
long quo = long_val / 10;
*--p = digit_vec[(unsigned int)(long_val - quo * 10)];
long_val = quo;
}
while ((*dst++ = *p++) != 0)
;
*dst = '\0';
return estrdup(outbuf);
}
/* {{{ PHP_MINIT_FUNCTION */
PHP_MINIT_FUNCTION(pdo)
{
zend_class_entry ce;
spl_ce_RuntimeException = NULL;
ZEND_INIT_MODULE_GLOBALS(pdo, php_pdo_init_globals, NULL);
REGISTER_INI_ENTRIES();
@@ -318,14 +217,86 @@ PHP_MINIT_FUNCTION(pdo)
le_ppdo = zend_register_list_destructors_ex(NULL, php_pdo_pdbh_dtor,
"PDO persistent database", module_number);
REGISTER_LONG_CONSTANT("PDO_PARAM_NULL", (long)PDO_PARAM_NULL, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_PARAM_INT", (long)PDO_PARAM_INT, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_PARAM_STR", (long)PDO_PARAM_STR, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_PARAM_LOB", (long)PDO_PARAM_LOB, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_PARAM_STMT", (long)PDO_PARAM_STMT, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_PARAM_INPUT_OUTPUT", (long)PDO_PARAM_INPUT_OUTPUT, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_FETCH_LAZY", (long)PDO_FETCH_LAZY, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_FETCH_ASSOC",(long)PDO_FETCH_ASSOC, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_FETCH_NUM", (long)PDO_FETCH_NUM, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_FETCH_BOTH", (long)PDO_FETCH_BOTH, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_FETCH_OBJ", (long)PDO_FETCH_OBJ, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_FETCH_BOUND",(long)PDO_FETCH_BOUND, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_FETCH_COLUMN",(long)PDO_FETCH_COLUMN, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_FETCH_CLASS",(long)PDO_FETCH_CLASS, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_FETCH_INTO", (long)PDO_FETCH_INTO, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_ATTR_AUTOCOMMIT", (long)PDO_ATTR_AUTOCOMMIT, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_ATTR_PREFETCH", (long)PDO_ATTR_PREFETCH, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_ATTR_TIMEOUT", (long)PDO_ATTR_TIMEOUT, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_ATTR_ERRMODE", (long)PDO_ATTR_ERRMODE, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_ATTR_SERVER_VERSION", (long)PDO_ATTR_SERVER_VERSION, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_ATTR_CLIENT_VERSION", (long)PDO_ATTR_CLIENT_VERSION, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_ATTR_SERVER_INFO", (long)PDO_ATTR_SERVER_INFO, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_ATTR_CONNECTION_STATUS", (long)PDO_ATTR_CONNECTION_STATUS, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_ATTR_CASE", (long)PDO_ATTR_CASE, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_ATTR_CURSOR_NAME", (long)PDO_ATTR_CURSOR_NAME, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_ATTR_CURSOR", (long)PDO_ATTR_CURSOR, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_ATTR_ORACLE_NULLS", (long)PDO_ATTR_ORACLE_NULLS, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_ATTR_PERSISTENT", (long)PDO_ATTR_PERSISTENT, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_ERRMODE_SILENT", (long)PDO_ERRMODE_SILENT, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_ERRMODE_WARNING", (long)PDO_ERRMODE_WARNING, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_ERRMODE_EXCEPTION", (long)PDO_ERRMODE_EXCEPTION, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_CASE_NATURAL", (long)PDO_CASE_NATURAL, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_CASE_LOWER", (long)PDO_CASE_LOWER, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_CASE_UPPER", (long)PDO_CASE_UPPER, CONST_CS|CONST_PERSISTENT);
REGISTER_STRING_CONSTANT("PDO_ERR_NONE", PDO_ERR_NONE, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_FETCH_ORI_NEXT", (long)PDO_FETCH_ORI_NEXT, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_FETCH_ORI_PRIOR", (long)PDO_FETCH_ORI_PRIOR, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_FETCH_ORI_FIRST", (long)PDO_FETCH_ORI_FIRST, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_FETCH_ORI_LAST", (long)PDO_FETCH_ORI_LAST, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_FETCH_ORI_ABS", (long)PDO_FETCH_ORI_ABS, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_FETCH_ORI_REL", (long)PDO_FETCH_ORI_REL, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_CURSOR_FWDONLY", (long)PDO_CURSOR_FWDONLY,CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_CURSOR_SCROLL", (long)PDO_CURSOR_SCROLL,CONST_CS|CONST_PERSISTENT);
#if 0
REGISTER_LONG_CONSTANT("PDO_ERR_CANT_MAP", (long)PDO_ERR_CANT_MAP, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_ERR_SYNTAX", (long)PDO_ERR_SYNTAX, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_ERR_CONSTRAINT", (long)PDO_ERR_CONSTRAINT, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_ERR_NOT_FOUND", (long)PDO_ERR_NOT_FOUND, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_ERR_ALREADY_EXISTS", (long)PDO_ERR_ALREADY_EXISTS, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_ERR_NOT_IMPLEMENTED", (long)PDO_ERR_NOT_IMPLEMENTED, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_ERR_MISMATCH", (long)PDO_ERR_MISMATCH, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_ERR_TRUNCATED", (long)PDO_ERR_TRUNCATED, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_ERR_DISCONNECTED", (long)PDO_ERR_DISCONNECTED, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PDO_ERR_NO_PERM", (long)PDO_ERR_NO_PERM, CONST_CS|CONST_PERSISTENT);
#endif
INIT_CLASS_ENTRY(ce, "PDOException", NULL);
pdo_exception_ce = zend_register_internal_class_ex(&ce, php_pdo_get_exception_base(0 TSRMLS_CC), NULL TSRMLS_CC);
pdo_exception_ce = zend_register_internal_class_ex(&ce, zend_exception_get_default(), NULL TSRMLS_CC);
zend_declare_property_null(pdo_exception_ce, "errorInfo", sizeof("errorInfo")-1, ZEND_ACC_PUBLIC TSRMLS_CC);
pdo_dbh_init(TSRMLS_C);
pdo_stmt_init(TSRMLS_C);
INIT_CLASS_ENTRY(ce, "PDO", pdo_dbh_functions);
ce.create_object = pdo_dbh_new;
pdo_dbh_ce = zend_register_internal_class(&ce TSRMLS_CC);
INIT_CLASS_ENTRY(ce, "PDOStatement", pdo_dbstmt_functions);
ce.create_object = pdo_dbstmt_new;
pdo_dbstmt_ce = zend_register_internal_class(&ce TSRMLS_CC);
pdo_dbstmt_ce->get_iterator = pdo_stmt_iter_get;
INIT_CLASS_ENTRY(ce, "PDORow", pdo_row_functions);
ce.create_object = pdo_row_new;
pdo_row_ce = zend_register_internal_class(&ce TSRMLS_CC);
return SUCCESS;
}
@@ -360,27 +331,8 @@ PHP_RSHUTDOWN_FUNCTION(pdo)
/* {{{ PHP_MINFO_FUNCTION */
PHP_MINFO_FUNCTION(pdo)
{
HashPosition pos;
char *drivers = NULL, *ldrivers = estrdup("");
pdo_driver_t **pdriver;
php_info_print_table_start();
php_info_print_table_header(2, "PDO support", "enabled");
zend_hash_internal_pointer_reset_ex(&pdo_driver_hash, &pos);
while (SUCCESS == zend_hash_get_current_data_ex(&pdo_driver_hash, (void**)&pdriver, &pos)) {
spprintf(&drivers, 0, "%s, %s", ldrivers, (*pdriver)->driver_name);
zend_hash_move_forward_ex(&pdo_driver_hash, &pos);
efree(ldrivers);
ldrivers = drivers;
}
php_info_print_table_row(2, "PDO drivers", drivers ? drivers+2 : "");
if (drivers) {
efree(drivers);
}
php_info_print_table_header(2, "pdo support", "enabled");
php_info_print_table_end();
#if 0
+216 -533
View File
File diff suppressed because it is too large. Load diff
+116 -270
View File
@@ -1,10 +1,10 @@
/* Generated by re2c 0.9.9.rc1 on Sat Sep 10 15:53:03 2005 */
#line 1 "ext/pdo/pdo_sql_parser.re"
/* Generated by re2c 0.9.3 on Tue Feb 8 19:46:35 2005 */
#line 1 "/data/wez/pecl/pdo/pdo_sql_parser.re"
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2005 The PHP Group |
| Copyright (c) 1997-2004 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -22,7 +22,6 @@
#include "php.h"
#include "php_pdo_driver.h"
#include "php_pdo_int.h"
#define PDO_PARSER_TEXT 1
#define PDO_PARSER_BIND 2
@@ -44,250 +43,161 @@ typedef struct Scanner {
static int scan(Scanner *s)
{
char *cursor = s->cur;
s->tok = cursor;
#line 55 "ext/pdo/pdo_sql_parser.re"
std:
s->tok = cursor;
#line 54 "/data/wez/pecl/pdo/pdo_sql_parser.re"
{
static unsigned char yybm[] = {
0, 162, 162, 162, 162, 162, 162, 162,
162, 162, 162, 162, 162, 162, 162, 162,
162, 162, 162, 162, 162, 162, 162, 162,
162, 162, 162, 162, 162, 162, 162, 162,
162, 162, 52, 162, 162, 162, 162, 196,
162, 162, 162, 162, 162, 162, 162, 162,
170, 170, 170, 170, 170, 170, 170, 170,
170, 170, 244, 162, 162, 162, 162, 244,
162, 170, 170, 170, 170, 170, 170, 170,
170, 170, 170, 170, 170, 170, 170, 170,
170, 170, 170, 170, 170, 170, 170, 170,
170, 170, 170, 162, 2, 162, 162, 170,
162, 170, 170, 170, 170, 170, 170, 170,
170, 170, 170, 170, 170, 170, 170, 170,
170, 170, 170, 170, 170, 170, 170, 170,
170, 170, 170, 162, 162, 162, 162, 162,
162, 162, 162, 162, 162, 162, 162, 162,
162, 162, 162, 162, 162, 162, 162, 162,
162, 162, 162, 162, 162, 162, 162, 162,
162, 162, 162, 162, 162, 162, 162, 162,
162, 162, 162, 162, 162, 162, 162, 162,
162, 162, 162, 162, 162, 162, 162, 162,
162, 162, 162, 162, 162, 162, 162, 162,
162, 162, 162, 162, 162, 162, 162, 162,
162, 162, 162, 162, 162, 162, 162, 162,
162, 162, 162, 162, 162, 162, 162, 162,
162, 162, 162, 162, 162, 162, 162, 162,
162, 162, 162, 162, 162, 162, 162, 162,
162, 162, 162, 162, 162, 162, 162, 162,
162, 162, 162, 162, 162, 162, 162, 162,
162, 162, 162, 162, 162, 162, 162, 162,
162, 162, 162, 162, 162, 162, 162, 162,
};
#line 89 "<stdout>"
#line 7 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept;
static unsigned char yybm[] = {
0, 168, 168, 168, 168, 168, 168, 168,
168, 168, 168, 168, 168, 168, 168, 168,
168, 168, 168, 168, 168, 168, 168, 168,
168, 168, 168, 168, 168, 168, 168, 168,
168, 168, 0, 168, 168, 168, 168, 192,
168, 168, 168, 168, 168, 168, 168, 168,
184, 184, 184, 184, 184, 184, 184, 184,
184, 184, 160, 168, 168, 168, 168, 160,
168, 184, 184, 184, 184, 184, 184, 184,
184, 184, 184, 184, 184, 184, 184, 184,
184, 184, 184, 184, 184, 184, 184, 184,
184, 184, 184, 168, 8, 168, 168, 184,
168, 184, 184, 184, 184, 184, 184, 184,
184, 184, 184, 184, 184, 184, 184, 184,
184, 184, 184, 184, 184, 184, 184, 184,
184, 184, 184, 168, 168, 168, 168, 168,
168, 168, 168, 168, 168, 168, 168, 168,
168, 168, 168, 168, 168, 168, 168, 168,
168, 168, 168, 168, 168, 168, 168, 168,
168, 168, 168, 168, 168, 168, 168, 168,
168, 168, 168, 168, 168, 168, 168, 168,
168, 168, 168, 168, 168, 168, 168, 168,
168, 168, 168, 168, 168, 168, 168, 168,
168, 168, 168, 168, 168, 168, 168, 168,
168, 168, 168, 168, 168, 168, 168, 168,
168, 168, 168, 168, 168, 168, 168, 168,
168, 168, 168, 168, 168, 168, 168, 168,
168, 168, 168, 168, 168, 168, 168, 168,
168, 168, 168, 168, 168, 168, 168, 168,
168, 168, 168, 168, 168, 168, 168, 168,
168, 168, 168, 168, 168, 168, 168, 168,
168, 168, 168, 168, 168, 168, 168, 168,
};
goto yy0;
++YYCURSOR;
yy1: ++YYCURSOR;
yy0:
if((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
if(yybm[0+yych] & 2) {
goto yy8;
}
if(yych <= 0x00) goto yy11;
if(yybm[0+yych] & 8) goto yy8;
if(yych <= '\000') goto yy11;
if(yych <= '&') goto yy2;
if(yych <= '\'') goto yy4;
if(yych <= '>') goto yy5;
goto yy6;
yy2: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
if(yybm[0+yych] & 64) {
goto yy30;
}
if(yych <= 0x00) goto yy3;
if(yych == '"') goto yy28;
goto yy33;
if(yych >= '\001') goto yy24;
goto yy3;
yy3:
#line 63 "ext/pdo/pdo_sql_parser.re"
#line 61 "/data/wez/pecl/pdo/pdo_sql_parser.re"
{ RET(PDO_PARSER_TEXT); }
#line 117 "<stdout>"
#line 63 "<stdout>"
yy4: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
if(yybm[0+yych] & 16) {
goto yy19;
}
if(yych <= 0x00) goto yy3;
if(yych == '\'') goto yy21;
goto yy24;
if(yych <= '\000') goto yy3;
if(yych == '"') goto yy3;
goto yy17;
yy5: yych = *++YYCURSOR;
if(yybm[0+yych] & 4) {
goto yy13;
}
if(yych <= 'Z'){
if(yych <= '/') goto yy3;
if(yych <= ':') goto yy16;
if(yych <= '@') goto yy3;
goto yy16;
} else {
if(yych <= '_'){
if(yych <= '^') goto yy3;
goto yy16;
} else {
if(yych <= '`') goto yy3;
if(yych <= 'z') goto yy16;
goto yy3;
}
}
if(yybm[0+yych] & 16) goto yy13;
goto yy3;
yy6: ++YYCURSOR;
if(yybm[0+(yych = *YYCURSOR)] & 4) {
yych = *YYCURSOR;
goto yy13;
}
goto yy7;
yy7:
#line 62 "ext/pdo/pdo_sql_parser.re"
#line 60 "/data/wez/pecl/pdo/pdo_sql_parser.re"
{ RET(PDO_PARSER_BIND_POS); }
#line 154 "<stdout>"
#line 77 "<stdout>"
yy8: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy9;
yy9: if(yybm[0+yych] & 2) {
goto yy8;
}
yy9: if(yybm[0+yych] & 8) goto yy8;
goto yy10;
yy10:
#line 64 "ext/pdo/pdo_sql_parser.re"
#line 62 "/data/wez/pecl/pdo/pdo_sql_parser.re"
{ RET(PDO_PARSER_TEXT); }
#line 166 "<stdout>"
#line 88 "<stdout>"
yy11: ++YYCURSOR;
goto yy12;
yy12:
#line 65 "ext/pdo/pdo_sql_parser.re"
#line 63 "/data/wez/pecl/pdo/pdo_sql_parser.re"
{ RET(PDO_PARSER_EOI); }
#line 172 "<stdout>"
#line 94 "<stdout>"
yy13: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy14;
yy14: if(yybm[0+yych] & 4) {
goto yy13;
}
yy14: if(yybm[0+yych] & 16) goto yy13;
goto yy15;
yy15:
#line 60 "ext/pdo/pdo_sql_parser.re"
{ RET(PDO_PARSER_TEXT); }
#line 184 "<stdout>"
#line 59 "/data/wez/pecl/pdo/pdo_sql_parser.re"
{ RET(PDO_PARSER_BIND); }
#line 105 "<stdout>"
yy16: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy17;
yy17: if(yybm[0+yych] & 8) {
goto yy16;
yy17: if(yybm[0+yych] & 32) goto yy16;
if(yych <= '&') goto yy18;
if(yych <= '\'') goto yy19;
goto yy22;
yy18: YYCURSOR = YYMARKER;
switch(yyaccept){
case 1: goto yy21;
case 0: goto yy3;
}
goto yy18;
yy18:
#line 61 "ext/pdo/pdo_sql_parser.re"
{ RET(PDO_PARSER_BIND); }
#line 196 "<stdout>"
yy19: yyaccept = 1;
YYMARKER = ++YYCURSOR;
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy20;
yy20: if(yybm[0+yych] & 16) {
goto yy19;
}
if(yych <= '\''){
if(yych <= 0x00) goto yy15;
if(yych <= '&') goto yy23;
goto yy21;
} else {
if(yych == '\\') goto yy26;
goto yy23;
}
yy21: ++YYCURSOR;
if(yybm[0+(yych = *YYCURSOR)] & 4) {
yych = *YYCURSOR;
goto yy13;
}
yy20: if(yybm[0+yych] & 32) goto yy16;
if(yych <= '&') goto yy21;
if(yych <= '\'') goto yy19;
goto yy22;
yy22:
#line 59 "ext/pdo/pdo_sql_parser.re"
yy21:
#line 58 "/data/wez/pecl/pdo/pdo_sql_parser.re"
{ RET(PDO_PARSER_TEXT); }
#line 222 "<stdout>"
#line 132 "<stdout>"
yy22: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
if(yych == '\'') goto yy16;
goto yy18;
yy23: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy24;
yy24: if(yybm[0+yych] & 32) {
goto yy23;
}
if(yych <= 0x00) goto yy25;
if(yych <= '[') goto yy27;
goto yy26;
yy25: YYCURSOR = YYMARKER;
switch(yyaccept){
case 1: goto yy15;
case 0: goto yy3;
}
yy24: if(yybm[0+yych] & 128) goto yy23;
if(yych <= '\000') goto yy18;
if(yych <= '[') goto yy26;
goto yy25;
yy25: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
if(yych == '"') goto yy23;
goto yy18;
yy26: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
if(yych == '\'') goto yy23;
goto yy25;
yy27: yych = *++YYCURSOR;
goto yy22;
yy28: ++YYCURSOR;
if(yybm[0+(yych = *YYCURSOR)] & 4) {
yych = *YYCURSOR;
goto yy13;
}
goto yy29;
yy29:
#line 58 "ext/pdo/pdo_sql_parser.re"
goto yy27;
yy27:
#line 57 "/data/wez/pecl/pdo/pdo_sql_parser.re"
{ RET(PDO_PARSER_TEXT); }
#line 254 "<stdout>"
yy30: yyaccept = 1;
YYMARKER = ++YYCURSOR;
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
goto yy31;
yy31: if(yybm[0+yych] & 64) {
goto yy30;
}
if(yych <= '"'){
if(yych <= 0x00) goto yy15;
if(yych >= '"') goto yy28;
goto yy32;
} else {
if(yych == '\\') goto yy34;
goto yy32;
}
yy32: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy33;
yy33: if(yybm[0+yych] & 128) {
goto yy32;
}
if(yych <= 0x00) goto yy25;
if(yych <= '[') goto yy35;
goto yy34;
yy34: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
if(yych == '"') goto yy32;
goto yy25;
yy35: ++YYCURSOR;
yych = *YYCURSOR;
goto yy29;
#line 159 "<stdout>"
}
}
#line 66 "ext/pdo/pdo_sql_parser.re"
#line 64 "/data/wez/pecl/pdo/pdo_sql_parser.re"
}
@@ -310,6 +220,7 @@ PDO_API int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len,
int bindno = 0;
int ret = 0;
int newbuffer_len;
int padding;
HashTable *params;
struct pdo_bound_param_data *param;
int query_type = PDO_PLACEHOLDER_NONE;
@@ -356,26 +267,16 @@ PDO_API int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len,
return -1;
}
if (stmt->supports_placeholders == query_type && !stmt->named_rewrite_template) {
if (stmt->supports_placeholders == query_type) {
/* query matches native syntax */
ret = 0;
goto clean_up;
}
if (stmt->named_rewrite_template) {
/* magic/hack.
* We we pretend that the query was positional even if
* it was named so that we fall into the
* named rewrite case below. Not too pretty,
* but it works. */
query_type = PDO_PLACEHOLDER_POSITIONAL;
}
params = stmt->bound_params;
/* Do we have placeholders but no bound params */
if (bindno && !params && stmt->supports_placeholders == PDO_PLACEHOLDER_NONE) {
if (bindno && !params) {
pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "no parameters were bound" TSRMLS_CC);
ret = -1;
goto clean_up;
@@ -426,38 +327,18 @@ PDO_API int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len,
ret = -1;
goto clean_up;
}
plc->freeq = 1;
} else {
switch (Z_TYPE_P(param->parameter)) {
case IS_NULL:
plc->quoted = "NULL";
plc->qlen = sizeof("NULL")-1;
plc->freeq = 0;
break;
case IS_LONG:
case IS_DOUBLE:
convert_to_string(param->parameter);
plc->qlen = Z_STRLEN_P(param->parameter);
plc->quoted = Z_STRVAL_P(param->parameter);
plc->freeq = 0;
break;
case IS_BOOL:
convert_to_long(param->parameter);
default:
convert_to_string(param->parameter);
if (!stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL_P(param->parameter),
Z_STRLEN_P(param->parameter), &plc->quoted, &plc->qlen,
param->param_type TSRMLS_CC)) {
/* bork */
ret = -1;
strcpy(stmt->error_code, stmt->dbh->error_code);
goto clean_up;
}
plc->freeq = 1;
convert_to_string(param->parameter);
if (!stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL_P(param->parameter),
Z_STRLEN_P(param->parameter), &plc->quoted, &plc->qlen,
param->param_type TSRMLS_CC)) {
/* bork */
ret = -1;
strcpy(stmt->error_code, stmt->dbh->error_code);
goto clean_up;
}
}
plc->freeq = 1;
} else {
plc->quoted = Z_STRVAL_P(param->parameter);
plc->qlen = Z_STRLEN_P(param->parameter);
@@ -501,60 +382,25 @@ rewrite:
} else if (query_type == PDO_PLACEHOLDER_POSITIONAL) {
/* rewrite ? to :pdoX */
char idxbuf[32];
const char *tmpl = stmt->named_rewrite_template ? stmt->named_rewrite_template : ":pdo%d";
char *name;
newbuffer_len = inquery_len;
if (stmt->bound_param_map == NULL) {
ALLOC_HASHTABLE(stmt->bound_param_map);
zend_hash_init(stmt->bound_param_map, 13, NULL, NULL, 0);
}
for (plc = placeholders; plc; plc = plc->next) {
snprintf(idxbuf, sizeof(idxbuf), tmpl, plc->bindno + 1);
snprintf(idxbuf, sizeof(idxbuf), ":pdo%d", plc->bindno);
plc->quoted = estrdup(idxbuf);
plc->qlen = strlen(plc->quoted);
plc->freeq = 1;
newbuffer_len += plc->qlen;
name = estrndup(plc->pos, plc->len);
if (stmt->named_rewrite_template) {
/* create a mapping */
zend_hash_update(stmt->bound_param_map, name, plc->len + 1, idxbuf, plc->qlen + 1, NULL);
}
/* map number to name */
zend_hash_index_update(stmt->bound_param_map, plc->bindno, idxbuf, plc->qlen + 1, NULL);
efree(name);
}
goto rewrite;
} else {
/* rewrite :name to ? */
newbuffer_len = inquery_len;
if (stmt->bound_param_map == NULL) {
ALLOC_HASHTABLE(stmt->bound_param_map);
zend_hash_init(stmt->bound_param_map, 13, NULL, NULL, 0);
}
for (plc = placeholders; plc; plc = plc->next) {
char *name;
name = estrndup(plc->pos, plc->len);
zend_hash_index_update(stmt->bound_param_map, plc->bindno, name, plc->len + 1, NULL);
efree(name);
plc->quoted = "?";
plc->qlen = 1;
}
goto rewrite;
/* HARD!. We need to remember the mapping and bind those positions. */
pdo_raise_impl_error(stmt->dbh, stmt, "IM001", "cannot map :name to ? in this version" TSRMLS_CC);
ret = -1;
}
clean_up:
+24 -91
View File
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2005 The PHP Group |
| Copyright (c) 1997-2004 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -20,7 +20,6 @@
#include "php.h"
#include "php_pdo_driver.h"
#include "php_pdo_int.h"
#define PDO_PARSER_TEXT 1
#define PDO_PARSER_BIND 2
@@ -42,8 +41,8 @@ typedef struct Scanner {
static int scan(Scanner *s)
{
char *cursor = s->cur;
s->tok = cursor;
std:
s->tok = cursor;
/*!re2c
BINDCHR = [:][a-zA-Z0-9_]+;
QUESTION = [?];
@@ -56,13 +55,12 @@ static int scan(Scanner *s)
/*!re2c
(["] (ESCQQ|ANYNOEOF\[\\"])* ["]) { RET(PDO_PARSER_TEXT); }
(['] (ESCQ|ANYNOEOF\[\\'])* [']) { RET(PDO_PARSER_TEXT); }
SPECIALS{2,} { RET(PDO_PARSER_TEXT); }
BINDCHR { RET(PDO_PARSER_BIND); }
QUESTION { RET(PDO_PARSER_BIND_POS); }
SPECIALS { RET(PDO_PARSER_TEXT); }
(ANYNOEOF\SPECIALS)+ { RET(PDO_PARSER_TEXT); }
EOF { RET(PDO_PARSER_EOI); }
(['] (ESCQ|ANYNOEOF\[\\"])* [']) { RET(PDO_PARSER_TEXT); }
BINDCHR { RET(PDO_PARSER_BIND); }
QUESTION { RET(PDO_PARSER_BIND_POS); }
SPECIALS { RET(PDO_PARSER_TEXT); }
(ANYNOEOF\SPECIALS)+ { RET(PDO_PARSER_TEXT); }
EOF { RET(PDO_PARSER_EOI); }
*/
}
@@ -131,26 +129,16 @@ PDO_API int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len,
return -1;
}
if (stmt->supports_placeholders == query_type && !stmt->named_rewrite_template) {
if (stmt->supports_placeholders == query_type) {
/* query matches native syntax */
ret = 0;
goto clean_up;
}
if (stmt->named_rewrite_template) {
/* magic/hack.
* We we pretend that the query was positional even if
* it was named so that we fall into the
* named rewrite case below. Not too pretty,
* but it works. */
query_type = PDO_PLACEHOLDER_POSITIONAL;
}
params = stmt->bound_params;
/* Do we have placeholders but no bound params */
if (bindno && !params && stmt->supports_placeholders == PDO_PLACEHOLDER_NONE) {
if (bindno && !params) {
pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "no parameters were bound" TSRMLS_CC);
ret = -1;
goto clean_up;
@@ -201,38 +189,18 @@ PDO_API int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len,
ret = -1;
goto clean_up;
}
plc->freeq = 1;
} else {
switch (Z_TYPE_P(param->parameter)) {
case IS_NULL:
plc->quoted = "NULL";
plc->qlen = sizeof("NULL")-1;
plc->freeq = 0;
break;
case IS_LONG:
case IS_DOUBLE:
convert_to_string(param->parameter);
plc->qlen = Z_STRLEN_P(param->parameter);
plc->quoted = Z_STRVAL_P(param->parameter);
plc->freeq = 0;
break;
case IS_BOOL:
convert_to_long(param->parameter);
default:
convert_to_string(param->parameter);
if (!stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL_P(param->parameter),
Z_STRLEN_P(param->parameter), &plc->quoted, &plc->qlen,
param->param_type TSRMLS_CC)) {
/* bork */
ret = -1;
strcpy(stmt->error_code, stmt->dbh->error_code);
goto clean_up;
}
plc->freeq = 1;
convert_to_string(param->parameter);
if (!stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL_P(param->parameter),
Z_STRLEN_P(param->parameter), &plc->quoted, &plc->qlen,
param->param_type TSRMLS_CC)) {
/* bork */
ret = -1;
strcpy(stmt->error_code, stmt->dbh->error_code);
goto clean_up;
}
}
plc->freeq = 1;
} else {
plc->quoted = Z_STRVAL_P(param->parameter);
plc->qlen = Z_STRLEN_P(param->parameter);
@@ -276,60 +244,25 @@ rewrite:
} else if (query_type == PDO_PLACEHOLDER_POSITIONAL) {
/* rewrite ? to :pdoX */
char idxbuf[32];
const char *tmpl = stmt->named_rewrite_template ? stmt->named_rewrite_template : ":pdo%d";
char *name;
newbuffer_len = inquery_len;
if (stmt->bound_param_map == NULL) {
ALLOC_HASHTABLE(stmt->bound_param_map);
zend_hash_init(stmt->bound_param_map, 13, NULL, NULL, 0);
}
for (plc = placeholders; plc; plc = plc->next) {
snprintf(idxbuf, sizeof(idxbuf), tmpl, plc->bindno + 1);
snprintf(idxbuf, sizeof(idxbuf), ":pdo%d", plc->bindno);
plc->quoted = estrdup(idxbuf);
plc->qlen = strlen(plc->quoted);
plc->freeq = 1;
newbuffer_len += plc->qlen;
name = estrndup(plc->pos, plc->len);
if (stmt->named_rewrite_template) {
/* create a mapping */
zend_hash_update(stmt->bound_param_map, name, plc->len + 1, idxbuf, plc->qlen + 1, NULL);
}
/* map number to name */
zend_hash_index_update(stmt->bound_param_map, plc->bindno, idxbuf, plc->qlen + 1, NULL);
efree(name);
}
goto rewrite;
} else {
/* rewrite :name to ? */
newbuffer_len = inquery_len;
if (stmt->bound_param_map == NULL) {
ALLOC_HASHTABLE(stmt->bound_param_map);
zend_hash_init(stmt->bound_param_map, 13, NULL, NULL, 0);
}
for (plc = placeholders; plc; plc = plc->next) {
char *name;
name = estrndup(plc->pos, plc->len);
zend_hash_index_update(stmt->bound_param_map, plc->bindno, name, plc->len + 1, NULL);
efree(name);
plc->quoted = "?";
plc->qlen = 1;
}
goto rewrite;
/* HARD!. We need to remember the mapping and bind those positions. */
pdo_raise_impl_error(stmt->dbh, stmt, "IM001", "cannot map :name to ? in this version" TSRMLS_CC);
ret = -1;
}
clean_up:
+2 -152
View File
@@ -36,17 +36,13 @@ struct pdo_sqlstate_info {
static HashTable err_hash;
static struct pdo_sqlstate_info err_initializer[] = {
{ "00000", "No error" },
{ "01000", "Warning" },
{ "00000", "No error" },
{ "01001", "Cursor operation conflict" },
{ "01002", "Disconnect error" },
{ "01003", "NULL value eliminated in set function" },
{ "01004", "String data, right truncated" },
{ "01006", "Privilege not revoked" },
{ "01007", "Privilege not granted" },
{ "01008", "Implicit zero bit padding" },
{ "0100C", "Dynamic result sets returned" },
{ "01P01", "Deprecated feature" },
{ "01S00", "Invalid connection string attribute" },
{ "01S01", "Error in row" },
{ "01S02", "Option value changed" },
@@ -54,163 +50,44 @@ static struct pdo_sqlstate_info err_initializer[] = {
{ "01S07", "Fractional truncation" },
{ "01S08", "Error saving File DSN" },
{ "01S09", "Invalid keyword" },
{ "02000", "No data" },
{ "02001", "No additional dynamic result sets returned" },
{ "03000", "Sql statement not yet complete" },
{ "07002", "COUNT field incorrect" },
{ "07005", "Prepared statement not a cursor-specification" },
{ "07006", "Restricted data type attribute violation" },
{ "07009", "Invalid descriptor index" },
{ "07S01", "Invalid use of default parameter" },
{ "08000", "Connection exception" },
{ "08001", "Client unable to establish connection" },
{ "08002", "Connection name in use" },
{ "08003", "Connection does not exist" },
{ "08004", "Server rejected the connection" },
{ "08006", "Connection failure" },
{ "08007", "Connection failure during transaction" },
{ "08S01", "Communication link failure" },
{ "09000", "Triggered action exception" },
{ "0A000", "Feature not supported" },
{ "0B000", "Invalid transaction initiation" },
{ "0F000", "Locator exception" },
{ "0F001", "Invalid locator specification" },
{ "0L000", "Invalid grantor" },
{ "0LP01", "Invalid grant operation" },
{ "0P000", "Invalid role specification" },
{ "21000", "Cardinality violation" },
{ "21S01", "Insert value list does not match column list" },
{ "21S02", "Degree of derived table does not match column list" },
{ "22000", "Data exception" },
{ "22001", "String data, right truncated" },
{ "22002", "Indicator variable required but not supplied" },
{ "22003", "Numeric value out of range" },
{ "22004", "Null value not allowed" },
{ "22005", "Error in assignment" },
{ "22007", "Invalid datetime format" },
{ "22008", "Datetime field overflow" },
{ "22009", "Invalid time zone displacement value" },
{ "2200B", "Escape character conflict" },
{ "2200C", "Invalid use of escape character" },
{ "2200D", "Invalid escape octet" },
{ "2200F", "Zero length character string" },
{ "2200G", "Most specific type mismatch" },
{ "22010", "Invalid indicator parameter value" },
{ "22011", "Substring error" },
{ "22012", "Division by zero" },
{ "22015", "Interval field overflow" },
{ "22018", "Invalid character value for cast specification" },
{ "22019", "Invalid escape character" },
{ "2201B", "Invalid regular expression" },
{ "2201E", "Invalid argument for logarithm" },
{ "2201F", "Invalid argument for power function" },
{ "2201G", "Invalid argument for width bucket function" },
{ "22020", "Invalid limit value" },
{ "22021", "Character not in repertoire" },
{ "22022", "Indicator overflow" },
{ "22023", "Invalid parameter value" },
{ "22024", "Unterminated c string" },
{ "22025", "Invalid escape sequence" },
{ "22026", "String data, length mismatch" },
{ "22027", "Trim error" },
{ "2202E", "Array subscript error" },
{ "22P01", "Floating point exception" },
{ "22P02", "Invalid text representation" },
{ "22P03", "Invalid binary representation" },
{ "22P04", "Bad copy file format" },
{ "22P05", "Untranslatable character" },
{ "23000", "Integrity constraint violation" },
{ "23001", "Restrict violation" },
{ "23502", "Not null violation" },
{ "23503", "Foreign key violation" },
{ "23505", "Unique violation" },
{ "23514", "Check violation" },
{ "24000", "Invalid cursor state" },
{ "25000", "Invalid transaction state" },
{ "25001", "Active sql transaction" },
{ "25002", "Branch transaction already active" },
{ "25003", "Inappropriate access mode for branch transaction" },
{ "25004", "Inappropriate isolation level for branch transaction" },
{ "25005", "No active sql transaction for branch transaction" },
{ "25006", "Read only sql transaction" },
{ "25007", "Schema and data statement mixing not supported" },
{ "25008", "Held cursor requires same isolation level" },
{ "25P01", "No active sql transaction" },
{ "25P02", "In failed sql transaction" },
{ "25S01", "Transaction state" },
{ "25S02", "Transaction is still active" },
{ "25S03", "Transaction is rolled back" },
{ "26000", "Invalid sql statement name" },
{ "27000", "Triggered data change violation" },
{ "28000", "Invalid authorization specification" },
{ "2B000", "Dependent privilege descriptors still exist" },
{ "2BP01", "Dependent objects still exist" },
{ "2D000", "Invalid transaction termination" },
{ "2F000", "Sql routine exception" },
{ "2F002", "Modifying sql data not permitted" },
{ "2F003", "Prohibited sql statement attempted" },
{ "2F004", "Reading sql data not permitted" },
{ "2F005", "Function executed no return statement" },
{ "34000", "Invalid cursor name" },
{ "38000", "External routine exception" },
{ "38001", "Containing sql not permitted" },
{ "38002", "Modifying sql data not permitted" },
{ "38003", "Prohibited sql statement attempted" },
{ "38004", "Reading sql data not permitted" },
{ "39000", "External routine invocation exception" },
{ "39001", "Invalid sqlstate returned" },
{ "39004", "Null value not allowed" },
{ "39P01", "Trigger protocol violated" },
{ "39P02", "Srf protocol violated" },
{ "3B000", "Savepoint exception" },
{ "3B001", "Invalid savepoint specification" },
{ "3C000", "Duplicate cursor name" },
{ "3D000", "Invalid catalog name" },
{ "3F000", "Invalid schema name" },
{ "40000", "Transaction rollback" },
{ "40001", "Serialization failure" },
{ "40002", "Transaction integrity constraint violation" },
{ "40003", "Statement completion unknown" },
{ "40P01", "Deadlock detected" },
{ "42000", "Syntax error or access violation" },
{ "42501", "Insufficient privilege" },
{ "42601", "Syntax error" },
{ "42602", "Invalid name" },
{ "42611", "Invalid column definition" },
{ "42622", "Name too long" },
{ "42701", "Duplicate column" },
{ "42702", "Ambiguous column" },
{ "42703", "Undefined column" },
{ "42704", "Undefined object" },
{ "42710", "Duplicate object" },
{ "42712", "Duplicate alias" },
{ "42723", "Duplicate function" },
{ "42725", "Ambiguous function" },
{ "42803", "Grouping error" },
{ "42804", "Datatype mismatch" },
{ "42809", "Wrong object type" },
{ "42830", "Invalid foreign key" },
{ "42846", "Cannot coerce" },
{ "42883", "Undefined function" },
{ "42939", "Reserved name" },
{ "42P01", "Undefined table" },
{ "42P02", "Undefined parameter" },
{ "42P03", "Duplicate cursor" },
{ "42P04", "Duplicate database" },
{ "42P05", "Duplicate prepared statement" },
{ "42P06", "Duplicate schema" },
{ "42P07", "Duplicate table" },
{ "42P08", "Ambiguous parameter" },
{ "42P09", "Ambiguous alias" },
{ "42P10", "Invalid column reference" },
{ "42P11", "Invalid cursor definition" },
{ "42P12", "Invalid database definition" },
{ "42P13", "Invalid function definition" },
{ "42P14", "Invalid prepared statement definition" },
{ "42P15", "Invalid schema definition" },
{ "42P16", "Invalid table definition" },
{ "42P17", "Invalid object definition" },
{ "42P18", "Indeterminate datatype" },
{ "42S01", "Base table or view already exists" },
{ "42S02", "Base table or view not found" },
{ "42S11", "Index already exists" },
@@ -218,28 +95,6 @@ static struct pdo_sqlstate_info err_initializer[] = {
{ "42S21", "Column already exists" },
{ "42S22", "Column not found" },
{ "44000", "WITH CHECK OPTION violation" },
{ "53000", "Insufficient resources" },
{ "53100", "Disk full" },
{ "53200", "Out of memory" },
{ "53300", "Too many connections" },
{ "54000", "Program limit exceeded" },
{ "54001", "Statement too complex" },
{ "54011", "Too many columns" },
{ "54023", "Too many arguments" },
{ "55000", "Object not in prerequisite state" },
{ "55006", "Object in use" },
{ "55P02", "Cant change runtime param" },
{ "55P03", "Lock not available" },
{ "57000", "Operator intervention" },
{ "57014", "Query canceled" },
{ "57P01", "Admin shutdown" },
{ "57P02", "Crash shutdown" },
{ "57P03", "Cannot connect now" },
{ "58030", "Io error" },
{ "58P01", "Undefined file" },
{ "58P02", "Duplicate file" },
{ "F0000", "Config file error" },
{ "F0001", "Lock file exists" },
{ "HY000", "General error" },
{ "HY001", "Memory allocation error" },
{ "HY003", "Invalid application buffer type" },
@@ -296,12 +151,7 @@ static struct pdo_sqlstate_info err_initializer[] = {
{ "IM012", "DRIVER keyword syntax error" },
{ "IM013", "Trace file error" },
{ "IM014", "Invalid name of File DSN" },
{ "IM015", "Corrupt file data source" },
{ "P0000", "Plpgsql error" },
{ "P0001", "Raise exception" },
{ "XX000", "Internal error" },
{ "XX001", "Data corrupted" },
{ "XX002", "Index corrupted" }
{ "IM015", "Corrupt file data source" }
};
void pdo_sqlstate_fini_error_table(void)
+230 -1130
View File
File diff suppressed because it is too large. Load diff
+1 -21
View File
@@ -23,15 +23,11 @@
#include "zend.h"
#if PHP_MAJOR_VERSION > 5 || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 1)
#define can_handle_soft_dependency_on_SPL 1
#endif
extern zend_module_entry pdo_module_entry;
#define phpext_pdo_ptr &pdo_module_entry
#ifdef PHP_WIN32
# if defined(PDO_EXPORTS) || (!defined(COMPILE_DL_PDO))
# ifdef PDO_EXPORTS
# define PDO_API __declspec(dllexport)
# elif defined(COMPILE_DL_PDO)
# define PDO_API __declspec(dllimport)
@@ -62,22 +58,6 @@ ZEND_END_MODULE_GLOBALS(pdo)
# define PDOG(v) (pdo_globals.v)
#endif
PDO_API void php_pdo_declare_long_constant(const char *const_name, size_t name_len, long value TSRMLS_DC);
PDO_API void php_pdo_declare_stringl_constant(const char *const_name, size_t name_len, const char *value, size_t value_len TSRMLS_DC);
#define REGISTER_PDO_CLASS_CONST_LONG(const_name, value) \
php_pdo_declare_long_constant(const_name, sizeof(const_name)-1, (long)value TSRMLS_CC);
#define REGISTER_PDO_CLASS_CONST_STRING(const_name, value) \
php_pdo_declare_stringl_constant(const_name, sizeof(const_name)-1, value, sizeof(value)-1 TSRMLS_CC);
#define PDO_CONSTRUCT_CHECK \
if (!dbh->driver) { \
pdo_raise_impl_error(dbh, NULL, "00000", "PDO constructor was not called" TSRMLS_CC); \
return; \
} \
#endif /* PHP_PDO_H */
+35 -124
View File
@@ -28,15 +28,6 @@ typedef struct _pdo_dbh_t pdo_dbh_t;
typedef struct _pdo_stmt_t pdo_stmt_t;
struct pdo_bound_param_data;
#ifdef PHP_WIN32
typedef __int64 pdo_int64_t;
typedef unsigned __int64 pdo_uint64_t;
#else
typedef long long int pdo_int64_t;
typedef unsigned long long int pdo_uint64_t;
#endif
PDO_API char *php_pdo_int64_to_str(pdo_int64_t i64 TSRMLS_DC);
#ifndef TRUE
# define TRUE 1
#endif
@@ -44,7 +35,7 @@ PDO_API char *php_pdo_int64_to_str(pdo_int64_t i64 TSRMLS_DC);
# define FALSE 0
#endif
#define PDO_DRIVER_API 20051031
#define PDO_DRIVER_API 20050206
enum pdo_param_type {
PDO_PARAM_NULL,
@@ -68,14 +59,13 @@ enum pdo_param_type {
/* get_col ptr should point to a zend_bool */
PDO_PARAM_BOOL,
/* magic flag to denote a parameter as being input/output */
PDO_PARAM_INPUT_OUTPUT = 0x80000000
};
/* magic flag to denote a parameter as being input/output */
#define PDO_PARAM_INPUT_OUTPUT 0x80000000
#define PDO_PARAM_FLAGS 0xFFFF0000
#define PDO_PARAM_TYPE(x) ((x) & ~PDO_PARAM_FLAGS)
#define PDO_PARAM_TYPE(x) ((x) & ~PDO_PARAM_INPUT_OUTPUT)
enum pdo_fetch_type {
PDO_FETCH_USE_DEFAULT,
@@ -88,17 +78,9 @@ enum pdo_fetch_type {
PDO_FETCH_COLUMN, /* fetch a numbered column only */
PDO_FETCH_CLASS, /* create an instance of named class, call ctor and set properties */
PDO_FETCH_INTO, /* fetch row into an existing object */
PDO_FETCH_FUNC, /* fetch into function and return its result */
PDO_FETCH_NAMED, /* like PDO_FETCH_ASSOC, but can handle duplicate names */
PDO_FETCH__MAX /* must be last */
};
#define PDO_FETCH_FLAGS 0xFFFF0000 /* fetchAll() modes or'd to PDO_FETCH_XYZ */
#define PDO_FETCH_GROUP 0x00010000 /* fetch into groups */
#define PDO_FETCH_UNIQUE 0x00030000 /* fetch into groups assuming first col is unique */
#define PDO_FETCH_CLASSTYPE 0x00040000 /* fetch class gets its class name from 1st column */
#define PDO_FETCH_SERIALIZE 0x00080000 /* fetch class instances by calling serialize */
/* fetch orientation for scrollable cursors */
enum pdo_fetch_orientation {
PDO_FETCH_ORI_NEXT, /* default: fetch the next available row */
@@ -106,7 +88,7 @@ enum pdo_fetch_orientation {
PDO_FETCH_ORI_FIRST, /* scroll to the first row and fetch that */
PDO_FETCH_ORI_LAST, /* scroll to the last row and fetch that */
PDO_FETCH_ORI_ABS, /* scroll to an absolute numbered row and fetch that */
PDO_FETCH_ORI_REL /* scroll relative to the current row, and fetch that */
PDO_FETCH_ORI_REL, /* scroll relative to the current row, and fetch that */
};
enum pdo_attribute_type {
@@ -123,12 +105,6 @@ enum pdo_attribute_type {
PDO_ATTR_CURSOR, /* cursor type */
PDO_ATTR_ORACLE_NULLS, /* convert empty strings to NULL */
PDO_ATTR_PERSISTENT, /* pconnect style connection */
PDO_ATTR_STATEMENT_CLASS, /* array(classname, array(ctor_args)) to specify the class of the constructed statement */
PDO_ATTR_FETCH_TABLE_NAMES, /* include table names in the column names, where available */
PDO_ATTR_FETCH_CATALOG_NAMES, /* include the catalog/db name names in the column names, where available */
PDO_ATTR_DRIVER_NAME, /* name of the driver (as used in the constructor) */
PDO_ATTR_STRINGIFY_FETCHES, /* converts integer/float types to strings during fetch */
PDO_ATTR_MAX_COLUMN_LEN, /* make database calculate maximum length of data found in a column */
/* this defines the start of the range for driver specific options.
* Drivers should define their own attribute constants beginning with this
@@ -138,7 +114,7 @@ enum pdo_attribute_type {
enum pdo_cursor_type {
PDO_CURSOR_FWDONLY, /* forward only cursor (default) */
PDO_CURSOR_SCROLL /* scrollable cursor */
PDO_CURSOR_SCROLL, /* scrollable cursor */
};
/* SQL-92 SQLSTATE error codes.
@@ -162,11 +138,29 @@ typedef char pdo_error_type[6]; /* SQLSTATE */
#define PDO_ERR_NONE "00000"
#if 0
/* generic error code values.
* Don't want to go overboard with these.
* */
#define PDO_ERR_SYNTAX "42000"
#define PDO_ERR_CONSTRAINT "23000"
#define PDO_ERR_NOT_FOUND ""
#define PDO_ERR_ALREADY_EXISTS,
#define PDO_ERR_NOT_IMPLEMENTED,
#define PDO_ERR_MISMATCH,
#define PDO_ERR_TRUNCATED,
#define PDO_ERR_DISCONNECTED,
#define PDO_ERR_NO_PERM,
PDO_ERR_CANT_MAP, /* no way to map native error to the generic
* codes; consult the native error for more info */
};
#endif
enum pdo_error_mode {
PDO_ERRMODE_SILENT, /* just set error codes */
PDO_ERRMODE_WARNING, /* raise E_WARNING */
PDO_ERRMODE_EXCEPTION /* throw exceptions */
PDO_ERRMODE_EXCEPTION, /* throw exceptions */
};
enum pdo_case_conversion {
@@ -175,15 +169,8 @@ enum pdo_case_conversion {
PDO_CASE_LOWER
};
/* oracle interop settings */
enum pdo_null_handling {
PDO_NULL_NATURAL = 0,
PDO_NULL_EMPTY_STRING = 1,
PDO_NULL_TO_STRING = 2,
};
/* {{{ utils for reading attributes set as driver_options */
static inline long pdo_attr_lval(zval *options, enum pdo_attribute_type option_name, long defval TSRMLS_DC)
static inline long pdo_attr_lval(zval *options, enum pdo_fetch_type option_name, long defval TSRMLS_DC)
{
zval **v;
@@ -193,16 +180,6 @@ static inline long pdo_attr_lval(zval *options, enum pdo_attribute_type option_n
}
return defval;
}
static inline char *pdo_attr_strval(zval *options, enum pdo_attribute_type option_name, char *defval TSRMLS_DC)
{
zval **v;
if (options && SUCCESS == zend_hash_index_find(Z_ARRVAL_P(options), option_name, (void**)&v)) {
convert_to_string_ex(v);
return estrndup(Z_STRVAL_PP(v), Z_STRLEN_PP(v));
}
return defval ? estrdup(defval) : NULL;
}
/* }}} */
/* This structure is registered with PDO when a PDO driver extension is
@@ -247,9 +224,8 @@ typedef int (*pdo_dbh_txn_func)(pdo_dbh_t *dbh TSRMLS_DC);
/* setting of attributes */
typedef int (*pdo_dbh_set_attr_func)(pdo_dbh_t *dbh, long attr, zval *val TSRMLS_DC);
/* return last insert id. NULL indicates error condition, otherwise, the return value
* MUST be an emalloc'd NULL terminated string. */
typedef char *(*pdo_dbh_last_id_func)(pdo_dbh_t *dbh, const char *name, unsigned int *len TSRMLS_DC);
/* return last insert id */
typedef long (*pdo_dbh_last_id_func)(pdo_dbh_t *dbh TSRMLS_DC);
/* fetch error information. if stmt is not null, fetch information pertaining
* to the statement, otherwise fetch global error information. The driver
@@ -267,11 +243,6 @@ typedef int (*pdo_dbh_get_attr_func)(pdo_dbh_t *dbh, long attr, zval *val TSRMLS
* You may set this handler to NULL, which is equivalent to returning SUCCESS. */
typedef int (*pdo_dbh_check_liveness_func)(pdo_dbh_t *dbh TSRMLS_DC);
/* called at request end for each persistent dbh; this gives the driver
* the opportunity to safely release resources that only have per-request
* scope */
typedef void (*pdo_dbh_request_shutdown)(pdo_dbh_t *dbh TSRMLS_DC);
/* for adding methods to the dbh or stmt objects
pointer to a list of driver specific functions. The convention is
to prefix the function names using the PDO driver name; this will
@@ -300,7 +271,6 @@ struct pdo_dbh_methods {
pdo_dbh_get_attr_func get_attribute;
pdo_dbh_check_liveness_func check_liveness;
pdo_dbh_get_driver_methods_func get_driver_methods;
pdo_dbh_request_shutdown persistent_shutdown;
};
/* }}} */
@@ -338,7 +308,7 @@ enum pdo_param_event {
PDO_PARAM_EVT_EXEC_PRE,
PDO_PARAM_EVT_EXEC_POST,
PDO_PARAM_EVT_FETCH_PRE,
PDO_PARAM_EVT_FETCH_POST
PDO_PARAM_EVT_FETCH_POST,
};
typedef int (*pdo_stmt_param_hook_func)(pdo_stmt_t *stmt, struct pdo_bound_param_data *param, enum pdo_param_event event_type TSRMLS_DC);
@@ -385,12 +355,6 @@ typedef int (*pdo_stmt_get_column_meta_func)(pdo_stmt_t *stmt, long colno, zval
* to the caller. */
typedef int (*pdo_stmt_next_rowset_func)(pdo_stmt_t *stmt TSRMLS_DC);
/* closes the active cursor on a statement, leaving the prepared
* statement ready for re-execution. Useful to explicitly state
* that you are done with a given rowset, without having to explicitly
* fetch all the rows. */
typedef int (*pdo_stmt_cursor_closer_func)(pdo_stmt_t *stmt TSRMLS_DC);
struct pdo_stmt_methods {
pdo_stmt_dtor_func dtor;
pdo_stmt_execute_func executer;
@@ -402,7 +366,6 @@ struct pdo_stmt_methods {
pdo_stmt_get_attr_func get_attribute;
pdo_stmt_get_column_meta_func get_column_meta;
pdo_stmt_next_rowset_func next_rowset;
pdo_stmt_cursor_closer_func cursor_closer;
};
/* }}} */
@@ -455,15 +418,12 @@ struct _pdo_dbh_t {
/* max length a single character can become after correct quoting */
unsigned max_escaped_char_length:3;
/* oracle compat; see enum pdo_null_handling */
unsigned oracle_nulls:2;
/* when set, convert int/floats to strings */
unsigned stringify:1;
/* when set, convert empty strings to NULL */
unsigned oracle_nulls:1;
/* the sum of the number of bits here and the bit fields preceeding should
* equal 32 */
unsigned _reserved_flags:21;
unsigned _reserved_flags:23;
/* data source string used to open this handle */
const char *data_source;
@@ -483,18 +443,6 @@ struct _pdo_dbh_t {
/* driver specific "class" methods for the dbh and stmt */
HashTable *cls_methods[PDO_DBH_DRIVER_METHOD_KIND__MAX];
pdo_driver_t *driver;
zend_class_entry *def_stmt_ce;
zval *def_stmt_ctor_args;
/* when calling PDO::query(), we need to keep the error
* context from the statement around until we next clear it.
* This will allow us to report the correct error message
* when PDO::query() fails */
pdo_stmt_t *query_stmt;
zval query_stmt_zval;
};
/* describes a column */
@@ -504,9 +452,6 @@ struct pdo_column_data {
unsigned long maxlen;
enum pdo_param_type param_type;
unsigned long precision;
/* don't touch this unless your name is dbdo */
void *dbdo_data;
};
/* describes a bound parameter */
@@ -529,16 +474,6 @@ struct pdo_bound_param_data {
/* represents a prepared statement */
struct _pdo_stmt_t {
/* these items must appear in this order at the beginning of the
struct so that this can be cast as a zend_object. we need this
to allow the extending class to escape all the custom handlers
that PDO declares.
*/
zend_class_entry *ce;
HashTable *properties;
unsigned int in_get:1;
unsigned int in_set:1;
/* driver specifics */
struct pdo_stmt_methods *methods;
void *driver_data;
@@ -567,8 +502,6 @@ struct _pdo_stmt_t {
/* keep track of bound input parameters. Some drivers support
* input/output parameters, but you can't rely on that working */
HashTable *bound_params;
/* When rewriting from named to positional, this maps positions to names */
HashTable *bound_param_map;
/* keep track of PHP variables bound to named (or positional) columns
* in the result set */
HashTable *bound_columns;
@@ -598,25 +531,10 @@ struct _pdo_stmt_t {
int column;
struct {
zend_class_entry *ce;
zval *ctor_args; /* freed */
zval *retval_ptr;
zend_fcall_info fci;
zend_fcall_info_cache fcc;
zval *ctor_args;
} cls;
struct {
zval *function;
zval *fetch_args; /* freed */
zval *object;
zend_fcall_info fci;
zend_fcall_info_cache fcc;
zval **values; /* freed */
} func;
zval *into;
} fetch;
/* used by the query parser for driver specific
* parameter naming (see pgsql driver for example) */
const char *named_rewrite_template;
};
/* call this in MINIT to register your PDO driver */
@@ -642,13 +560,6 @@ PDO_API zend_class_entry *php_pdo_get_exception(void);
PDO_API int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len,
char **outquery, int *outquery_len TSRMLS_DC);
PDO_API void pdo_raise_impl_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt,
const char *sqlstate, const char *supp TSRMLS_DC);
PDO_API void php_pdo_stmt_addref(pdo_stmt_t *stmt TSRMLS_DC);
PDO_API void php_pdo_stmt_delref(pdo_stmt_t *stmt TSRMLS_DC);
#endif /* PHP_PDO_DRIVER_H */
/*
* Local variables:
+4 -15
View File
@@ -22,15 +22,9 @@
/* Stuff private to the PDO extension and not for consumption by PDO drivers
* */
extern HashTable pdo_driver_hash;
extern zend_class_entry *pdo_exception_ce;
PDO_API zend_class_entry *php_pdo_get_exception_base(int root TSRMLS_DC);
int php_pdo_list_entry(void);
void pdo_dbh_init(TSRMLS_D);
void pdo_stmt_init(TSRMLS_D);
extern zend_object_value pdo_dbh_new(zend_class_entry *ce TSRMLS_DC);
extern function_entry pdo_dbh_functions[];
extern zend_class_entry *pdo_dbh_ce;
@@ -39,7 +33,7 @@ extern ZEND_RSRC_DTOR_FUNC(php_pdo_pdbh_dtor);
extern zend_object_value pdo_dbstmt_new(zend_class_entry *ce TSRMLS_DC);
extern function_entry pdo_dbstmt_functions[];
extern zend_class_entry *pdo_dbstmt_ce;
void pdo_dbstmt_free_storage(pdo_stmt_t *stmt TSRMLS_DC);
void pdo_dbstmt_free_storage(zend_object *object TSRMLS_DC);
zend_object_iterator *pdo_stmt_iter_get(zend_class_entry *ce, zval *object TSRMLS_DC);
extern zend_object_handlers pdo_dbstmt_object_handlers;
int pdo_stmt_describe_columns(pdo_stmt_t *stmt TSRMLS_DC);
@@ -48,7 +42,7 @@ int pdo_stmt_setup_fetch_mode(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, in
extern zend_object_value pdo_row_new(zend_class_entry *ce TSRMLS_DC);
extern function_entry pdo_row_functions[];
extern zend_class_entry *pdo_row_ce;
void pdo_row_free_storage(pdo_stmt_t *stmt TSRMLS_DC);
void pdo_row_free_storage(zend_object *object TSRMLS_DC);
extern zend_object_handlers pdo_row_object_handlers;
zend_object_iterator *php_pdo_dbstmt_iter_get(zend_class_entry *ce, zval *object TSRMLS_DC);
@@ -56,14 +50,9 @@ zend_object_iterator *php_pdo_dbstmt_iter_get(zend_class_entry *ce, zval *object
extern pdo_driver_t *pdo_find_driver(const char *name, int namelen);
extern void pdo_handle_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt TSRMLS_DC);
extern void pdo_raise_impl_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *sqlstate, const char *supp TSRMLS_DC);
#define PDO_DBH_CLEAR_ERR() do { \
strcpy(dbh->error_code, PDO_ERR_NONE); \
if (dbh->query_stmt) { \
dbh->query_stmt = NULL; \
zend_objects_store_del_ref(&dbh->query_stmt_zval TSRMLS_CC); \
} \
} while (0)
#define PDO_DBH_CLEAR_ERR() strcpy(dbh->error_code, PDO_ERR_NONE)
#define PDO_STMT_CLEAR_ERR() strcpy(stmt->error_code, PDO_ERR_NONE)
#define PDO_HANDLE_DBH_ERR() if (strcmp(dbh->error_code, PDO_ERR_NONE)) { pdo_handle_error(dbh, NULL TSRMLS_CC); }
#define PDO_HANDLE_STMT_ERR() if (strcmp(stmt->error_code, PDO_ERR_NONE)) { pdo_handle_error(stmt->dbh, stmt TSRMLS_CC); }
Loaded 100 of 375 files, more files were not shown because too many files have changed in this diff. Show more