Coder Social home page Coder Social logo

gohash's Introduction

About

GoDoc

Command line tools and library to work with hashes and various encodings.

Compatibility: All platforms supported by go, notably Linux, macOS and Windows.

Commands

coder encode / decode pipes or files between various encodings

hasher calculate hashes from stdin or files

findhash search for plaintext matching known hashes

Install everything

See Releases for binary packages for macOS and Windows. To compile from source with the go toolchain:

go get -u github.com/martinlindhe/gohash/...

Library example

import "github.com/martinlindhe/gohash"

func ExampleNewCalculator() {
	r := strings.NewReader("hello world")
	calc := NewCalculator(r)
	h, _ := calc.Sum("sha1")
	fmt.Printf("%x", h)
	// Output: 2aae6c35c94fcfb415dbe95f408b9ce91ee846ed
}

Hash algorithms

Set algo with hasher <id>, list all supported hashes with hasher --list-hashes

id Algorithm key size key size year
adler32 Adler-32 32 bit 4 byte 1995
blake224 BLAKE-224 224 bit 28 byte 2008
blake256 BLAKE-256 256 bit 32 byte 2008
blake384 BLAKE-384 384 bit 48 byte 2008
blake512 BLAKE-512 512 bit 64 byte 2008
blake2b-512 BLAKE2b-512 512 bit 64 byte 2012
blake2s-256 BLAKE2s-256 256 bit 32 byte 2012
blake3 BLAKE3 256 bit 32 byte 2020
crc8-atm Crc-8 (ATM) 8 bit 1 byte ?
crc16-ccitt Crc-16 (CCITT) 16 bit 2 byte ?
crc16-ccitt-false Crc-16 (CCITT-False) 16 bit 2 byte ?
crc16-ibm Crc-16 (IBM) 16 bit 2 byte ?
crc16-scsi Crc-16 (SCSI) 16 bit 2 byte ?
crc24-openpgp Crc-24 (OpenPGP) 24 bit 3 byte ?
crc32-ieee Crc-32 (IEEE) 32 bit 4 byte ?
crc32-castagnoli Crc-32 (Castagnoli) 32 bit 4 byte ?
crc32-koopman Crc-32 (Koopman) 32 bit 4 byte ?
crc64-iso Crc-64 (ISO) 64 bit 8 byte ?
crc64-ecma Crc-64 (ECMA) 64 bit 8 byte ?
fnv1-32 FNV-1-32 32 bit 4 byte 1991
fnv1a-32 FNV-1a-32 32 bit 4 byte 1991
fnv1-64 FNV-1-64 64 bit 8 byte 1991
fnv1a-64 FNV-1a-64 64 bit 8 byte 1991
gost94 GOST R 34.11-94 256 bit 32 byte 1994
gost94-cryptopro GOST R 34.11-94 CryptoPro 256 bit 32 byte 2006
md2 MD2 128 bit 16 byte 1989
md4 MD4 128 bit 16 byte 1990
md5 MD5 128 bit 16 byte 1992
ripemd160 RIPEMD-160 160 bit 20 byte 1996
sha1 SHA1 160 bit 20 byte 1995
sha224 SHA2-224 224 bit 28 byte 2001
sha256 SHA2-256 256 bit 32 byte 2001
sha384 SHA2-384 384 bit 48 byte 2001
sha512 SHA2-512 512 bit 64 byte 2001
sha512-224 SHA2-512/224 224 bit 28 byte 2001
sha512-256 SHA2-512/256 256 bit 32 byte 2001
sha3-224 SHA3-224 224 bit 28 byte 2015
sha3-256 SHA3-256 256 bit 32 byte 2015
sha3-384 SHA3-384 384 bit 48 byte 2015
sha3-512 SHA3-512 512 bit 64 byte 2015
shake128-256 SHA3-SHAKE128 256 bit 32 byte 2015
shake256-512 SHA3-SHAKE256 512 bit 64 byte 2015
siphash-2-4 SipHash-2-4 64 bit 8 byte 2012
skein512-256 Skein-512-256 256 bit 32 byte 2008?
skein512-512 Skein-512-512 512 bit 64 byte 2008?
streebog-256 GOST R 34.11-2012-256 256 bit 32 byte 2012
streebog-512 GOST R 34.11-2012-512 512 bit 64 byte 2012
tiger192 Tiger 192 bit 24 byte 1996
whirlpool Whirlpool 512 bit 64 byte 2000
xxh64 xxHash 64 64 bit 4 byte 2012

