Package md2 implements the MD2 cryptographic hash algorithm as per IETF RFC-1319, for the Go programming-language.
Find a file
2025-09-03 05:58:09 -07:00
blocksize.go md2.BlockSize 2025-07-19 10:55:55 -07:00
errors.go errors 2025-07-19 12:30:45 -07:00
go.mod codeberg 2025-09-03 05:58:09 -07:00
go.sum errors 2025-07-19 12:30:45 -07:00
hasher.go hasher 2025-07-19 13:54:50 -07:00
LICENSE initial commits 2025-07-19 10:54:28 -07:00
new.go md2.New() 2025-07-19 13:55:39 -07:00
new_example_test.go codeberg 2025-09-03 05:58:09 -07:00
nothing.go nothing 2025-07-19 11:13:26 -07:00
README.md codeberg 2025-09-03 05:58:09 -07:00
sbox.go sbox 2025-07-19 11:25:07 -07:00
size.go md2.Size 2025-07-19 10:55:35 -07:00
sum.go md2.Sum() 2025-07-19 13:56:10 -07:00
sum_example_test.go codeberg 2025-09-03 05:58:09 -07:00
sum_test.go codeberg 2025-09-03 05:58:09 -07:00

go-md2

Package md2 implements the MD2 cryptographic hash algorithm as per IETF RFC-1319, for the Go programming language.

Note that MD2 is no longer considered secure. However, it may still be useful for some non-secure (and historical) use-cases.

Documention

Online documentation, which includes examples, can be found at: http://godoc.org/codeberg.org/reiver/go-md2

GoDoc

Examples

Here is a simple example of calculating the MD2 digest of data contained in a []byte:

import "codeberg.org/reiver/go-md2"

// ...

var data []byte = []byte("Hello world!")

digest := md2.Sum(data)

Here is a more complex example of putting data into the an MD2 hasher in multiple pieces.

import "codeberg.org/reiver/go-md2"

// ...

hasher := md2.New()

// This is equivalent to writing:
//
//	[]byte("once+twice-thrice_fource")
hasher.Write([]byte("once"))
hasher.Write([]byte("+"))
hasher.Write([]byte("twice"))
hasher.Write([]byte("-"))
hasher.Write([]byte("thrice"))
hasher.Write([]byte("_"))
hasher.Write([]byte("fource"))

digest := hasher.Sum(nil)

Import

To import package md2 use import code like the following:

import "codeberg.org/reiver/go-md2"

Installation

To install package md2 do the following:

GOPROXY=direct go get codeberg.org/reiver/go-md2

Author

Package md2 was written by Charles Iliya Krempeaux