hash

package
v0.0.0-...-494ab94 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 10, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package hash contains utility functions for hashing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hash3Words

func Hash3Words(a, b, c, initval uint32) uint32

Hash3Words calculates the Jenkins hash of 3 32-bit words. This is adapted from linux.

func IPv4FragmentHash

func IPv4FragmentHash(h header.IPv4) uint32

IPv4FragmentHash computes the hash of the IPv4 fragment as suggested in RFC 791.

怎么判断某些分片是属于同一个数据报的呢? 这里对头部的一些特征值进行 hash 操作,所得结果当作这个数据报的 ID ,通过这个 ID,就可以找到已经到达的分片,并进行重组。 计算分片哈希值:用到的特征值为 ID、协议号、源地址、目的地址、一个随机数。

func IPv6FragmentHash

func IPv6FragmentHash(h header.IPv6, f header.IPv6Fragment) uint32

IPv6FragmentHash computes the hash of the ipv6 fragment. Unlike IPv4, the protocol is not used to compute the hash. RFC 2640 (sec 4.5) is not very sharp on this aspect. As a reference, also Linux ignores the protocol to compute the hash (inet6_hash_frag).

func RandN32

func RandN32(n int) []uint32

RandN32 generates a slice of n cryptographic random 32-bit numbers.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL