func createEncryptedFile(file string, salt, content []byte) (string, error) {
	extension := filepath.Ext(file)
	name := file[0 : len(file) - len(extension)]
	hexExt := hex.EncodeToString([]byte(extension))
	final := [][]byte{[]byte(hex.EncodeToString(content)), []byte(hex.EncodeToString(salt)), []byte(hexExt)}
	err := ioutil.WriteFile(name, bytes.Join(final, []byte("\n")), 0644)
	if err != nil {
		return "", err
	}
	return name, nil
}
creates the output encrypted file without extension
save encrypted data in hex
appends hex salt to output file
appends hex file ext to output file
package crypt
import (
	"bytes"
	"crypto/rand"
	"encoding/hex"
	"io/ioutil"
	"log"
	"path/filepath"
	"golang.org/x/crypto/nacl/secretbox"
	"golang.org/x/crypto/scrypt"
)
func random(size int) []byte {
	r := make([]byte, size)
	_, err := rand.Read(r)
	if err != nil {
		log.Fatal("error: ", err)
		return nil
	}
	return r
}
func readFile(path string) ([]byte, error) {
	data, err := ioutil.ReadFile(path)
	if err != nil {
		return nil, err
	}
	return data, nil
}