package parser

import (
	"crypto/sha256"
	"encoding/hex"
)

func isStringSliceNotEqual(old, new []string) bool {
	tmp := map[string]struct{}{}
	tmp2 := map[string]struct{}{}
	for i := range old {
		tmp[old[i]] = struct{}{}
	}
	l := len(tmp)
	for i := range new {
		e := new[i]
		tmp[e] = struct{}{}
		tmp2[e] = struct{}{}
		if l != len(tmp) {
			return true
		}
	}
	tmp = nil
	l = len(tmp2)
	for i := range old {
		tmp2[old[i]] = struct{}{}
		if l != len(tmp2) {
			return true
		}
	}
	return false
}

func Sum256(data []byte) string {
	h := sha256.Sum256(data)
	return hex.EncodeToString(h[:])
}
