Skip to content

qianbin/drlp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

drlp

Build Status GoDoc Go Report

Short for Direct-RLP: A fast in-place RLP encoder

Installation

It requires Go 1.19 or newer.

go get github.com/qianbin/drlp

Usage

Number and string

var buf []byte
buf = drlp.AppendUint(buf, 10)
buf = drlp.AppendString(buf, []byte("hello drlp"))

fmt.Printf("%x\n", buf)
// Output: 0a8a68656c6c6f2064726c70

List

var buf []byte
buf = drlp.AppendString(buf, []byte("followed by a list"))

offset := len(buf)
buf = drlp.AppendString(buf, []byte("list content"))
buf = drlp.EndList(buf, offset)

fmt.Printf("%x\n", buf[offset:])
// Output: cd8c6c69737420636f6e74656e74

License

The MIT License

About

Short for Direct-RLP: A fast in-place RLP encoder

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages