epic-crypt-gpg

来自「EPIC IRC客户端。来源于IRCII客户端但做了很多性能和功能的优化。」· 代码 · 共 33 行

TXT
33
字号
#!/bin/bash## This is a simplistic encryption demonstrating the principles# of the protocol, while being quite usable.## the first input line contains words, the first of which is the key,# and additional arguments, which aren't used right now, so they are# discarded.## When the end of the line is reached, the rest of the input is to be# read as binary input of the plaintext or cyphertext in _binary_ mode.# What this means for plaintext is that the newline terminator won't# be present.function encrypt {	( echo "$KEY" ; cat ) | gpg -c -z 9 --batch --passphrase-fd 0}function decrypt {	( echo "$KEY" ; cat ) | gpg --batch --passphrase-fd 0}proto="$1"shift 1read KEY TRASHcase "$proto" inencrypt) encrypt "$@" ;;decrypt) decrypt "$@" ;;*)	echo `basename $0` "{encrypt|decrypt} < text" 1>&2 ;;esac

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?