\Nilsimsa

The MIT License (MIT)

Copyright (c) 2015 Bill Eager

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Summary

Methods
Properties
Constants
__construct()
process()
tranHash()
hexDigest()
digest()
computeDigest()
hash()
No public properties found
TRAN
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Constants

TRAN

TRAN

Tran53 hash constant

Methods

__construct()

__construct(string  $data = null,  $length = null)

Constructor

Parameters

string $data

The data to process

$length

process()

process(string  $chunk)

Computes the hash of all of the trigrams in the chunk using a window of length 5

Parameters

string $chunk

The chunk to process

tranHash()

tranHash(integer  $a,integer  $b,integer  $c,integer  $n): integer

Implementation of the Tran53 hash algorithm

Parameters

integer $a

Input A

integer $b

Input B

integer $c

Input C

integer $n

Input N

Returns

integer

hexDigest()

hexDigest(): string

Returns the digest as a hex string. Computes it if it isn't computed already.

Returns

string —

The digest

digest()

digest(): array

Returns the digest as an array. Computes it if it isn't computed already.

Returns

array —

The digest

computeDigest()

computeDigest()

Using a threshold (mean of the accumulator), computes the nilsimsa digest after completion. Sets complete flag to true and stores result in $this->digest

hash()

hash(  $data,  $length = 256)

Parameters

$data
$length