code: func gen(tok, msg, iv []byte, ts time.Time, k *Key) int {
  	tok[0] = version
  	binary.BigEndian.PutUint64(tok[tsOffset:], uint64(ts.Unix()))
  	copy(tok[ivOffset:], iv)
  	p := tok[payOffset:]
  	n := pad(p, msg, aes.BlockSize)
  	bc, _ := aes.NewCipher(k.cryptBytes())
  	cipher.NewCBCEncrypter(bc, iv).CryptBlocks(p[:n], p[:n])
  	genhmac(p[n:n], tok[:payOffset+n], k.signBytes())
  	return payOffset + n + sha256.Size
  }
docs: // generates a token from msg, writes it into tok, and returns the
  // number of bytes generated, which is encodedLen(msg).
  // len(tok) must be >= encodedLen(len(msg))