Binary-to-text encodings

Set algo with hasher --encoding=<id>, list all supported encodings with hasher --list-encodings

id Algorithm
ascii85 Ascii-85
base32 Base-32
base36 Base-36
base58 Base-58
base64 Base-64
base91 Base-91
bubblebabble Bubble Babble
binary Binary "1010"
decimal Decimal "13 0 99"
hex Hex "3f997a"
hexup Hex "3F997A"
octal Octal "0129 0226 0120"
uu Uuencoded "%:&5L;&"
z85 Z85

License

Under MIT

gohash's People

Contributors

martinlindhe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gohash's Issues

[FIXED] Windows binary

Dear Mr. Lindhe,
Could you be so kind to generate .exe for the rest of us who are mere Windows users w/o compiler?

BSD style output

Hi
please add option for md5 BSD style output like
MD5 (coder.txt) = 5d094cbb586f46817b1408a6c64a5ed3
Thanks

Parameter to disable color

Using Win64 build of v0.2.9 and calling it with my input file like "hasher streebog-256 -e hex --skip-filename", the output is like "โ†[1;33m620b45f87afe5ddb17ca95b91e117aa0d4eefd7ee18e74ce90178412538cb7d3โ†[0m", which is correct, but also includes escape sequences at the beginning and the end, which don't do any good in standard cmd.exe or when saved to a text file. Could you add a command line option to output only the hash itself, like "620b45f87afe5ddb17ca95b91e117aa0d4eefd7ee18e74ce90178412538cb7d3", list this option in --help, and maybe make it default on Windows?

coder -d z85 not decoding anything

I don't know if this is the correct repository, so let me know if I should also open an issue @ tilinna/z85.

z85 data encoded with coder z85 from piped input will not decode, under any circumstances, regardless of what string is passed.

Simple test case:

echo "This" | coder z85 | coder -d z85

Will give:

2019/05/09 14:24:41 error:z85: wrongly aligned input data

As will any input, as stated above. This is referring only to decoding, because encoding I guess works as intended(?).

To be sure, the output of:

echo "This" | coder z85

Is consistently:

ra]#!3ig5a

macOS 10.14.4, installed with go get.

GOST checksum

Very strange for README.md from gohash/cmd/hasher/README.md
hasher -i README.md gost
6ebdd006a02cee408ab52c60408ad1b3c7fd5dfe9cfd8c2bd15bf1fb6d2a5c49
checksum calculated rhash
rhash -G README.md
495c2a6dfbf15bd12b8cfd9cfe5dfdc7b3d18a40602cb58a40ee2ca006d0bd6e
rhash --gost-cryptopro README.md
46c0885304def7fbce6484e0148950cd589ab20e447562e8f67de73686b2a61c
rhash --gost-cryptopro --gost-reverse README.md
1ca6b28636e77df6e86275440eb29a58cd508914e08464cefbf7de045388c046
Why checksums from hasher and rhash different?

[PENDING] Coder fails to deliver sometimes

Dear @martinlindhe,
a few encoding schemes (base36/58, binary, decimal, octal) produce no output as follows

ffmpeg -loglevel error -f lavfi -i "anoisesrc=d=60:c=white:r=48000" -f s16le -c:a pcm_s16le - | coder base36
ffmpeg -loglevel error -f lavfi -i "anoisesrc=d=60:c=white:r=48000" -f s16le -c:a pcm_s16le - | coder base58
ffmpeg -loglevel error -f lavfi -i "anoisesrc=d=60:c=white:r=48000" -f s16le -c:a pcm_s16le - | coder binary
ffmpeg -loglevel error -f lavfi -i "anoisesrc=d=60:c=white:r=48000" -f s16le -c:a pcm_s16le - | coder decimal
ffmpeg -loglevel error -f lavfi -i "anoisesrc=d=60:c=white:r=48000" -f s16le -c:a pcm_s16le - | coder octal

Other encoding schemes work fine and instantly in this scenario.
Could you be so kind to troubleshoot?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.