lyra2rev2

package module
v0.0.0-...-39b5074 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2018 License: BSD-3-Clause Imports: 4 Imported by: 0

README

Build Status GoDoc GitHub license

lyra2rev2 with bmw,cubuhash, and lyra2

Overview

This is Lyra2REv2 library used in Monacoin and some other altcoins. Lyra2Rev2 uses bmw hash, cubehash,lyra2, which are also included in this library.

Requirements

This requires

  • git
  • go 1.3+

Installation

 $ go get github.com/rb-de0/lyra2rev2

Example

(This example omits error handlings for simplicity.)


import "github.com/rb-de0/lyra2rev2"

func main(){
    data := []byte{0x01,0x02}
	result, err := lyra2rev2.Sum(data)
...
}

Contribution

Improvements to the codebase and pull requests are encouraged.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bmw256

func Bmw256(input []byte) []byte

bmw256 calculates and returns bmw256 of input. length of input must be 32 bytes.

func Cubehash256

func Cubehash256(data []byte) []byte

cubehash56 calculates cubuhash256. length of data must be 32 bytes.

func Lyra2

func Lyra2(k []byte, pwd []byte, salt []byte, timeCost uint64, nRows int, nCols int)

lyra2 Executes Lyra2 based on the G function from Blake2b. This version supports salts and passwords whose combined length is smaller than the size of the memory matrix, (i.e., (nRows x nCols x b) bits, where "b" is the underlying sponge's bitrate). In this implementation, the "basil" is composed by all integer parameters (treated as type "unsigned int") in the order they are provided, plus the value of nCols, (i.e., basil = kLen || pwdlen || saltlen || timeCost || nRows || nCols).

@param K The derived key to be output by the algorithm @param kLen Desired key length @param pwd User password @param pwdlen Password length @param salt Salt @param saltlen Salt length @param timeCost Parameter to determine the processing time (T) @param nRows Number or rows of the memory matrix (R) @param nCols Number of columns of the memory matrix (C)

@return 0 if the key is generated correctly; -1 if there is an error (usually due to lack of memory for allocation)

func Sum

func Sum(data []byte) ([]byte, error)

Sum returns the result of Lyra2re2 hash.

Types

type CubeHash

type CubeHash struct {
	// contains filtered or unexported fields
}

CubeHash is for cubehash.

func NewCubeHash

func NewCubeHash() *CubeHash

NewCubeHash initializes anrd retuns Cubuhash struct.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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