antireplay

package
v2.1.7 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Antireplay package has cache implementations that are effective against replay attacks.

To understand more about replay attacks, please read documentation for mtglib.AntiReplayCache interface. This package has a list of some implementations of this interface.

Index

Constants

View Source
const (
	// DefaultStableBloomFilterMaxSize is a recommended byte size for a stable
	// bloom filter.
	DefaultStableBloomFilterMaxSize = 1024 * 1024 // 1MiB

	// DefaultStableBloomFilterErrorRate is a recommended default error rate for a
	// stable bloom filter.
	DefaultStableBloomFilterErrorRate = 0.001
)

Variables

This section is empty.

Functions

func NewNoop

func NewNoop() mtglib.AntiReplayCache

NewNoop returns an implementation that does nothing. A corresponding method always returns false, so this cache accepts everything you pass to it.

func NewStableBloomFilter

func NewStableBloomFilter(byteSize uint, errorRate float64) mtglib.AntiReplayCache

NewStableBloomFilter returns an implementation of AntiReplayCache based on stable bloom filter.

http://webdocs.cs.ualberta.ca/~drafiei/papers/DupDet06Sigmod.pdf

The basic idea of a stable bloom filter is quite simple: each time when you set a new element, you randomly reset P elements. There is a hardcore math which proves that if you choose this P correctly, you can maintain the same error rate for a stream of elements.

byteSize is the number of bytes you want to give to a bloom filter. errorRate is desired false-positive error rate. If you want to use default values, please pass 0 for byteSize and <0 for errorRate.

Types

This section is empty.

Jump to

Keyboard shortcuts

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