aboutsummaryrefslogtreecommitdiff
path: root/fuzz/fuzz.go
blob: 4b0963c0694bf5c6597982c48f19832c3b1a3ae2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package fuzz

import "github.com/gorilla/securecookie"

var hashKey = []byte("very-secret12345")
var blockKey = []byte("a-lot-secret1234")
var s = securecookie.New(hashKey, blockKey)

func Fuzz(data []byte) int {
	var m int
	err := s.Decode("fuzz", string(data), &m)
	if err != nil {
		return 0
	}
	encoded, err := s.Encode("fuzz", m)
	if err != nil {
		panic(err)
	}
	if encoded != string(data) {
		panic("not the same")
	}
	return 1
}