diff --git a/server/proxy_checker/proxy_checker.go b/server/proxy_checker/proxy_checker.go index b0ae2c6..26ad0bf 100644 --- a/server/proxy_checker/proxy_checker.go +++ b/server/proxy_checker/proxy_checker.go @@ -6,7 +6,6 @@ package proxy_checker import ( "context" - "encoding/hex" "fmt" "hash/crc32" "io" @@ -102,20 +101,14 @@ func testProxy(ctx context.Context, auditor *audit.Auditor, proxyBaseURL string) return false, resp } - // Copy response body and compare CRC32 checksum with expected value + // Calculate CRC32 checksum of response body hash := crc32.NewIEEE() if _, err := io.Copy(hash, resp.Body); err != nil { auditor.SugaredLogger.Errorf("Error reading response body from image proxy %s: %v", proxyBaseURL, err) return false, resp } - checksum := hash.Sum32() - checksumHex := hex.EncodeToString([]byte{ - byte(checksum >> 24), - byte(checksum >> 16), - byte(checksum >> 8), - byte(checksum), - }) + checksumHex := fmt.Sprintf("%08x", hash.Sum32()) if checksumHex != testImageCRC32 { auditor.SugaredLogger.Warnf("CRC32 mismatch for image proxy %s. Expected: %s, Got: %s", proxyBaseURL, testImageCRC32, checksumHex)