Skip to content

Simple version of COBS (Consistent Overhead Byte Stuffing)

License

Notifications You must be signed in to change notification settings

mrVanboy/go-simple-cobs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Simple COBS (Consistent Overhead Byte Stuffing) ʷᶦᵏᶦ

Simple library for encoding and decoding byte slices with COBS algorithm.

Example of usage:

package main

import (
	"encoding/hex"
	"fmt"
	"os"

	"github.com/mrVanboy/go-simple-cobs"
)

func main() {
	data := []byte{0x01, 0x02}
	fmt.Println("Source data:")
	fmt.Println(hex.Dump(data))

	encoded, err := cobs.Encode(data)
	if err != nil {
		fmt.Printf("Error occured %s \n", err)
		os.Exit(-1)
	}
	fmt.Println("Encoded data:")
	fmt.Println(hex.Dump(encoded))

	decoded, err := cobs.Decode(encoded)
	if err != nil {
		fmt.Printf("Error occured %s \n", err)
		os.Exit(-1)
	}
	fmt.Println("Decoded data:")
	fmt.Println(hex.Dump(decoded))
}

About

Simple version of COBS (Consistent Overhead Byte Stuffing)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages