<commit_before>package neustar

import (
	"crypto/md5"
	"fmt"
	"strconv"
	"time"
)

// Configuration contains configuration.. duh
type Configuration struct {
	API struct {
		Key    string
		Secret string
	}
}

// Configuration contains configuration.. duh
/*
type Configuration struct {
	API struct {
		Key    string `json:"key"`
		Secret string `json:"secret"`
	} `json:"api"`
}
*/

// DigitalSignature creates an MD5 hash of the key, the secret and a timestamp
func (c *Configuration) DigitalSignature() string {
	now := time.Now()
	epoch := now.Unix()
	data := md5.Sum(
		[]byte(fmt.Sprintf("%s%s%s",
			c.API.Key, c.API.Secret, strconv.FormatInt(epoch, 10)),
		),
	)
	return fmt.Sprintf("%x", data)
}

// LoadConfig builds a config obj
func LoadConfig(key, secret string) *Configuration {
	return &Configuration{
		API: struct {
			Key:    key,
			secret: secret,
		}
	}
}

// LoadConfig builds a config obj
/*
func LoadConfig(cf string) (*Configuration, error) {
	confFile, err := os.Open(cf)
	if err != nil {
		return nil, err
	}
	decoder := json.NewDecoder(confFile)
	conf := &Configuration{}
	err = decoder.Decode(conf)
	if err != nil {
		return nil, err
	}<commit_msg>redo the config<commit_after>package neustar

import (
	"crypto/md5"
	"fmt"
	"strconv"
	"time"
)

// API holds the provided access keys
type API struct {
	Key    string
	Secret string
}

// Configuration contains configuration.. duh
type Configuration struct {
	API
}

// Configuration contains configuration.. duh
/*
type Configuration struct {
	API struct {
		Key    string `json:"key"`
		Secret string `json:"secret"`
	} `json:"api"`
}
*/

// DigitalSignature creates an MD5 hash of the key, the secret and a timestamp
func (c *Configuration) DigitalSignature() string {
	now := time.Now()
	epoch := now.Unix()
	data := md5.Sum(
		[]byte(fmt.Sprintf("%s%s%s",
			c.API.Key, c.API.Secret, strconv.FormatInt(epoch, 10)),
		),
	)
	return fmt.Sprintf("%x", data)
}

// LoadConfig builds a config obj
func LoadConfig(key, secret string) *Configuration {
	return &Configuration{
		API{
			Key:    key,
			Secret: secret,
		},
	}
}

// LoadConfig builds a config obj
/*
func LoadConfig(cf string) (*Configuration, error) {
	confFile, err := os.Open(cf)
	if err != nil {
		return nil, err
	}
	decoder := json.NewDecoder(confFile)
	conf := &Configuration{}
	err = decoder.Decode(conf)
	if err != nil {
		return nil, err
	}
{'fraction_non_alphanumeric': 0.13873798579189303, 'fraction_numerical': 0.004178854993731718, 'mean_word_length': 3.603846153846154, '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': '4752012', 'n_tokens_mistral': 843, 'n_tokens_neox': 807, 'n_words': 243}