//返回哈希运算上下文对象,以供hash_update(), hash_update_stream(),hash_update_file(), 和 hash_final() 函数使用。
hash_init(string $algo,int $options= 0,string $key=null):HashContext
algo 要使用的哈希算法名称,例如:"md5","sha256","haval160,4" 等。
options 进行哈希运算的可选设置,目前仅支持一个选项:HASH_HMAC。 当指定此选项的时候,必须 指定 key 参数。
key 当 options 参数为 HASH_HMAC 时, 使用此参数传入进行 HMAC 哈希运算时的共享密钥
//返回哈希运算上下文的一个复本
hash_copy(HashContext $context):HashContext
context 由 hash_init() 函数返回的哈希运算上下文
//向活跃的哈希运算上下文中填充数据
hash_update(HashContext $context,string $data):bool
context 由 hash_init() 函数返回的哈希运算上下文。
data 要向哈希摘要中追加的数据
//从文件向活跃的哈希运算上下文中填充数据
hash_update_file(HashContext $hcontext,string $filename,resource $scontext=null):bool
hcontext 由 hash_init() 函数返回的哈希运算上下文。
filename 要进行哈希运算的文件路径,支持 fopen 封装器。
scontext 由 stream_context_create() 函数返回的流上下文
//从打开的流向活跃的哈希运算上下文中填充数据
hash_update_stream(HashContext $context,resource $handle,int $length= -1):int
context 由 hash_init() 函数返回的哈希运算上下文。
handle 创建流的函数返回的打开的文件句柄。
length 要从 handle 向活跃的哈希运算上下文中拷贝的最大字符数
//结束增量哈希,并且返回摘要结果
hash_final(HashContext $context,bool $raw_output=false):string
context hash_init() 函数返回的哈希运算上下文资源。
raw_output 设置为 true,输出格式为原始的二进制数据。 设置为 false,输出小写的 16 进制字符串