Enscryerypt: Encrypt and decrypt files with Scryer Prolog #1092
triska
started this conversation in
Show and tell
Replies: 1 comment 2 replies
-
Dear all, Scryer Prolog currently stores the interaction in Until then, please remove any such stored interaction from the log manually to preserve the secrecy of your passwords! (This only affects the Emacs frontend.) Thank you and all the best, |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all,
Enscryerypt allows us to encrypt and decrypt files with Scryer Prolog, using state-of-the-art cryptographic algorithms from
library(crypto)
:https://www.metalevel.at/enscryerypt/
There are two properties I find especially attractive:
First, the encrypted output is emitted as Prolog facts in ASCII, using at most 75 characters per line. Therefore, the encrypted output can be easily printed on paper, communicated in audio connections and Morse transmissions etc.
Second, the core encryption logic comprises less than 20 lines of Prolog code, written as a DCG nonterminal which I repeat here for inspection:
The nonterminal
string_lines//2
is used to break long strings into individual lines, using continuation escape sequences so that they are still valid Prolog text:If there is any cryptographic fault in the encryption mechanism of Enscryerypt, it must be in one of the snippets shown above or in the underlying cryptographic primitives.
I find it especially convenient to use Enscryerypt from within Emacs, using the Emacs definitions provided in
enscryerypt.el
. If you place this file in the same directory as the Prolog source file (enscryerypt.pl
) and evaluate it withM-x eval-buffer
, then you can encrypt and decrypt Emacs buffers with, respectively,M-x enscryerypt-encrypt-buffer
andM-x enscryerypt-decrypt-buffer
.For instance, here is encrypted text that you can try to decrypt:
The password I used to encrypt it is: where the raven scry
To run Enscryerypt, you need the latest version of Scryer Prolog installed from source, due to the use of
phrase_to_stream/2
,portray_clause_//1
, and other very recent additions.Enjoy!
Markus
Beta Was this translation helpful? Give feedback.
All reactions