From c1240b472934f0b7649922722fe0d61c0c1c6cac Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Sun, 30 Aug 2020 20:15:58 -0400 Subject: challenge: do challenge 5 * challenge/c05.go: Implement challenge 5. * cryptopals.go (main): Add handling to run challenge 5. * lib/hex.go (BytesToHexStr): New function. * lib/xor.go (RepeatingXOR): New function. --- lib/hex.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib/hex.go') diff --git a/lib/hex.go b/lib/hex.go index 6fe7e6a..5b1741f 100644 --- a/lib/hex.go +++ b/lib/hex.go @@ -53,3 +53,15 @@ func ByteToHexStr(b byte) string { return s } + +func BytesToHexStr(bs []byte) string { + hs := "" + if len(bs) < 1 { + return hs + } + + for i := 0; i < len(bs); i++ { + hs += ByteToHexStr(bs[i]) + } + return hs +} -- cgit v1.2.3