func (decryptor *PgHexDecryptor) MatchBeginTag(char byte) bool {
	if char == HexTagBegin[decryptor.currentIndex] {
		decryptor.currentIndex++
		return true
	}
	return false
}
MatchBeginTag returns true and updates currentIndex,
if currentIndex matches beginning of HexTagBegin
package postgresql
import (
	"bytes"
	"encoding/binary"
	"encoding/hex"
	"io"
	"github.com/cossacklabs/acra/decryptor/base"
	"github.com/cossacklabs/acra/keystore"
	"github.com/cossacklabs/acra/logging"
	"github.com/cossacklabs/acra/utils"
	"github.com/cossacklabs/acra/zone"
	"github.com/cossacklabs/themis/gothemis/cell"
	"github.com/cossacklabs/themis/gothemis/keys"
	"github.com/cossacklabs/themis/gothemis/message"
	log "github.com/sirupsen/logrus"
)
var (
	HexTagBegin          = []byte(hex.EncodeToString(base.TagBegin))
	HexZoneIDBegin       = []byte(hex.EncodeToString(zone.ZoneIDBegin))
	HexZoneTagLength     = len(HexZoneIDBegin)
	HexZoneIDLength      = hex.EncodedLen(16)
	HexZoneIDBlockLength = int(HexZoneTagLength + HexZoneIDLength)
)
func hexEncodedLen(val uint64) uint64 {
	return val * 2
}
type PgHexDecryptor struct {
	currentIndex uint8
	isWithZone   bool
	keyBlockBuffer [base.KeyBlockLength * 2]byte
	decodedKeyBlockBuffer []byte
	lengthBuf [base.DataLengthSize]byte
	hexLengthBuf [base.DataLengthSize * 2]byte
	keyStore     keystore.DecryptionKeyStore
	zoneMatcher  *zone.Matcher
	hexBuf []byte
	buf    []byte
	output []byte
	poisonKey []byte
	logger    *log.Entry
}
func NewPgHexDecryptor() *PgHexDecryptor {
	return &PgHexDecryptor{
		currentIndex:          0,
		isWithZone:            false,
		decodedKeyBlockBuffer: make([]byte, base.KeyBlockLength),
		logger:                log.NewEntry(log.StandardLogger()),
	}
}
func (decryptor *PgHexDecryptor) SetLogger(logger *log.Entry) {
	decryptor.logger = logger
}
func (decryptor *PgHexDecryptor) checkBuf(buf *[]byte, length uint64) {
	if buf == nil || uint64(len(*buf)) < length {
		*buf = make([]byte, length)
	}
}