package repeating_otp

import (
	"testing"
	"io/ioutil"
	"github.com/stretchr/testify/require"
	"encoding/base64"
)

func Test_Solve_1(t *testing.T) {
	input, err := ioutil.ReadFile("challenge-6.txt")
	require.Nil(t, err)

	input_decoded := make([]byte, base64.StdEncoding.DecodedLen(len(input)))
	base64.StdEncoding.Decode(input_decoded, input)

	guess_key_size(input_decoded)
}

package repeating_otp

import (
	"testing"
	"io/ioutil"
	"github.com/stretchr/testify/require"
	"fmt"
	"encoding/hex"
)

func Test_Solve_1(t *testing.T) {
	input, err := ioutil.ReadFile("challenge-6-raw")
	require.Nil(t, err)

	plaintext, key, score := Solve(input)

	if plaintext == nil {
		fmt.Printf("plaintext is nil\n")
	} else if key == nil {
		fmt.Printf("key is nil\n")
	} else {
		fmt.Printf("score: %d\n", score)
		fmt.Printf("key length: %d\n", len(key))
		fmt.Printf("key: %s\n", hex.EncodeToString(key))
		fmt.Printf("key string: %s\n", string(key))
		fmt.Printf("%s\n", plaintext)
	}
}

Use raw file as input, Printing niceties
Use raw file as input, Printing niceties
