Help us shape the future of Go! Take the 2026 Go Developer Survey

ecoji

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2018 License: Apache-2.0 Imports: 2 Imported by: 2

README ยถ

Ecoji ๐Ÿฃ๐Ÿ”‰๐Ÿฆ๐Ÿ”ผ

Ecoji encodes data as emojis. As a bonus, includes code to decode emojis to original data.

Examples of running

Encode example :

$ echo "Base64 is so 1999, isn't there something better?" | ecoji
๐Ÿ—๐Ÿ“ฉ๐ŸŽฆ๐Ÿ‡๐ŸŽ›๐Ÿ“˜๐Ÿ”ฏ๐Ÿšœ๐Ÿ’ž๐Ÿ˜ฝ๐Ÿ†–๐ŸŠ๐ŸŽฑ๐Ÿฅ๐Ÿš„๐ŸŒฑ๐Ÿ’ž๐Ÿ˜ญ๐Ÿ’ฎ๐Ÿ‡ต๐Ÿ’ข๐Ÿ•ฅ๐Ÿญ๐Ÿ”ธ๐Ÿ‰๐Ÿšฒ๐Ÿฆ‘๐Ÿถ๐Ÿ’ข๐Ÿ•ฅ๐Ÿ”ฎ๐Ÿ”บ๐Ÿ‰๐Ÿ“ธ๐Ÿฎ๐ŸŒผ๐Ÿ‘ฆ๐ŸšŸ๐Ÿฅด๐Ÿ“‘

Decode example :

$ echo ๐Ÿ—๐Ÿ“ฉ๐ŸŽฆ๐Ÿ‡๐ŸŽ›๐Ÿ“˜๐Ÿ”ฏ๐Ÿšœ๐Ÿ’ž๐Ÿ˜ฝ๐Ÿ†–๐ŸŠ๐ŸŽฑ๐Ÿฅ๐Ÿš„๐ŸŒฑ๐Ÿ’ž๐Ÿ˜ญ๐Ÿ’ฎ๐Ÿ‡ต๐Ÿ’ข๐Ÿ•ฅ๐Ÿญ๐Ÿ”ธ๐Ÿ‰๐Ÿšฒ๐Ÿฆ‘๐Ÿถ๐Ÿ’ข๐Ÿ•ฅ๐Ÿ”ฎ๐Ÿ”บ๐Ÿ‰๐Ÿ“ธ๐Ÿฎ๐ŸŒผ๐Ÿ‘ฆ๐ŸšŸ๐Ÿฅด๐Ÿ“‘ | ecoji -d
Base64 is so 1999, isn't there something better?

Concatenation :

$ echo -n abc | ecoji
๐Ÿ‘–๐Ÿ“ธ๐ŸŽˆโ˜•
$ echo -n 6789 | ecoji
๐ŸŽฅ๐Ÿค ๐Ÿ“ ๐Ÿ
$ echo XY | ecoji
๐Ÿฒ๐Ÿ‘ก๐Ÿ•Ÿโ˜•
$ echo ๐Ÿ‘–๐Ÿ“ธ๐ŸŽˆโ˜•๐ŸŽฅ๐Ÿค ๐Ÿ“ ๐Ÿ๐Ÿฒ๐Ÿ‘ก๐Ÿ•Ÿโ˜• | ecoji -d
abc6789XY

Make your hashes more interesting.

$ cat encode.go  | openssl dgst -binary -sha1 | ecoji
๐ŸŒฐ๐Ÿ๐Ÿก๐ŸšŸ๐Ÿ”ถ๐Ÿฆ…๐Ÿ˜ก๐Ÿ˜บ๐Ÿš†๐Ÿ‘๐Ÿ•ก๐Ÿฆž๐Ÿ“๐Ÿ–Š๐Ÿ™€๐Ÿฆ‰
$ echo ๐ŸŒฐ๐Ÿ๐Ÿก๐ŸšŸ๐Ÿ”ถ๐Ÿฆ…๐Ÿ˜ก๐Ÿ˜บ๐Ÿš†๐Ÿ‘๐Ÿ•ก๐Ÿฆž๐Ÿ“๐Ÿ–Š๐Ÿ™€๐Ÿฆ‰ | ecoji -d | openssl base64
GhAkTyOY/Pta78KImgvofylL19M=
$ cat encode.go  | openssl dgst -binary -sha1 | openssl base64
GhAkTyOY/Pta78KImgvofylL19M=

Data encoded with Ecoji sorts the same as the input data.

$ echo -n a | ecoji > /tmp/stest.ecoji
$ echo -n ab | ecoji >> /tmp/test.ecoji
$ echo -n abc | ecoji >> /tmp/test.ecoji
$ echo -n abcd | ecoji >> /tmp/test.ecoji
$ echo -n ac | ecoji >> /tmp/test.ecoji
$ echo -n b | ecoji >> /tmp/test.ecoji
$ echo -n ba | ecoji >> /tmp/test.ecoji
$ export LC_ALL=C
$ sort /tmp/test.ecoji > /tmp/test-sorted.ecoji
$ diff /tmp/test.ecoji /tmp/test-sorted.ecoji
$ cat /tmp/test-sorted.ecoji
๐Ÿ‘–๐Ÿ“ฒโ˜•โ˜•
๐Ÿ‘–๐Ÿ“ธ๐ŸŽˆโ˜•
๐Ÿ‘–๐Ÿ“ธ๐ŸŽฆโšœ
๐Ÿ‘–๐Ÿ”ƒโ˜•โ˜•
๐Ÿ‘™โ˜•โ˜•โ˜•
๐Ÿ‘š๐Ÿ“ขโ˜•โ˜•

Usage :

$ ecoji -h
usage: ecoji [OPTIONS]... [FILE]

Encode or decode data as Unicode emojis. ๐Ÿ˜

Options:
    -d, --decode          decode data
    -w, --wrap=COLS       wrap encoded lines after COLS character (default 76).
                          Use 0 to disable line wrapping
    -h, --help            Print this message
    -v, --version         Print version information.

Libraries

Libraries implementing the Ecoji encoding standard. Submit PR to add a library to the table.

Language Comments
Go This repository offers a Go library package with two functions ecoji.Encode() and ecoji.Decode().
Java Coming soon, I plan to implement this and publish to maven central unless someone else does.

Build instructions.

This is my first Go project, I am starting to get my bearings. If you are new to Go I would recommend this video and the tour.

# The following are general Go setup instructions.  Ignore if you know Go, I am new to it.
export GOPATH=~/go
export PATH=$GOPATH/bin:$PATH

# This will download Ecoji to $GOPATH/src
go get github.com/keith-turner/ecoji

# This will build the ecoji command and put it in $GOPATH/bin
go install github.com/keith-turner/ecoji/cmd/ecoji

Documentation ยถ

Index ยถ

Constants ยถ

This section is empty.

Variables ยถ

This section is empty.

Functions ยถ

func Decode ยถ

func Decode(r RuneReader, w io.Writer) (err error)

Reads unicode emojis, map each emoji to a 10 bit integer, writes 10 bit intergers

func Encode ยถ

func Encode(r io.Reader, w RuneWriter, wrap uint) (err error)

Maps every 10 bits from the reader to one of 1024 Unicode emojis, writing the emojis.

Types ยถ

type RuneReader ยถ

type RuneReader interface {
	ReadRune() (rune, int, error)
}

type RuneWriter ยถ

type RuneWriter interface {
	WriteByte(byte) error
	WriteRune(rune) (int, error)
}

Directories ยถ

Path Synopsis
cmd module
ecoji command

Jump to

Keyboard shortcuts

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