gohasha

package module
v0.0.0-...-33edbfd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2015 License: MIT Imports: 11 Imported by: 0

README

gohasha Build Status

Inspired by hasha

Install

go get github.com/saromanov/gohasha

Usage

import
(
	"gohasha"
	"fmt"
)

func main() {
	hashstr, _ := gohasha.GoHasha(&gohasha.GohashaOptions{Data: "Value"})
	fmt.Println(hashstr) //returns hash for Value
}

or read from file

result, _ := gohasha.GoHasha(&gohasha.GohashaOptions{Filepath: "testfile", Algorithm: "crc64"})
fmt.Println(result) //returns hash for data from testfile with crc64

API

gohasha.GohashaOptions
  • Data - data for hashing
  • Filepath - path to file for hashing
  • BufferReader - Buffer reader for hashing
  • Object - any object for hashing
  • Algorithm - md5, crc32 or adler32
  • HashingFunc - your hashing function Example:
hashstr, _ := gohasha.GoHasha(&gohasha.GohashaOptions{Data: "Value",
HashingFunc: function(str string)string{
    //Just as example
	return str
}})
gohasha.GoHasha(opt GohashaOptions)

Return hashed data

Licence

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GoHasha

func GoHasha(opt *GohashaOptions) (string, error)

GoHasha return hash in string from string data or file

Types

type GohashaOptions

type GohashaOptions struct {
	//path to file for hashing
	Filepath string
	//Data from hashing
	Data string
	//Reader buffer
	BufferReader io.Reader
	//Any data
	Object interface{}
	//Get data from webpage
	Webpage string

	//Now, algorithms can be md5 or crc32
	Algorithm string

	//Your hashing function
	HashingFunc func(string) string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL