<commit_before>package main

import (
	"code.google.com/p/go.crypto/bcrypt"
)

func GenerateHash(password string) []byte {
	hex := []byte(password)
	hashedPassword, err := bcrypt.GenerateFromPassword(hex, 10)
	if err != nil {
		panic(err)
	}
	return hashedPassword
}

func CompareHash(digest []byte, password string) bool {
	hex := []byte(password)
	if err := bcrypt.CompareHashAndPassword(digest, hex); err == nil {
		return true
	}
	return false
}<commit_msg>doc: add documentation to crypto<commit_after>package main

import (
	"code.google.com/p/go.crypto/bcrypt"
)

// Generates bcrypt hash from plaintext password
func GenerateHash(password string) []byte {
	hex := []byte(password)
	hashedPassword, err := bcrypt.GenerateFromPassword(hex, 10)
	if err != nil {
		panic(err)
	}
	return hashedPassword
}

// Compares bcrypt password with a plaintext one. Returns true if passwords match
// and false if they do not.
func CompareHash(digest []byte, password string) bool {
	hex := []byte(password)
	if err := bcrypt.CompareHashAndPassword(digest, hex); err == nil {
		return true
	}
	return false
}
{'fraction_non_alphanumeric': 0.12079927338782924, 'fraction_numerical': 0.0036330608537693005, 'mean_word_length': 4.622448979591836, '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': '3035475', 'n_tokens_mistral': 371, 'n_tokens_neox': 354, 'n_words': 104}