hasher

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Example (ToBytes)
var i int16 = 1234

fmt.Println(i)
fmt.Println(toBytes(&i))
Output:


1234
[210 4]

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hash

func Hash(v any) uint64
Example
type Array struct {
	Title       string
	Description string
	Min         int
	Max         int
	Nullable    bool
	ReadOnly    bool
	WriteOnly   bool
	UniqueItems bool
}

fmt.Println(Hash(Array{Min: 1}))
Output:

8852669417329623389

Types

type Hashable

type Hashable interface {
	Hash() uint64
}

type Hasher

type Hasher struct {
	// contains filtered or unexported fields
}
Example
var h Hasher
h.Reset()

fmt.Println(h.Hash())
h.WriteString("foobar")
fmt.Println(h.Hash())
Output:


17241709254077376921
11721187498075204345

func (*Hasher) Hash

func (h *Hasher) Hash() uint64

func (*Hasher) Reset

func (h *Hasher) Reset()

func (*Hasher) Write

func (h *Hasher) Write(b []byte) (int, error)

func (*Hasher) WriteAny

func (h *Hasher) WriteAny(v any) (int, error)

func (*Hasher) WriteBool

func (h *Hasher) WriteBool(v bool) (int, error)

func (*Hasher) WriteFloat32

func (h *Hasher) WriteFloat32(v float32) (int, error)

func (*Hasher) WriteFloat64

func (h *Hasher) WriteFloat64(v float64) (int, error)

func (*Hasher) WriteInt

func (h *Hasher) WriteInt(v int) (int, error)

func (*Hasher) WriteInt8

func (h *Hasher) WriteInt8(v int8) (int, error)

func (*Hasher) WriteInt16

func (h *Hasher) WriteInt16(v int16) (int, error)

func (*Hasher) WriteInt32

func (h *Hasher) WriteInt32(v int32) (int, error)

func (*Hasher) WriteInt64

func (h *Hasher) WriteInt64(v int64) (int, error)

func (*Hasher) WriteString

func (h *Hasher) WriteString(s string) (int, error)

func (*Hasher) WriteUint

func (h *Hasher) WriteUint(v uint) (int, error)

func (*Hasher) WriteUint8

func (h *Hasher) WriteUint8(v uint8) (int, error)

func (*Hasher) WriteUint16

func (h *Hasher) WriteUint16(v uint16) (int, error)

func (*Hasher) WriteUint32

func (h *Hasher) WriteUint32(v uint32) (int, error)

func (*Hasher) WriteUint64

func (h *Hasher) WriteUint64(v uint64) (int, error)

Jump to

Keyboard shortcuts

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