Back to godoc.org

Package bsdsum

v0.0.0-...-8956429
Latest Go to latest

The latest major version is .

Published: Nov 25, 2013 | License: MIT | Module: github.com/cxmcc/unixsums

Overview

Package bsdsum implements the BSD checksum algorithm BSD checksum is also known as UNIX sum

Index

Examples

Constants

const Size = 2

The size of a BSD checksum value

func Bsdsum

func Bsdsum(data []byte) uint16

Bsdsum returns the BSD checksum of the given byte array

Example

Code:

data := []byte("Go is expressive, concise, clean, and efficient.")
fmt.Printf("sum: %d", Bsdsum(data))
sum: 8092

func New

func New() unixsums.Hash16

New returns a new hash.Hash computing the BSD checksum value

Example

Code:

c := New()
io.WriteString(c, "Go is an open source programming environment.")
fmt.Printf("sum: %d", c.Sum16())
sum: 16973
Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier