Documentation ¶
Index ¶
Constants ¶
const HashStringSize = ShaSize * 2
HashStringSize is the maximum length of a ShaHash hash string.
const RipeHashStringSize = RipeSize * 2
RipeHashStringSize is the maximum length of a Ripe hash string.
const RipeSize = 20
RipeSize is the size of array used to store ripe hashes.
const ShaSize = 32
ShaSize is the size of the array used to store SHA hashes.
Variables ¶
var ErrHashStrSize = fmt.Errorf("string length must be %v chars", HashStringSize)
ErrHashStrSize describes an error that indicates the caller specified a hash string that does not have the right number of characters.
var ErrRipeHashStrSize = fmt.Errorf("string length must be %v chars", RipeHashStringSize)
ErrRipeHashStrSize describes an error that indicates the caller specified a hash string that does not have the right number of characters.
Functions ¶
func DoubleSha512 ¶
DoubleSha512 returns the sha512^2 of the bytes
Types ¶
type Ripe ¶
Ripe is used in several of the bitmessage messages and common structures. It typically represents the double sha512 of ripemd160 of data.
func NewRipe ¶
NewRipe returns a new Ripe from a byte slice. An error is returned if the number of bytes passed in is not RipeSize.
func NewRipeFromStr ¶
NewRipeFromStr creates a Ripe from a hash string. The string should be the hexadecimal string of a byte hash.
type Sha ¶
Sha is used in several of the bitmessage messages and common structures. It typically represents a half of the double SHA512 of data.
func InventoryHash ¶
InventoryHash takes double sha512 of the bytes and returns the first half. It calculates inventory hash of the object as required by the protocol.
func NewSha ¶
NewSha returns a new ShaHash from a byte slice. An error is returned if the number of bytes passed in is not ShaHash.
func NewShaFromStr ¶
NewShaFromStr creates a ShaHash from a hash string. The string should be the hexadecimal string of a hash.