<commit_before>securetoken
===========

Package securetoken implements cryptographically secure tokens that provide data confidentiality and integrity.

A useful application is to use securetoken to issue session cookies.

Installation
============

	go get -u github.com/nicksnyder/go-securetoken/securetoken

Example
=======

Short snippet:
	
	package main

	import (
		"crypto/aes"
		"crypto/sha1"
		"fmt"

		"github.com/nicksnyder/go-securetoken/securetoken"
	)

	func main() {
		key := []byte("1234567887654321")
		transcoder, err := securetoken.NewTranscoder(key, 24*time.Hour, sha1.New, aes.NewCipher)
		if err != nil {
			panic(err)
		}

		token, err := transcoder.Encode([]byte("secretuserid"))
		if err != nil {
			panic(err)
		}

		data, err := transcoder.Decode(token)
		if err != nil {
			panic(err)
		}

		fmt.Printf("data: %s", data)
	}

Complete example:
	cd example/
	go run main.go
<commit_msg>fix formatting<commit_after>securetoken
===========

Package securetoken implements cryptographically secure tokens that provide data confidentiality and integrity.

A useful application is to use securetoken to issue session cookies.

Installation
============

	go get -u github.com/nicksnyder/go-securetoken/securetoken

Example
=======

Short snippet:
	
	package main

	import (
		"crypto/aes"
		"crypto/sha1"
		"fmt"

		"github.com/nicksnyder/go-securetoken/securetoken"
	)

	func main() {
		key := []byte("1234567887654321")
		transcoder, err := securetoken.NewTranscoder(key, 24*time.Hour, sha1.New, aes.NewCipher)
		if err != nil {
			panic(err)
		}

		token, err := transcoder.Encode([]byte("secretuserid"))
		if err != nil {
			panic(err)
		}

		data, err := transcoder.Decode(token)
		if err != nil {
			panic(err)
		}

		fmt.Printf("data: %s", data)
	}

Complete example:

	cd example/
	go run main.go

{'fraction_non_alphanumeric': 0.14348302300109528, 'fraction_numerical': 0.02190580503833516, 'mean_word_length': 3.951219512195122, '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': '1232484', 'n_tokens_mistral': 706, 'n_tokens_neox': 601, 'n_words': 155}