Documentation
¶
Index ¶
- Constants
- func Decrypt(blockCipher BlockCipher, ciphertext, maxvalue, tweak uint64, feistelRounds int) uint64
- func Encrypt(blockCipher BlockCipher, plaintext, maxvalue, tweak uint64, feistelRounds int) uint64
- func SimpleDecrypt(blockCipher BlockCipher, ciphertext, maxvalue uint64) uint64
- func SimpleEncrypt(blockCipher BlockCipher, plaintext, maxvalue uint64) uint64
- type BlockCipher
Constants ¶
View Source
const FeistelRounds = 10
FeistelRounds is the number of rounds in random Feistel scheme. See Jacques Patarin CRYPTO'03 for the number.
Variables ¶
This section is empty.
Functions ¶
func Decrypt ¶
func Decrypt(blockCipher BlockCipher, ciphertext, maxvalue, tweak uint64, feistelRounds int) uint64
Decrypt decrypts the ciphertext number back.
func Encrypt ¶
func Encrypt(blockCipher BlockCipher, plaintext, maxvalue, tweak uint64, feistelRounds int) uint64
Encrypt encrypts the plaintext number into another number in [0;maxvalue]. You can specify the number of feistel network rounds and a tweak (publicly known modifier of the algorithm).
func SimpleDecrypt ¶
func SimpleDecrypt(blockCipher BlockCipher, ciphertext, maxvalue uint64) uint64
SimpleDecrypt decrypts the ciphertext number back.
func SimpleEncrypt ¶
func SimpleEncrypt(blockCipher BlockCipher, plaintext, maxvalue uint64) uint64
SimpleEncrypt encrypts the plaintext number into another number in [0;maxvalue].
Types ¶
type BlockCipher ¶
type BlockCipher interface {
// BlockSize returns the cipher's block size.
BlockSize() int
// Encrypt encrypts the first block in src into dst.
// Dst and src must overlap entirely or not at all.
Encrypt(dst, src []byte)
}
A BlockCipher represents an implementation of block cipher using a given key.
Click to show internal directories.
Click to hide internal directories.