summaryrefslogblamecommitdiffstats
path: root/enc/xor.go
blob: fe412b2c904b18ef78ac8414a37c90ed924d910a (plain) (tree)
1
2
3


                                                    


















                                        
// Copyright © 2020 rsiddharth <s@ricketyspace.net>
// SPDX-License-Identifier: ISC

package enc

func FixedXOR(a, b string) string {
	cs := ""
	if len(a) != len(b) {
		return cs
	}

	ab := []byte(a)
	bb := []byte(b)
	for i := 0; i < len(ab); i++ {
		p := HexCharToDec(ab[i])
		q := HexCharToDec(bb[i])
		r := DecToHexChar(p ^ q)

		cs += string(r)
	}
	return cs
}