md4

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2022 License: BSD-3-Clause Imports: 3 Imported by: 6

README

md4

Go Reference

MD4 hash algorithm in Go. Assembly-optimized for amd64 platforms.

MD4 is cryptographically broken and should should only be used where compatibility with legacy systems, not security, is the goal.

Thanks

This package is based up the MD4 implementation in x/crypto together with some internals borrowed from crypto/md5, which is structurally very similar. For assembly micro-optimization it was very helpful to consult the implementations of MD5 in Go and OpenSSL, Marc Bevand's assembly MD5, and Nayuki's optimized MD4/MD5. Ricardo Branco's OpenSSL bindings were very helpful for differential testing and providing a performance baseline. Lastly, thanks to Michael Stapelberg for providing the motivation for this package, to optimize his rsync daemon.

License

md4 is available under the BSD 3-Clause License. The license retains the copyright notice from x/crypto.

Documentation

Overview

Package md4 implements the MD4 hash algorithm as defined in RFC 1320.

MD4 is cryptographically broken and should should only be used where compatibility with legacy systems, not security, is the goal. Instead, use a secure hash like SHA-256 (from crypto/sha256).

Index

Examples

Constants

View Source
const BlockSize = 64

BlockSize is the block size of MD4 in bytes.

View Source
const Size = 16

Size of an MD4 checksum in bytes.

Variables

This section is empty.

Functions

func New

func New() hash.Hash

New returns a new hash.Hash computing the MD4 checksum.

Example
package main

import (
	"fmt"

	"github.com/mmcloughlin/md4"
)

func main() {
	h := md4.New()
	data := "These pretzels are making me thirsty."
	h.Write([]byte(data))
	fmt.Printf("%x", h.Sum(nil))
}
Output:

48c4e365090b30a32f084c4888deceaa

func Sum

func Sum(data []byte) [Size]byte

Sum returns the MD4 checksum of the data.

Types

This section is empty.

Directories

Path Synopsis
asm module

Jump to

Keyboard shortcuts

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