Skip to content

Resaec/go-md5mac

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

go-md5mac

go-md5mac is an implementation of the MD5-MAC algorithm.

The code was reimplemented after the Crypto++ Project and Code-Reading-Book repositories.

No tests other than my use case for this module has been conducted. Correctness of code and function is currently not to be expected and is not express or implied.

Example usage

var (
    key     = bytes.Repeat([]uint8{0x41}, 16)
    message = bytes.Repeat([]uint8{0x42}, 32)
	
    digest  = make([]uint8, 16)
    outBuf = make([]uint8, 20)
	
    bufferSize = len(outBuf)
)

// create md5mac instance
mac, err := md5mac.NewMD5MACWithKey(key)
if err != nil {
    return err
}

// update the digest
mac.Update(message)

// finalize into digest
mac.Finalize(digest)

// write digest in outbuf
for i := 0; i < bufferSize; i += md5mac.MACLENGTH {
    copy(outBuf[i:], digest[:])
}

About

A Go implementation of the MD5-MAC algorithm

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages