Skip to content

Commit

Permalink
Set 1 - Challange 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Foryah committed Aug 21, 2015
1 parent bd7e057 commit e8105e9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
13 changes: 13 additions & 0 deletions set1.go
Expand Up @@ -30,3 +30,16 @@ func SToH(utfString string) string {
func HTo64(hexString string) string {
return STo64(HToS(hexString))
}

// HeXor Returnes the xor between two hexa strings as a hexa string
func HeXor(first, second string) string {
result := []byte{}
first = HToS(first)
second = HToS(second)

for i := range first {
result = append(result, first[i]^second[i])
}

return SToH(string(result))
}
6 changes: 6 additions & 0 deletions set1_test.go
Expand Up @@ -9,3 +9,9 @@ func TestChall1(t *testing.T) {
t.Error("YOU SHALL NOT PASS !")
}
}

func TestChall2(t *testing.T) {
if HeXor("1c0111001f010100061a024b53535009181c", "686974207468652062756c6c277320657965") != "746865206b696420646f6e277420706c6179" {
t.Error("YOU SHALL NOT PASS !")
}
}

0 comments on commit e8105e9

Please sign in to comment.