<commit_before>package factom

import (
	"bytes"
	"crypto/sha256"
	"encoding/base64"
	"encoding/binary"
	"encoding/hex"
	"encoding/json"
	"time"
)

type jsonentry struct {
	ChainID string
	ExtIDs  []string
	Data    string
}

// Objects implimenting the FactomWriter interface may be used in the Submit
// call to create and add an entry to the factom network.
type FactomWriter interface {
	CreateFactomEntry() *Entry
}

// Objects implimenting the FactomChainer interface may be used in the
// CreateChain call to create a chain and first entry on the factom network.
type FactomChainer interface {
	CreateFactomChain() *Chain
}

// A factom entry that can be submitted to the factom network.
type Entry struct {
	TimeStamp int64
	ChainID   []byte
	ExtIDs    [][]byte
	Data      []byte
}

// CreateFactomEntry allows an Entry to satisfy the FactomWriter interface.
func (e *Entry) CreateFacomEntry() *Entry {
	return e
}

// Hash returns a hex encoded sha256 hash of the entry.
func (e *Entry) Hash() string {
	s := sha256.New()
	s.Write(e.MarshalBinary())
	return hex.EncodeToString(s.Sum(nil))
}

// Hex return the hex encoded string of the binary entry.
func (e *Entry) Hex() string {
	return hex.EncodeToString(e.MarshalBinary())
}

// MarshalBinary creates a single []byte from an entry for transport.
func (e *Entry) MarshalBinary() []byte {
	var buf bytes.Buffer

	buf.Write([]byte{byte(len(e.ChainID))})
	buf.Write(e.ChainID)

	count := len(e.ExtIDs)
	binary.Write(&buf, binary.BigEndian, uint8(count))
	for _, bytes := range e.ExtIDs {
		count = len(bytes)
		binary.Write(&buf, binary.BigEndian, uint32(count))
		buf.Write(bytes)
	}<commit_msg>minor changes to types.go<commit_after>package factom

import (
	"bytes"
	"crypto/sha256"
	"encoding/base64"
	"encoding/binary"
	"encoding/hex"
	"encoding/json"
	"time"
)

type jsonentry struct {
	ChainID string
	ExtIDs  []string
	Data    string
}

// Objects implimenting the FactomWriter interface may be used in the Submit
// call to create and add an entry to the factom network.
type FactomWriter interface {
	CreateFactomEntry() *Entry
}

// Objects implimenting the FactomChainer interface may be used in the
// CreateChain call to create a chain and first entry on the factom network.
type FactomChainer interface {
	CreateFactomChain() *Chain
}

// A factom entry that can be submitted to the factom network.
type Entry struct {
	TimeStamp int64
	ChainID   []byte
	ExtIDs    [][]byte
	Data      []byte
}

// CreateFactomEntry allows an Entry to satisfy the FactomWriter interface.
func (e *Entry) CreateFactomEntry() *Entry {
	return e
}

// Hash returns a hex encoded sha256 hash of the entry.
func (e *Entry) Hash() string {
	s := sha256.New()
	s.Write(e.MarshalBinary())
	return hex.EncodeToString(s.Sum(nil))
}

// Hex return the hex encoded string of the binary entry.
func (e *Entry) Hex() string {
	return hex.EncodeToString(e.MarshalBinary())
}

// MarshalBinary creates a single []byte from an entry for transport.
func (e *Entry) MarshalBinary() []byte {
	var buf bytes.Buffer

	buf.Write([]byte{byte(len(e.ChainID))})
	buf.Write(e.ChainID)

	count := len(e.ExtIDs)
	binary.Write(&buf, binary.BigEndian, uint8(count))
	for _, bytes := range e.ExtIDs {
		count = len(bytes)
		binary.Write(&buf, binary.BigEndian, uint32(count))
		buf.Write(bytes)
	}
{'fraction_non_alphanumeric': 0.10870219813309244, 'fraction_numerical': 0.009635651912074676, 'mean_word_length': 4.08728943338438, 'pattern_counts': {'":': 0, '<': 3, '<?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': '430694', 'n_tokens_mistral': 1123, 'n_tokens_neox': 1074, 'n_words': 371}