<commit_before>package cryptanalysis

import ()


func Chunk(data []byte, size int) [][]byte {
    var chunks [][]byte

    for i:=0; i<len(data); i=i+size {
        chunks = append(chunks, data[i:i+size])
    }

    return chunks
}


func Transpose(data [][]byte) [][]byte {
    var transpose [][]byte

    for i, _ := range data[0] {
        var temp []byte

        for j, _ := range data {
            temp = append(temp, data[j][i])
        }

        transpose = append(transpose, temp)
    }

    return transpose
}


func PadPkcs7(data []byte, size int) []byte {
    if len(data) < size {
        pad := size - len(data)
        for i:=0; i<pad; i++ {
            data = append(data, byte(pad))
        }
    }

    return data
}
<commit_msg>Handle last chunk when less than size.<commit_after>package cryptanalysis

import ()


func Chunk(data []byte, size int) [][]byte {
    count := len(data) - size
    var chunks [][]byte

    for i:=0; i<count; i=i+size {
        chunks = append(chunks, data[i:i+size])
    }

    chunks = append(chunks, data[count*size:])

    return chunks
}


func Transpose(data [][]byte) [][]byte {
    var transpose [][]byte

    for i, _ := range data[0] {
        var temp []byte

        for j, _ := range data {
            temp = append(temp, data[j][i])
        }

        transpose = append(transpose, temp)
    }

    return transpose
}


func PadPkcs7(data []byte, size int) []byte {
    if len(data) < size {
        pad := size - len(data)
        for i:=0; i<pad; i++ {
            data = append(data, byte(pad))
        }
    }

    return data
}

{'fraction_non_alphanumeric': 0.15134459036898062, 'fraction_numerical': 0.0050031269543464665, 'mean_word_length': 2.1189083820662766, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2300715', 'n_tokens_mistral': 562, 'n_tokens_neox': 539, 'n_words': 148}