php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
hash_tiger.c File Reference
#include "php_hash.h"
#include "php_hash_tiger.h"
#include "php_hash_tiger_tables.h"

Go to the source code of this file.

Macros

#define save_abc
 
#define round(a, b, c, x, mul)
 
#define pass(a, b, c, mul)
 
#define key_schedule
 
#define feedforward
 
#define compress(passes)
 
#define split_ex(str)
 
#define split   split_ex
 
#define tiger_compress(passes, str, state)
 
#define PHP_HASH_TIGER_OPS(p, b)
 

Functions

PHP_HASH_API void PHP_3TIGERInit (PHP_TIGER_CTX *context, ZEND_ATTRIBUTE_UNUSED HashTable *args)
 
PHP_HASH_API void PHP_4TIGERInit (PHP_TIGER_CTX *context, ZEND_ATTRIBUTE_UNUSED HashTable *args)
 
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)
 
 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)
 

Macro Definition Documentation

◆ compress

#define compress ( passes)
Value:
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; \
} \
#define feedforward
Definition hash_tiger.c:78
$obj a
Definition test.php:84

Definition at line 83 of file hash_tiger.c.

◆ feedforward

#define feedforward
Value:
a ^= aa; \
b -= bb; \
c += cc;

Definition at line 78 of file hash_tiger.c.

◆ key_schedule

#define key_schedule
Value:
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 L64
Definition php_hash.h:30

Definition at line 60 of file hash_tiger.c.

◆ pass

#define pass ( a,
b,
c,
mul )
Value:
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 round(tables, k1, k2)
Definition hash_gost.c:26

Definition at line 50 of file hash_tiger.c.

◆ PHP_HASH_TIGER_OPS

#define PHP_HASH_TIGER_OPS ( p,
b )
Value:
const php_hash_ops php_hash_##p##tiger##b##_ops = { \
"tiger" #b "," #p, \
(php_hash_init_func_t) PHP_##p##TIGERInit, \
(php_hash_final_func_t) PHP_TIGER##b##Final, \
php_tiger_unserialize, \
b/8, \
64, \
sizeof(PHP_TIGER_CTX), \
1 \
}
PHP_HASH_API zend_result php_hash_serialize(const php_hashcontext_object *hash, zend_long *magic, zval *zv)
Definition hash.c:334
PHP_HASH_API zend_result php_hash_copy(const void *ops, const void *orig_context, void *dest_context)
Definition hash.c:124
PHP_HASH_API void PHP_TIGERUpdate(PHP_TIGER_CTX *context, const unsigned char *input, size_t len)
Definition hash_tiger.c:194
void(* php_hash_final_func_t)(unsigned char *digest, void *context)
Definition php_hash.h:36
void(* php_hash_init_func_t)(void *context, HashTable *args)
Definition php_hash.h:34
void(* php_hash_update_func_t)(void *context, const unsigned char *buf, size_t count)
Definition php_hash.h:35
struct _php_hash_ops php_hash_ops
#define PHP_TIGER_SPEC
p
Definition session.c:1105

Definition at line 255 of file hash_tiger.c.

◆ round

#define round ( a,
b,
c,
x,
mul )
Value:
c ^= x; \
a -= t1[(unsigned char)(c)] ^ \
t2[(unsigned char)(((uint32_t)(c))>>(2*8))] ^ \
t3[(unsigned char)((c)>>(4*8))] ^ \
t4[(unsigned char)(((uint32_t)((c)>>(4*8)))>>(2*8))] ; \
b += t4[(unsigned char)(((uint32_t)(c))>>(1*8))] ^ \
t3[(unsigned char)(((uint32_t)(c))>>(3*8))] ^ \
t2[(unsigned char)(((uint32_t)((c)>>(4*8)))>>(1*8))] ^ \
t1[(unsigned char)(((uint32_t)((c)>>(4*8)))>>(3*8))]; \
b *= mul;
#define t4
#define t1
#define t3
#define t2

Definition at line 38 of file hash_tiger.c.

◆ save_abc

#define save_abc
Value:
aa = a; \
bb = b; \
cc = c;

Definition at line 33 of file hash_tiger.c.

◆ split

#define split   split_ex

Definition at line 112 of file hash_tiger.c.

◆ split_ex

#define split_ex ( str)
Value:
x0=str[0]; x1=str[1]; x2=str[2]; x3=str[3]; \
x4=str[4]; x5=str[5]; x6=str[6]; x7=str[7];

Definition at line 97 of file hash_tiger.c.

◆ tiger_compress

#define tiger_compress ( passes,
str,
state )
Value:
{ \
register uint64_t a, b, c, tmpa, x0, x1, x2, x3, x4, x5, x6, x7; \
uint64_t aa, bb, cc; \
unsigned int pass_no; \
\
a = state[0]; \
b = state[1]; \
c = state[2]; \
\
split(str); \
\
compress(passes); \
\
state[0] = a; \
state[1] = b; \
state[2] = c; \
}

Definition at line 115 of file hash_tiger.c.

Function Documentation

◆ PHP_3TIGERInit()

PHP_HASH_API void PHP_3TIGERInit ( PHP_TIGER_CTX * context,
ZEND_ATTRIBUTE_UNUSED HashTable * args )

Definition at line 177 of file hash_tiger.c.

◆ PHP_4TIGERInit()

PHP_HASH_API void PHP_4TIGERInit ( PHP_TIGER_CTX * context,
ZEND_ATTRIBUTE_UNUSED HashTable * args )

Definition at line 185 of file hash_tiger.c.

◆ PHP_HASH_TIGER_OPS() [1/6]

PHP_HASH_TIGER_OPS ( 3 ,
128  )

◆ PHP_HASH_TIGER_OPS() [2/6]

PHP_HASH_TIGER_OPS ( 3 ,
160  )

◆ PHP_HASH_TIGER_OPS() [3/6]

PHP_HASH_TIGER_OPS ( 3 ,
192  )

◆ PHP_HASH_TIGER_OPS() [4/6]

PHP_HASH_TIGER_OPS ( 4 ,
128  )

◆ PHP_HASH_TIGER_OPS() [5/6]

PHP_HASH_TIGER_OPS ( 4 ,
160  )

◆ PHP_HASH_TIGER_OPS() [6/6]

PHP_HASH_TIGER_OPS ( 4 ,
192  )

◆ PHP_TIGER128Final()

PHP_HASH_API void PHP_TIGER128Final ( unsigned char digest[16],
PHP_TIGER_CTX * context )

Definition at line 221 of file hash_tiger.c.

◆ PHP_TIGER160Final()

PHP_HASH_API void PHP_TIGER160Final ( unsigned char digest[20],
PHP_TIGER_CTX * context )

Definition at line 228 of file hash_tiger.c.

◆ PHP_TIGER192Final()

PHP_HASH_API void PHP_TIGER192Final ( unsigned char digest[24],
PHP_TIGER_CTX * context )

Definition at line 235 of file hash_tiger.c.

◆ PHP_TIGERUpdate()

PHP_HASH_API void PHP_TIGERUpdate ( PHP_TIGER_CTX * context,
const unsigned char * input,
size_t len )

Definition at line 194 of file hash_tiger.c.