Skip to content

Commit 28a963d

Browse files
Update README.md
Added instructions for making the CLI read from `stdin`
1 parent 197558d commit 28a963d

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,26 @@ Append `--algorithm=chachapoly` at the end to use the [ChaCha20-Poly1305](https:
110110

111111
`pwcrypt d "EwAAAAQAAAAAAAQAAgAAAFYjNGlNEnNMn5VtyW5hvxnKhdk9i" "Decryption Password 123 !!!"`
112112

113+
---
114+
115+
#### stdin / stdout / pipes
116+
117+
Since [v4.3.0](https://github.com/GlitchedPolygons/pwcrypt/releases/tag/4.3.0) it is now possible to make the pwcrypt CLI read the input from `stdin`.
118+
119+
To do so, just pass `-` as the input parameter after the `e` or `d` argument. The `--file=/output/file/path/here` still works (and if it's not set, the output will be written to `stdout`).
120+
121+
For example, to compress and encrypt a whole directory you could pipe the result of `tar` into `pwcrypt`. Such a command would look like this:
122+
123+
`tar -czf - -C /my/directory/to/compress/and/encrypt . | pwcrypt e - "SuperSafeEncryptionPassword123" --file=result.tar.gz.pwcrypt --compression=0`
124+
125+
The same thing can also be done using the `>` redirection (if you don't wanna type out the `--file=` argument).
126+
127+
`tar -czf - -C /my/directory/to/compress/and/encrypt . | pwcrypt e - "SuperSafeEncryptionPassword123" --compression=0 > result.tar.gz.pwcrypt`
128+
129+
To decrypt the above example encrypted archive one would use the following command:
130+
131+
`cat result.tar.gz.pwcrypt | pwcrypt d - "SuperSafeEncryptionPassword123" | tar -xzf -`
132+
113133
### Files instead of strings
114134

115135
The pwcrypt CLI supports encrypting/decrypting files instead of strings too: <p>

0 commit comments

Comments
 (0)