Documentation
¶
Overview ¶
Copyright (c) of parts are held by the various contributors Licensed under the MIT License. See LICENSE file in the project root for full license information.
Copyright (c) of parts are held by the various contributors Licensed under the MIT License. See LICENSE file in the project root for full license information.
Copyright (c) of parts are held by the various contributors Licensed under the MIT License. See LICENSE file in the project root for full license information.
Index ¶
Constants ¶
const ( Seed = uint64(0xFAFAECECFAFAECEC) // The seed defines a "hash space". MapSizeBits = uint64(30) // Default table size Passes = uint64(5) // Default number of shuffles of the tables HashSize = uint64(256) // Default hash size. )
Default Seed
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LXRHash ¶
type LXRHash struct { ByteMap []byte // Integer Offsets MapSize uint64 // Size of the translation table MapSizeBits uint64 // Size of the ByteMap in Bits Passes uint64 // Passes to generate the rand table Seed uint64 // An arbitrary number used to create the tables. HashSize uint64 // Number of bytes in the hash // contains filtered or unexported fields }
func (*LXRHash) GenerateTable ¶
func (lx *LXRHash) GenerateTable()
GenerateTable Build a table with a rather simplistic but with many passes, adequately randomly ordered bytes. We do some straight forward bitwise math to initialize and scramble our ByteMap.
func (*LXRHash) Init ¶
Init() We use our own algorithm for initializing the map struct. This is an fairly large table of byte values we use to map bytes to other byte values to enhance the avalanche nature of the hash as well as increase the memory footprint of the hash.
Seed is a 64 bit starting point MapSizeBits is the number of bits to use for the MapSize, i.e. 10 = mapsize of 1024 HashSize is the number of bits in the hash; truncated to a byte bountry Passes is the number of shuffles of the ByteMap performed. Each pass shuffles all byte values in the map
func (*LXRHash) Log ¶
Log is a wrapper function that only prints information when verbose is enabled
func (*LXRHash) ReadTable ¶
func (lx *LXRHash) ReadTable()
ReadTable When a lookup table is on the disk, this will allow one to read it.
func (*LXRHash) Verbose ¶
Verbose enables or disables the output of progress indicators to the console
func (*LXRHash) WriteTable ¶
WriteTable When playing around with the algorithm, it is nice to generate files and use them off the disk. This allows the user to do that, and save the cost of regeneration between Lxrhash runs.