From 3ed79ba77f5110cf901ccd469d9e40244c97279c Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Sun, 6 Sep 2020 22:07:20 -0400 Subject: lib: update XORCrackSingleKey * lib/brute.go (XORCrackSingleKey): Simplify function; use FillBytes and FixedXORBytes --- lib/brute.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib/brute.go') diff --git a/lib/brute.go b/lib/brute.go index 54be06b..5210df1 100644 --- a/lib/brute.go +++ b/lib/brute.go @@ -15,15 +15,15 @@ func XORCrackSingleKey(hs string) (byte, string, float64) { var scr float64 = 100.0 i := byte(0) + as := []byte(HexStrToAsciiStr(hs)) for i < 255 { - ks := FillStr(ByteToHexStr(i), l) - xs := FixedXOR(hs, ks) - as := HexStrToAsciiStr(xs) + ks := FillBytes(i, l) + xs := FixedXORBytes(as, ks) - s := phraseScore(as) + s := phraseScore(string(xs)) if s < scr { k = i - ds = as + ds = string(xs) scr = s } i += 1 -- cgit v1.2.3