hashpipe

hashpipe - 如果哈希值匹配,则进行管道处理。「hashpipe - pipe iff the hash matches」

hashpipe - pipe iff the hash matches

hashpipe helps you venture into the unknown. It reads from stdin, checks the hash of the content, and outputs it IF AND ONLY IF it matches the provided hash checksum. This makes executing things a teensy bit safer, as it requires compromising more communication channels.

Example

> echo "hello" | multihash
QmUJPTFZnR2CPGAzmfdYPghgrFtYFB6pf1BqMvqfiPDam8
> echo "hello" | hashpipe QmUJPTFZnR2CPGAzmfdYPghgrFtYFB6pf1BqMvqfiPDam8
hello
> echo "goodbye" | hashpipe QmUJPTFZnR2CPGAzmfdYPghgrFtYFB6pf1BqMvqfiPDam8
error: multihash checksums did not match

Use Case

If you tell people to pipe things directly into the shell... Don't do that. If you're going to, at least provide them a hash to ensure that man-in-the-middle attacks or compromised CDNs do not hurt your users.

curl http://you.shouldnt.be/doing/this | hashpipe Qmepk1VCHpjyCmWeh61vyDKsWfKymyrBQLcmUpXUdUd3yM | sh

Hashes Supported

hashpipe uses multihash, a self-describing hash function. It supports all the hashes in go-multihash:

Install

Usage

> hashpipe -h
usage: hashpipe [MULTIHASH] <[FILE] >[FILE]

    cat untrustedFile | hashpipe <expected-checksum> | trustedContext

hashpipe - boldly journey into the unknown.

It reads from stdin, checks the hash of the content, and outputs it IF AND
ONLY IF it matches the provided hash checksum. This makes executing things
a bit safer, as it requires compromising more communication channels. On
error, hashpipe returns a non-zero error code, failing pipelines.

OPTIONS
  -a="sha2-256": one of: sha1, sha2-256, sha2-512, sha3 (shorthand)
  -algorithm="sha2-256": one of: sha1, sha2-256, sha2-512, sha3
  -e="base58": one of: raw, hex, base58, base64 (shorthand)
  -encoding="base58": one of: raw, hex, base58, base64
  -l=-1: checksums length in bits (truncate). -1 is default (shorthand)
  -length=-1: checksums length in bits (truncate). -1 is default
  -q=false: quiet output (no newline on checksum, no error text) (shorthand)
  -quiet=false: quiet output (no newline on checksum, no error text)

主要指标

概览
名称与所有者jbenet/hashpipe
主编程语言Go
编程语言Go (语言数: 2)
平台
许可证MIT License
所有者活动
创建于2015-04-03 09:51:05
推送于2022-01-06 07:17:35
最后一次提交2015-04-05 03:18:20
发布数0
用户参与
星数406
关注者数19
派生数16
提交数9
已启用问题?
问题数5
打开的问题数3
拉请求数1
打开的拉请求数0
关闭的拉请求数0
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?